{"id":1173,"date":"2011-03-02T10:40:17","date_gmt":"2011-03-02T15:40:17","guid":{"rendered":"http:\/\/jdhitsolutions.com\/blog\/?p=1173"},"modified":"2011-03-02T10:40:17","modified_gmt":"2011-03-02T15:40:17","slug":"get-my-variables","status":"publish","type":"post","link":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1173\/get-my-variables\/","title":{"rendered":"Get My Variables"},"content":{"rendered":"<p>As you might imagine I write a lot of PowerShell scripts and examples. Often my PowerShell Window is open for days at a time. One challenge I have always has is trying to remember what variables I have defined. If I knew the name I'd simply use Get-Variable. What I really want is a way to see just the variables that I've created. So I wrote a function to do just that. As an added benefit I can also export these variables and re-import them into another PowerShell session.<!--more--><\/p>\n<p>Here's the function's core code, less the comment based help.<\/p>\n<p>[cc lang=\"PowerShell\"]<br \/>\nFunction Get-MyVariable {<\/p>\n<p>   [cmdletbinding()]<\/p>\n<p>    Param(<br \/>\n    [Parameter(Position=0)]<br \/>\n    [ValidateSet(\"Global\",\"Local\",\"Script\",\"Private\",0,1,2,3)]<br \/>\n    [ValidateNotNullOrEmpty()]<br \/>\n    [string]$Scope=\"Global\")<\/p>\n<p>    if ($psise)<br \/>\n    {<br \/>\n        Write-Warning \"This function is not designed for the PowerShell ISE.\"<br \/>\n    }<br \/>\n    else<br \/>\n    {<br \/>\n        Write-Verbose \"Getting system defined variables\"<br \/>\n        #get all global variables from PowerShell with no profiles<br \/>\n        $psvariables=powershell -noprofile -COMMAND \"& {GET-VARIABLE | select -expandproperty name}\"<br \/>\n        Write-Verbose \"Found $($psvariables.count)\"<\/p>\n<p>        #find all the variables where the name isn't in the variable we just created<br \/>\n        #and also isn't a system variable generated after the shell has been running<br \/>\n        #and also any from this function<br \/>\n        Write-Verbose \"Getting current variables in $Scope scope\"<br \/>\n        $variables=Get-Variable -Scope $Scope<br \/>\n        Write-Verbose \"Found $($variables.count)\"<br \/>\n        Write-Verbose \"Filtering variables\"<br \/>\n        #define variables to also exclude<br \/>\n        $skip=\"LastExitCode|_|PSScriptRoot|skip|PSCmdlet|psvariables|variables|Scope\"<br \/>\n        $variables | Where {$psvariables -notcontains $_.name -AND $_.name -notmatch $skip}<br \/>\n        Write-Verbose \"Finished getting my variables\"<br \/>\n    }<br \/>\n} #end function<br \/>\n[\/cc]<\/p>\n<p>As I was developing this function, Get-MyVariable, I originally was focused on the global scope. But then I realized I could also use something like this to track variables defined in a script or function. Thus the function includes a parameter called -Scope with a default value of Global. You can use any of the parameters that you would use with any of the Variable cmdlets, ie Global, Local, Script or Private. You can also use an integer to indicate the scope level. A value of 0 means the current scope. A value of 1 is the parent scope, 2 is the next scope up and so on. I limited my function to 5 which should be more than enough.  What this means is that I can run a command like this and check the state of all my variables.<\/p>\n<p>[cc lang=\"PowerShell\"]<br \/>\nPS C:\\> function foo { . s:\\get-myvariable.ps1;$a=4;$b=2;$c=$a*$b;get-MyVariable -scope 1 -verbose;$c}<br \/>\n[\/cc]<\/p>\n<p>The Get-MyVariable function has it's own scope so by specifying a scope of 1 I get the variables defined in the foo function.<\/p>\n<p>[cc lang=\"PowerShell\"]<br \/>\nPS S:\\> foo<br \/>\nVERBOSE: Getting system defined variables<br \/>\nVERBOSE: Found 49<br \/>\nVERBOSE: Getting current variables in 1 scope<br \/>\nVERBOSE: Found 27<br \/>\nVERBOSE: Filtering variables<\/p>\n<p>Name                           Value<br \/>\n----                           -----<br \/>\na                              4<br \/>\nb                              2<br \/>\nc                              8<br \/>\nVERBOSE: Finished getting my variables<br \/>\n8<br \/>\n[\/cc]<\/p>\n<p>The function works by launching a separate PowerShell console session without any profiles to capture all variables. This should be all the variables defined by PowerShell. All I want is an array of the variable names.<\/p>\n<p>[cc lang=\"PowerShell\"]<br \/>\n$psvariables=powershell -noprofile -COMMAND \"& {GET-VARIABLE | select -expandproperty name}\"<br \/>\n[\/cc]<\/p>\n<p>Then all I have to do is get variables from the specified scope and filter out those that aren't from PowerShell as well as those defined in the Get-MyVariable function.<\/p>\n<p>[cc lang=\"PowerShell\"]<br \/>\n$variables=Get-Variable -Scope $Scope<br \/>\n#define variables to also exclude<br \/>\n$skip=\"LastExitCode|_|PSScriptRoot|skip|PSCmdlet|psvariables|variables|Scope\"<br \/>\n$variables | Where {$psvariables -notcontains $_.name -AND $_.name -notmatch $skip}<br \/>\n[\/cc]<\/p>\n<p>The script containing this function also defines an alias, <I>gmv<\/I>. You can comment out if you don't want to use it. I've added this function to my profile. Now, if I need to \"move\" variables between sessions or even computers, I can export them to an XML file.<\/p>\n<p>[cc lang=\"PowerShell\"]<br \/>\nPS C:\\> Get-MyVariable | Export-Clixml myvar.xml<br \/>\n[\/cc]<\/p>\n<p>You can then import this xml file in another session to restore these variables. This assumes you are only worried about global variables in your console session.<\/p>\n<p>[cc lang=\"PowerShell\"]<br \/>\nPS C:\\> import-clixml f:\\files\\myvar.xml | foreach {set-variable -Name $_.name -Value $_.value}<br \/>\n[\/cc]<\/p>\n<p>One caveat: depending on your variables your XML file could get quite large. During testing I had a variable defined like this.<\/p>\n<p>[cc lang=\"PowerShell\"]<br \/>\n$evt=Get-Eventlog -list<br \/>\n[\/cc]<\/p>\n<p>My XML file was over 17MB in size. <\/p>\n<p>One final note is that this function is designed to work with the PowerShell console, not the ISE. In fact, I have code to check if you are running it in the ISE.  The varaiable, $psise, refers to the ISE object.<\/p>\n<p>[cc lang=\"PowerShell\"]<br \/>\nif ($psise)<br \/>\n{<br \/>\n    Write-Warning \"This function is not designed for the PowerShell ISE.\"<br \/>\n }<br \/>\n[\/cc]<\/p>\n<p>The ISE introduces it's own set of default variables. But since I primarily use the console, I didn't bother finding an easy way to filter them out. Feel free to work out that for yourself.<\/p>\n<p>You can download the script file with my Get-MyVariable function <a href='http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/03\/Get-MyVariable.txt' target=\"_blank\">here.<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>As you might imagine I write a lot of PowerShell scripts and examples. Often my PowerShell Window is open for days at a time. One challenge I have always has is trying to remember what variables I have defined. If I knew the name I&#8217;d simply use Get-Variable. What I really want is a way&#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":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[4,8],"tags":[224,258,534],"class_list":["post-1173","post","type-post","status-publish","format-standard","hentry","category-powershell","category-scripting","tag-function","tag-get-variable","tag-powershell"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Get My Variables &#8226; The Lonely Administrator<\/title>\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\/1173\/get-my-variables\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Get My Variables &#8226; The Lonely Administrator\" \/>\n<meta property=\"og:description\" content=\"As you might imagine I write a lot of PowerShell scripts and examples. Often my PowerShell Window is open for days at a time. One challenge I have always has is trying to remember what variables I have defined. If I knew the name I&#039;d simply use Get-Variable. What I really want is a way...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jdhitsolutions.com\/blog\/powershell\/1173\/get-my-variables\/\" \/>\n<meta property=\"og:site_name\" content=\"The Lonely Administrator\" \/>\n<meta property=\"article:published_time\" content=\"2011-03-02T15:40:17+00:00\" \/>\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=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1173\\\/get-my-variables\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1173\\\/get-my-variables\\\/\"},\"author\":{\"name\":\"Jeffery Hicks\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"headline\":\"Get My Variables\",\"datePublished\":\"2011-03-02T15:40:17+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1173\\\/get-my-variables\\\/\"},\"wordCount\":817,\"commentCount\":1,\"publisher\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"keywords\":[\"Function\",\"Get-variable\",\"PowerShell\"],\"articleSection\":[\"PowerShell\",\"Scripting\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1173\\\/get-my-variables\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1173\\\/get-my-variables\\\/\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1173\\\/get-my-variables\\\/\",\"name\":\"Get My Variables &#8226; The Lonely Administrator\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#website\"},\"datePublished\":\"2011-03-02T15:40:17+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1173\\\/get-my-variables\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1173\\\/get-my-variables\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/1173\\\/get-my-variables\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"PowerShell\",\"item\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/category\\\/powershell\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Get My Variables\"}]},{\"@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":"Get My Variables &#8226; The Lonely Administrator","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\/1173\/get-my-variables\/","og_locale":"en_US","og_type":"article","og_title":"Get My Variables &#8226; The Lonely Administrator","og_description":"As you might imagine I write a lot of PowerShell scripts and examples. Often my PowerShell Window is open for days at a time. One challenge I have always has is trying to remember what variables I have defined. If I knew the name I'd simply use Get-Variable. What I really want is a way...","og_url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1173\/get-my-variables\/","og_site_name":"The Lonely Administrator","article_published_time":"2011-03-02T15:40:17+00:00","author":"Jeffery Hicks","twitter_card":"summary_large_image","twitter_creator":"@JeffHicks","twitter_site":"@JeffHicks","twitter_misc":{"Written by":"Jeffery Hicks","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1173\/get-my-variables\/#article","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1173\/get-my-variables\/"},"author":{"name":"Jeffery Hicks","@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"headline":"Get My Variables","datePublished":"2011-03-02T15:40:17+00:00","mainEntityOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1173\/get-my-variables\/"},"wordCount":817,"commentCount":1,"publisher":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"keywords":["Function","Get-variable","PowerShell"],"articleSection":["PowerShell","Scripting"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/1173\/get-my-variables\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1173\/get-my-variables\/","url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1173\/get-my-variables\/","name":"Get My Variables &#8226; The Lonely Administrator","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#website"},"datePublished":"2011-03-02T15:40:17+00:00","breadcrumb":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1173\/get-my-variables\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/1173\/get-my-variables\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1173\/get-my-variables\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"PowerShell","item":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},{"@type":"ListItem","position":2,"name":"Get My Variables"}]},{"@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":2350,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2350\/get-my-variable-revisited\/","url_meta":{"origin":1173,"position":0},"title":"Get My Variable Revisited","author":"Jeffery Hicks","date":"May 29, 2012","format":false,"excerpt":"Last year I wrote a few articles on working with variables. One task I needed was to identify the variables that I had created in a given PowerShell session with a function I wrote called Get-MyVariable. I also posted an article on identifying the object type for a variable value.\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\/2011\/10\/talkbubble-150x150.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":3912,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/3912\/friday-fun-a-random-powershell-console\/","url_meta":{"origin":1173,"position":1},"title":"Friday Fun: A Random PowerShell Console","author":"Jeffery Hicks","date":"July 11, 2014","format":false,"excerpt":"This week I thought we'd have a little fun with the PowerShell console and maybe pick up a few scripting techniques along the way. Today I have a function that changes the foreground and background colors of your PowerShell console to random values. But because you might want to go\u2026","rel":"","context":"In &quot;Friday Fun&quot;","block_context":{"text":"Friday Fun","link":"https:\/\/jdhitsolutions.com\/blog\/category\/friday-fun\/"},"img":{"alt_text":"crayons","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/11\/crayons-150x150.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":2425,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2425\/friday-fun-expand-environmental-variables-in-powershell-strings\/","url_meta":{"origin":1173,"position":2},"title":"Friday Fun: Expand Environmental Variables in PowerShell Strings","author":"Jeffery Hicks","date":"June 29, 2012","format":false,"excerpt":"This week I was working on a project that involved using the %PATH% environmental variable. The challenge was that I have some entries that look like this: %SystemRoot%\\system32\\WindowsPowerShell\\v1.0\\. When I try to use that path in PowerShell, it complains because it doesn't expand %SystemRoot%. What I needed was a way\u2026","rel":"","context":"In &quot;CommandLine&quot;","block_context":{"text":"CommandLine","link":"https:\/\/jdhitsolutions.com\/blog\/category\/commandline\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/06\/powershellvariable-300x71.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":1766,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1766\/domain-controller-powershell-prompt\/","url_meta":{"origin":1173,"position":3},"title":"Domain Controller PowerShell Prompt","author":"Jeffery Hicks","date":"November 15, 2011","format":false,"excerpt":"The other day I passed on a tweet I came across about creating a PowerShell prompt that displayed the domain controller that authenticated you. The original post was in a NetApp forum. Later I realized what was posted was something specific to NetApp's PowerShell Toolkit. But you can use the\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1423,"url":"https:\/\/jdhitsolutions.com\/blog\/scripting\/1423\/warning-signs\/","url_meta":{"origin":1173,"position":4},"title":"Warning Signs","author":"Jeffery Hicks","date":"May 11, 2011","format":false,"excerpt":"I was working on a project with an advanced PowerShell function. One of the goals was to take advantage of the common parameters like -ErrorVariable and -WarningVariable so that when you run the function you can save errors and warnings and work with them later. Turns out one of these\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":"","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/05\/warningvariable-300x184.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":5242,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/5242\/another-powershell-todo-tool\/","url_meta":{"origin":1173,"position":5},"title":"Another PowerShell ToDo Tool","author":"Jeffery Hicks","date":"September 13, 2016","format":false,"excerpt":"Recently a reader, Matt Penny, shared a tip in a comment on one of my articles. He had a short and simple PowerShell function that he used to insert ToDo commands into his Pester test scripts. Although you could easily use it for other PowerShell work. Of course, I am\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"image","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2016\/09\/image_thumb-1.png?resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2016\/09\/image_thumb-1.png?resize=350%2C200 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2016\/09\/image_thumb-1.png?resize=525%2C300 1.5x"},"classes":[]}],"_links":{"self":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/1173","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=1173"}],"version-history":[{"count":0,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/1173\/revisions"}],"wp:attachment":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=1173"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=1173"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=1173"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}