{"id":7908,"date":"2020-11-25T13:47:23","date_gmt":"2020-11-25T18:47:23","guid":{"rendered":"https:\/\/jdhitsolutions.com\/blog\/?p=7908"},"modified":"2020-11-25T13:54:53","modified_gmt":"2020-11-25T18:54:53","slug":"measuring-powershell-profile-performance","status":"publish","type":"post","link":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7908\/measuring-powershell-profile-performance\/","title":{"rendered":"Measuring PowerShell Profile Performance"},"content":{"rendered":"\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"150\" height=\"150\" src=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/12\/eternalclock_150x150.png\" alt=\"\" class=\"wp-image-3608\"\/><\/figure>\n\n\n\n<p>Today's topic is one of those things that I don't know why I've never addressed before. Well, I have for myself in a manual process. Hopefully you'll find it useful.  <\/p>\n\n\n\n<p>As you probably know, PowerShell uses a set of profile scripts. These scripts have hard-coded paths and PowerShell runs them in order from broadest to narrowest. <\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>All Users All Hosts<\/li><li>All Users Current Host<\/li><li>Current User All Hosts<\/li><li>Current User Current Host<\/li><\/ul>\n\n\n\n<p>The host refers to the PowerShell host that you see when you look at $host. The $profile variable shows you the value for current user current host script. But you can easily see all the values.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-style-default\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"147\" src=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/11\/ps7profiles-1024x147.png\" alt=\"\" class=\"wp-image-7909\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/11\/ps7profiles-1024x147.png 1024w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/11\/ps7profiles-300x43.png 300w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/11\/ps7profiles-768x110.png 768w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/11\/ps7profiles-1536x220.png 1536w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/11\/ps7profiles-850x122.png 850w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/11\/ps7profiles.png 1768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Here's the \"issue\" that often arises. Someone will mention that PowerShell, and this includes PowerShell Core, takes too long to load. In fact, PowerShell now shows you how long it took to load. Almost always, the issue is something profile related. Sometimes a command is taking too long to run, or maybe the profile needs a little cleanup. I know my PS7 load times were high until I cleaned up a few items and re-structured some of the commands.<\/p>\n\n\n\n<p>To make this easier, I put together a simple script that you can run in Windows PowerShell, or PowerShell (even cross-platform) that will run your profile scripts and report how long they take to complete.<\/p>\n\n\n\n<pre class=\"wp-block-code\" title=\"Test-ProfilePerf.ps1\"><code lang=\"powershell\" class=\"language-powershell\">#requires -version 5.1\n\n#test profile script performance\n\n&lt;#\nC:\\scripts\\Test-ProfilePerf.ps1\nC:\\scripts\\Test-ProfilePerf.ps1 -outvariable p | measure-object -Property TimeMS -sum\n$p\n\n#>\n\n[cmdletbinding()]\nParam()\n\n#this is the scriptblock of commands to run in a new Powershell\/pwsh session\n$sb = {\n    $profiles = [ordered]@{\n        AllUsersAllHosts       = $profile.AllUsersAllHosts\n        AllUsersCurrentHost    = $profile.AllUsersCurrentHost\n        CurrentUserAllHosts    = $profile.CurrentUserAllHosts\n        CurrentUserCurrentHost = $profile.CurrentUserCurrentHost\n    }\n\n    #only need to get these values once\n    $psver = $PSVersionTable.PSVersion\n    $computer = [System.Environment]::MachineName\n    $user = \"$([System.Environment]::UserDomainName)\\$([system.Environment]::userName)\"\n\n    foreach ($prof in $profiles.GetEnumerator()) {\n        If (Test-Path $prof.value) {\n            # Write-Host \"Measuring script for $($prof.key)\" -ForegroundColor cyan\n            $m = Measure-Command { . $prof.value }\n\n            #create a result\n            [pscustomobject]@{\n                Computername = $computer\n                Username     = $user\n                PSVersion    = $psver\n                Profile      = $prof.key\n                Path         = $prof.value\n                TimeMS       = $m.totalMilliseconds\n            }\n        } #if test path\n\n    } #foreach profile\n} #scriptblock\n\n#use the detected PowerShell version\nif ($PSEdition -eq 'Core') {\n    #Windows uses pwsh.exe and non-Windows uses pwsh. \n    $cmd = (Get-Command pwsh).source\n    $result = &amp;$cmd -nologo -noprofile -command $sb\n}\nelse {\n    $result = powershell.exe -nologo -noprofile -command $sb\n}\n\n#use $result as the output of this command\n$result<\/code><\/pre>\n\n\n\n<p>The script file runs a scriptblock in a new PowerShell or pwsh session with no profiles. The scriptblock runs each profile script in order and measures how long each detected profile script runs. The performance times should be pretty close.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-style-default\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"474\" src=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/11\/test-profile7-1024x474.png\" alt=\"\" class=\"wp-image-7910\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/11\/test-profile7-1024x474.png 1024w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/11\/test-profile7-300x139.png 300w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/11\/test-profile7-768x356.png 768w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/11\/test-profile7-850x394.png 850w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/11\/test-profile7.png 1471w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large is-style-default\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"422\" src=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/11\/test-profile51-1024x422.png\" alt=\"\" class=\"wp-image-7911\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/11\/test-profile51-1024x422.png 1024w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/11\/test-profile51-300x123.png 300w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/11\/test-profile51-768x316.png 768w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/11\/test-profile51-850x350.png 850w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/11\/test-profile51.png 1460w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>If you'd like to see a total you could run a command like:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"powershell\" class=\"language-powershell\">C:\\scripts\\Test-ProfilePerf.ps1 -outvariable p | measure-object -Property TimeMS -sum<\/code><\/pre>\n\n\n\n<p>The script is configured with cmdletbinding so you can use a common parameter like OutVariable.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-style-default\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"581\" src=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/11\/test-profile-sum-1024x581.png\" alt=\"\" class=\"wp-image-7912\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/11\/test-profile-sum-1024x581.png 1024w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/11\/test-profile-sum-300x170.png 300w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/11\/test-profile-sum-768x436.png 768w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/11\/test-profile-sum-1536x872.png 1536w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/11\/test-profile-sum-850x482.png 850w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/11\/test-profile-sum.png 1739w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>If you test, and one of the scripts seems to take a long time, wait a minute and repeat the test. If you consistently get a value you don't like, at least now you have something to investigate.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Caveats<\/h2>\n\n\n\n<p>This script makes an assumption that your profile scripts aren't taking drastic steps like creating new Active Directory users or deleting files. I'm assuming you are using a profile script to define things like variables and PSDrives, and import modules or define functions.<\/p>\n\n\n\n<p>This version of the script also won't test profile scripts under hosts such as VS Code or the PowerShell ISE.<\/p>\n\n\n\n<p>I hope you find this helpful.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Today&#8217;s topic is one of those things that I don&#8217;t know why I&#8217;ve never addressed before. Well, I have for myself in a manual process. Hopefully you&#8217;ll find it useful. As you probably know, PowerShell uses a set of profile scripts. These scripts have hard-coded paths and PowerShell runs them in order from broadest to&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"New on the blog: Measuring #PowerShell Profile Performance","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[4],"tags":[84],"class_list":["post-7908","post","type-post","status-publish","format-standard","hentry","category-powershell","tag-profile"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.6 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Measuring PowerShell Profile Performance &#8226; The Lonely Administrator<\/title>\n<meta name=\"description\" content=\"Here&#039;s a handy script you can use to measure the performance of your PowerShell profile scripts. Works for Windows PowerShell and Core.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/jdhitsolutions.com\/blog\/powershell\/7908\/measuring-powershell-profile-performance\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Measuring PowerShell Profile Performance &#8226; The Lonely Administrator\" \/>\n<meta property=\"og:description\" content=\"Here&#039;s a handy script you can use to measure the performance of your PowerShell profile scripts. Works for Windows PowerShell and Core.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jdhitsolutions.com\/blog\/powershell\/7908\/measuring-powershell-profile-performance\/\" \/>\n<meta property=\"og:site_name\" content=\"The Lonely Administrator\" \/>\n<meta property=\"article:published_time\" content=\"2020-11-25T18:47:23+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-11-25T18:54:53+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/12\/eternalclock_150x150.png\" \/>\n<meta name=\"author\" content=\"Jeffery Hicks\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@JeffHicks\" \/>\n<meta name=\"twitter:site\" content=\"@JeffHicks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Jeffery Hicks\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7908\\\/measuring-powershell-profile-performance\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7908\\\/measuring-powershell-profile-performance\\\/\"},\"author\":{\"name\":\"Jeffery Hicks\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"headline\":\"Measuring PowerShell Profile Performance\",\"datePublished\":\"2020-11-25T18:47:23+00:00\",\"dateModified\":\"2020-11-25T18:54:53+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7908\\\/measuring-powershell-profile-performance\\\/\"},\"wordCount\":412,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7908\\\/measuring-powershell-profile-performance\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2013\\\/12\\\/eternalclock_150x150.png\",\"keywords\":[\"Profile\"],\"articleSection\":[\"PowerShell\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7908\\\/measuring-powershell-profile-performance\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7908\\\/measuring-powershell-profile-performance\\\/\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7908\\\/measuring-powershell-profile-performance\\\/\",\"name\":\"Measuring PowerShell Profile Performance &#8226; The Lonely Administrator\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7908\\\/measuring-powershell-profile-performance\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7908\\\/measuring-powershell-profile-performance\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2013\\\/12\\\/eternalclock_150x150.png\",\"datePublished\":\"2020-11-25T18:47:23+00:00\",\"dateModified\":\"2020-11-25T18:54:53+00:00\",\"description\":\"Here's a handy script you can use to measure the performance of your PowerShell profile scripts. Works for Windows PowerShell and Core.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7908\\\/measuring-powershell-profile-performance\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7908\\\/measuring-powershell-profile-performance\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7908\\\/measuring-powershell-profile-performance\\\/#primaryimage\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2013\\\/12\\\/eternalclock_150x150.png\",\"contentUrl\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2013\\\/12\\\/eternalclock_150x150.png\",\"width\":150,\"height\":150},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/7908\\\/measuring-powershell-profile-performance\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"PowerShell\",\"item\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/category\\\/powershell\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Measuring PowerShell Profile Performance\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/\",\"name\":\"The Lonely Administrator\",\"description\":\"Practical Advice for the Automating IT Pro\",\"publisher\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\",\"name\":\"Jeffery Hicks\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\",\"caption\":\"Jeffery Hicks\"},\"logo\":{\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Measuring PowerShell Profile Performance &#8226; The Lonely Administrator","description":"Here's a handy script you can use to measure the performance of your PowerShell profile scripts. Works for Windows PowerShell and Core.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7908\/measuring-powershell-profile-performance\/","og_locale":"en_US","og_type":"article","og_title":"Measuring PowerShell Profile Performance &#8226; The Lonely Administrator","og_description":"Here's a handy script you can use to measure the performance of your PowerShell profile scripts. Works for Windows PowerShell and Core.","og_url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7908\/measuring-powershell-profile-performance\/","og_site_name":"The Lonely Administrator","article_published_time":"2020-11-25T18:47:23+00:00","article_modified_time":"2020-11-25T18:54:53+00:00","og_image":[{"url":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/12\/eternalclock_150x150.png","type":"","width":"","height":""}],"author":"Jeffery Hicks","twitter_card":"summary_large_image","twitter_creator":"@JeffHicks","twitter_site":"@JeffHicks","twitter_misc":{"Written by":"Jeffery Hicks","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7908\/measuring-powershell-profile-performance\/#article","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7908\/measuring-powershell-profile-performance\/"},"author":{"name":"Jeffery Hicks","@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"headline":"Measuring PowerShell Profile Performance","datePublished":"2020-11-25T18:47:23+00:00","dateModified":"2020-11-25T18:54:53+00:00","mainEntityOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7908\/measuring-powershell-profile-performance\/"},"wordCount":412,"commentCount":0,"publisher":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7908\/measuring-powershell-profile-performance\/#primaryimage"},"thumbnailUrl":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/12\/eternalclock_150x150.png","keywords":["Profile"],"articleSection":["PowerShell"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/7908\/measuring-powershell-profile-performance\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7908\/measuring-powershell-profile-performance\/","url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7908\/measuring-powershell-profile-performance\/","name":"Measuring PowerShell Profile Performance &#8226; The Lonely Administrator","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7908\/measuring-powershell-profile-performance\/#primaryimage"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7908\/measuring-powershell-profile-performance\/#primaryimage"},"thumbnailUrl":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/12\/eternalclock_150x150.png","datePublished":"2020-11-25T18:47:23+00:00","dateModified":"2020-11-25T18:54:53+00:00","description":"Here's a handy script you can use to measure the performance of your PowerShell profile scripts. Works for Windows PowerShell and Core.","breadcrumb":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7908\/measuring-powershell-profile-performance\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/7908\/measuring-powershell-profile-performance\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7908\/measuring-powershell-profile-performance\/#primaryimage","url":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/12\/eternalclock_150x150.png","contentUrl":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/12\/eternalclock_150x150.png","width":150,"height":150},{"@type":"BreadcrumbList","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7908\/measuring-powershell-profile-performance\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"PowerShell","item":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},{"@type":"ListItem","position":2,"name":"Measuring PowerShell Profile Performance"}]},{"@type":"WebSite","@id":"https:\/\/jdhitsolutions.com\/blog\/#website","url":"https:\/\/jdhitsolutions.com\/blog\/","name":"The Lonely Administrator","description":"Practical Advice for the Automating IT Pro","publisher":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/jdhitsolutions.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9","name":"Jeffery Hicks","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg","url":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg","caption":"Jeffery Hicks"},"logo":{"@id":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg"}}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"jetpack-related-posts":[{"id":8378,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8378\/powershell-tough-love\/","url_meta":{"origin":7908,"position":0},"title":"PowerShell Tough Love","author":"Jeffery Hicks","date":"May 6, 2021","format":false,"excerpt":"The other day I was helping Gladys Kravitz on her transition to VS Code. Like many of you, she has been using the PowerShell ISE for years and has a deeply ingrained workflow. I'll be the first to admit that making the transition to VS Code is not easy. I\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/05\/pexels-cottonbro-7670313.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":3774,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/3774\/friday-fun-create-all-powershell-profile-scripts\/","url_meta":{"origin":7908,"position":1},"title":"Friday Fun: Create All PowerShell Profile Scripts","author":"Jeffery Hicks","date":"March 28, 2014","format":false,"excerpt":"Whenever I train on PowerShell I inevitably get around to discussing PowerShell profile scripts. For those of you new to PowerShell, a profile script is where you put all the commands you want to run that will define your PowerShell session just the way you need it. You might load\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"talkbubble","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/10\/talkbubble.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":2486,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2486\/powershell-version-profile-tips\/","url_meta":{"origin":7908,"position":2},"title":"PowerShell Version Profile Tips","author":"Jeffery Hicks","date":"September 12, 2012","format":false,"excerpt":"Now that PowerShell v3 is finally and officially with us, I'm trusting that many of you are embracing it. I've made the jump, although I have had to make some minor adjustments. If you are going to live entirely in a PowerShell v3 world, fantastic! Go forth and spread the\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/05\/talkbubble-v3-150x150.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":6371,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/6371\/making-the-leap-to-powershell-core\/","url_meta":{"origin":7908,"position":3},"title":"Making the Leap to PowerShell Core","author":"Jeffery Hicks","date":"January 9, 2019","format":false,"excerpt":"For years I have spent most of my time in a Windows PowerShell prompt. I have actually taken it as a badge of honor that I've been able to manage my day and all of my work from a PowerShell prompt. I also have created practically all of my content\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/01\/image_thumb-11.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/01\/image_thumb-11.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/01\/image_thumb-11.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/01\/image_thumb-11.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":489,"url":"https:\/\/jdhitsolutions.com\/blog\/scripting\/489\/get-profiles\/","url_meta":{"origin":7908,"position":4},"title":"Get Profiles","author":"Jeffery Hicks","date":"November 6, 2009","format":false,"excerpt":"Keith Hill posted a bit of PowerShell code a few days ago that piqued my interest. I knew that in PowerShell, the $profile variable would list your current profile. PS C:\\> $profile C:\\Users\\Jeff\\Documents\\WindowsPowerShell\\Microsoft.PowerShell_profile.ps1 This is handy because it makes it easy to call up my script editor if I need\u2026","rel":"","context":"In &quot;PowerShell v2.0&quot;","block_context":{"text":"PowerShell v2.0","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell-v2-0\/"},"img":{"alt_text":"profiles","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2009\/11\/profiles_thumb.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":3032,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/3032\/powershell-version-profiles\/","url_meta":{"origin":7908,"position":5},"title":"PowerShell Version Profiles","author":"Jeffery Hicks","date":"May 15, 2013","format":false,"excerpt":"One of the best things about PowerShell 3.0, for me anyway, is the ability to run PowerShell 2.0 side by side. I often need to test commands and scripts in both versions not only for my writing projects but also when helping people out. Like many of you I have\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"talkbubble","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/10\/talkbubble-150x150.png?resize=350%2C200","width":350,"height":200},"classes":[]}],"_links":{"self":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/7908","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/comments?post=7908"}],"version-history":[{"count":0,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/7908\/revisions"}],"wp:attachment":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=7908"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=7908"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=7908"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}