{"id":5782,"date":"2013-03-06T11:23:00","date_gmt":"2013-03-06T19:23:00","guid":{"rendered":"http:\/\/www.sapien.com\/blog\/?p=5782"},"modified":"2013-03-06T11:23:57","modified_gmt":"2013-03-06T19:23:57","slug":"first-rule-of-powershell-scoping-rules","status":"publish","type":"post","link":"https:\/\/dev.sapien.com\/blog\/2013\/03\/06\/first-rule-of-powershell-scoping-rules\/","title":{"rendered":"First rule of PowerShell scoping rules&hellip;"},"content":{"rendered":"<p><a href=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2013\/03\/powershellscopingsoap.png\"><img loading=\"lazy\" decoding=\"async\" style=\"border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px\" title=\"powershell scoping soap\" border=\"0\" alt=\"powershell scoping soap\" src=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2013\/03\/powershellscopingsoap_thumb.png\" width=\"644\" height=\"454\"><\/a> <\/p>\n<p>\u2026 never talk about PowerShell scoping rules.<\/p>\n<p>Judging from the posts, emails and questions we get about variable scope in PowerShell Studio forms, PowerShell scoping rules are shrouded in mystery. When you read <a href=\"http:\/\/technet.microsoft.com\/en-us\/library\/hh847849.aspx\" target=\"_blank\">about_scopes<\/a> you get a lot of information. When you come from any other scripting language, for example VBScript, you are used to two scopes; global and local. The default scope of a variable in VBScript depends on its first use or its declaration. So if you want a variable to have a specific scope you just declare it with a DIM statement.<\/p>\n<p><a href=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2013\/03\/image1.png\" target=\"_blank\"><img loading=\"lazy\" decoding=\"async\" style=\"border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2013\/03\/image_thumb1.png\" width=\"644\" height=\"438\"><\/a> <\/p>\n<\/p>\n<p>This code sample illustrates the simple scoping rules in VBScript. A variable is global or local and yes, a local variable can shadow a global one with the same name.<\/p>\n<p>The output is very much what you expect:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" style=\"border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2013\/03\/image2.png\" width=\"487\" height=\"204\"> <\/p>\n<p>&nbsp;<\/p>\n<p>Now let\u2019s do that in PowerShell:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" style=\"border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2013\/03\/image3.png\" width=\"420\" height=\"460\"> <\/p>\n<p>And the result is:<\/p>\n<p><a href=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2013\/03\/image4.png\"><img loading=\"lazy\" decoding=\"async\" style=\"border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2013\/03\/image_thumb2.png\" width=\"272\" height=\"169\"><\/a> <\/p>\n<p>The keen observer will immediately notice that $globalvariable never produces any output. That is because a variable in PowerShell is not global unless you specifically says so by using $global:globalvariable. Always. At every use. So what is the scope of $globalvariable in our example? It\u2019s \u2018local\u2019, local to the global scope to be precise. Unless specified otherwise nothing is ever global.<\/p>\n<p>So how do you set a variable from a child context? <\/p>\n<p>1. You can use a return value of a function<\/p>\n<p><a href=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2013\/03\/image5.png\"><img loading=\"lazy\" decoding=\"async\" style=\"border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2013\/03\/image_thumb3.png\" width=\"222\" height=\"144\"><\/a> <\/p>\n<p>2. You can pass&nbsp; the variable as a parameter reference<\/p>\n<p><a href=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2013\/03\/image6.png\"><img loading=\"lazy\" decoding=\"async\" style=\"border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2013\/03\/image_thumb4.png\" width=\"416\" height=\"249\"><\/a> <\/p>\n<p>Note that you cannot just assign a value to $globalvariable, that would just create a local variable of that name shadowing the parameter. You are passing a reference object, so you have to use the <em>value<\/em> property.<\/p>\n<p>3. Use $global: or $script: to modify the scope of the variable.<\/p>\n<p>If you are five levels removed from the definition or in a completely different context, for example in the event handler for a button in a Windows form, this might be the simplest solution.<\/p>\n<p><a href=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2013\/03\/image7.png\"><img loading=\"lazy\" decoding=\"async\" style=\"border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px\" title=\"image\" border=\"0\" alt=\"image\" src=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2013\/03\/image_thumb5.png\" width=\"433\" height=\"207\"><\/a> <\/p>\n<p>&nbsp;<\/p>\n<p>One last final remark and we will not talk about this anymore. Read the about article on scope. Try the examples. You will need it.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u2026 never talk about PowerShell scoping rules. Judging from the posts, emails and questions we get about variable scope in PowerShell Studio forms, PowerShell scoping rules are shrouded in mystery. When you read about_scopes you get a lot of information. When you come from any other scripting language, for example VBScript, you are used to [&hellip;]<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[27,25],"tags":[811,810,28,809,380,808,996],"class_list":["post-5782","post","type-post","status-publish","format-standard","hentry","category-ask-the-experts","category-windows-powershell","tag-global","tag-local","tag-powershell","tag-rules","tag-scope","tag-scoping","tag-vbscript"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.1 - aioseo.com -->\n\t<meta name=\"description\" content=\"\u2026 never talk about PowerShell scoping rules. Judging from the posts, emails and questions we get about variable scope in PowerShell Studio forms, PowerShell scoping rules are shrouded in mystery. When you read about_scopes you get a lot of information. When you come from any other scripting language, for example VBScript, you are used to\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Alex Riedel\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/dev.sapien.com\/blog\/2013\/03\/06\/first-rule-of-powershell-scoping-rules\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.1\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"DEV SAPIEN Blog - Tools for IT Success\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"First rule of PowerShell scoping rules\u2026 - DEV SAPIEN Blog\" \/>\n\t\t<meta property=\"og:description\" content=\"\u2026 never talk about PowerShell scoping rules. Judging from the posts, emails and questions we get about variable scope in PowerShell Studio forms, PowerShell scoping rules are shrouded in mystery. When you read about_scopes you get a lot of information. When you come from any other scripting language, for example VBScript, you are used to\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/dev.sapien.com\/blog\/2013\/03\/06\/first-rule-of-powershell-scoping-rules\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2013-03-06T19:23:00+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2013-03-06T19:23:57+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n\t\t<meta name=\"twitter:title\" content=\"First rule of PowerShell scoping rules\u2026 - DEV SAPIEN Blog\" \/>\n\t\t<meta name=\"twitter:description\" content=\"\u2026 never talk about PowerShell scoping rules. Judging from the posts, emails and questions we get about variable scope in PowerShell Studio forms, PowerShell scoping rules are shrouded in mystery. When you read about_scopes you get a lot of information. When you come from any other scripting language, for example VBScript, you are used to\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"BlogPosting\",\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/2013\\\/03\\\/06\\\/first-rule-of-powershell-scoping-rules\\\/#blogposting\",\"name\":\"First rule of PowerShell scoping rules\\u2026 - DEV SAPIEN Blog\",\"headline\":\"First rule of PowerShell scoping rules&hellip;\",\"author\":{\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/author\\\/alexander-riedel\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/#organization\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"http:\\\/\\\/www.sapien.com\\\/blog\\\/wp-content\\\/uploads\\\/2013\\\/03\\\/powershellscopingsoap_thumb.png\",\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/2013\\\/03\\\/06\\\/first-rule-of-powershell-scoping-rules\\\/#articleImage\"},\"datePublished\":\"2013-03-06T11:23:00-08:00\",\"dateModified\":\"2013-03-06T11:23:57-08:00\",\"inLanguage\":\"en-US\",\"commentCount\":3,\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/2013\\\/03\\\/06\\\/first-rule-of-powershell-scoping-rules\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/2013\\\/03\\\/06\\\/first-rule-of-powershell-scoping-rules\\\/#webpage\"},\"articleSection\":\"Ask the Experts, Windows PowerShell, global, local, powershell, rules, scope, scoping, VBScript\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/2013\\\/03\\\/06\\\/first-rule-of-powershell-scoping-rules\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/dev.sapien.com\\\/blog\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/topics\\\/windows-powershell\\\/#listItem\",\"name\":\"Windows PowerShell\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/topics\\\/windows-powershell\\\/#listItem\",\"position\":2,\"name\":\"Windows PowerShell\",\"item\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/topics\\\/windows-powershell\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/2013\\\/03\\\/06\\\/first-rule-of-powershell-scoping-rules\\\/#listItem\",\"name\":\"First rule of PowerShell scoping rules&hellip;\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/2013\\\/03\\\/06\\\/first-rule-of-powershell-scoping-rules\\\/#listItem\",\"position\":3,\"name\":\"First rule of PowerShell scoping rules&hellip;\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/topics\\\/windows-powershell\\\/#listItem\",\"name\":\"Windows PowerShell\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/#organization\",\"name\":\"DEV SAPIEN Blog\",\"description\":\"Tools for IT Success\",\"url\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/author\\\/alexander-riedel\\\/#author\",\"url\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/author\\\/alexander-riedel\\\/\",\"name\":\"Alex Riedel\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/2013\\\/03\\\/06\\\/first-rule-of-powershell-scoping-rules\\\/#webpage\",\"url\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/2013\\\/03\\\/06\\\/first-rule-of-powershell-scoping-rules\\\/\",\"name\":\"First rule of PowerShell scoping rules\\u2026 - DEV SAPIEN Blog\",\"description\":\"\\u2026 never talk about PowerShell scoping rules. Judging from the posts, emails and questions we get about variable scope in PowerShell Studio forms, PowerShell scoping rules are shrouded in mystery. When you read about_scopes you get a lot of information. When you come from any other scripting language, for example VBScript, you are used to\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/2013\\\/03\\\/06\\\/first-rule-of-powershell-scoping-rules\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/author\\\/alexander-riedel\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/author\\\/alexander-riedel\\\/#author\"},\"datePublished\":\"2013-03-06T11:23:00-08:00\",\"dateModified\":\"2013-03-06T11:23:57-08:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/\",\"name\":\"DEV SAPIEN Blog\",\"description\":\"Tools for IT Success\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"First rule of PowerShell scoping rules\u2026 - DEV SAPIEN Blog","description":"\u2026 never talk about PowerShell scoping rules. Judging from the posts, emails and questions we get about variable scope in PowerShell Studio forms, PowerShell scoping rules are shrouded in mystery. When you read about_scopes you get a lot of information. When you come from any other scripting language, for example VBScript, you are used to","canonical_url":"https:\/\/dev.sapien.com\/blog\/2013\/03\/06\/first-rule-of-powershell-scoping-rules\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"BlogPosting","@id":"https:\/\/dev.sapien.com\/blog\/2013\/03\/06\/first-rule-of-powershell-scoping-rules\/#blogposting","name":"First rule of PowerShell scoping rules\u2026 - DEV SAPIEN Blog","headline":"First rule of PowerShell scoping rules&hellip;","author":{"@id":"https:\/\/dev.sapien.com\/blog\/author\/alexander-riedel\/#author"},"publisher":{"@id":"https:\/\/dev.sapien.com\/blog\/#organization"},"image":{"@type":"ImageObject","url":"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2013\/03\/powershellscopingsoap_thumb.png","@id":"https:\/\/dev.sapien.com\/blog\/2013\/03\/06\/first-rule-of-powershell-scoping-rules\/#articleImage"},"datePublished":"2013-03-06T11:23:00-08:00","dateModified":"2013-03-06T11:23:57-08:00","inLanguage":"en-US","commentCount":3,"mainEntityOfPage":{"@id":"https:\/\/dev.sapien.com\/blog\/2013\/03\/06\/first-rule-of-powershell-scoping-rules\/#webpage"},"isPartOf":{"@id":"https:\/\/dev.sapien.com\/blog\/2013\/03\/06\/first-rule-of-powershell-scoping-rules\/#webpage"},"articleSection":"Ask the Experts, Windows PowerShell, global, local, powershell, rules, scope, scoping, VBScript"},{"@type":"BreadcrumbList","@id":"https:\/\/dev.sapien.com\/blog\/2013\/03\/06\/first-rule-of-powershell-scoping-rules\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/dev.sapien.com\/blog#listItem","position":1,"name":"Home","item":"https:\/\/dev.sapien.com\/blog","nextItem":{"@type":"ListItem","@id":"https:\/\/dev.sapien.com\/blog\/topics\/windows-powershell\/#listItem","name":"Windows PowerShell"}},{"@type":"ListItem","@id":"https:\/\/dev.sapien.com\/blog\/topics\/windows-powershell\/#listItem","position":2,"name":"Windows PowerShell","item":"https:\/\/dev.sapien.com\/blog\/topics\/windows-powershell\/","nextItem":{"@type":"ListItem","@id":"https:\/\/dev.sapien.com\/blog\/2013\/03\/06\/first-rule-of-powershell-scoping-rules\/#listItem","name":"First rule of PowerShell scoping rules&hellip;"},"previousItem":{"@type":"ListItem","@id":"https:\/\/dev.sapien.com\/blog#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/dev.sapien.com\/blog\/2013\/03\/06\/first-rule-of-powershell-scoping-rules\/#listItem","position":3,"name":"First rule of PowerShell scoping rules&hellip;","previousItem":{"@type":"ListItem","@id":"https:\/\/dev.sapien.com\/blog\/topics\/windows-powershell\/#listItem","name":"Windows PowerShell"}}]},{"@type":"Organization","@id":"https:\/\/dev.sapien.com\/blog\/#organization","name":"DEV SAPIEN Blog","description":"Tools for IT Success","url":"https:\/\/dev.sapien.com\/blog\/"},{"@type":"Person","@id":"https:\/\/dev.sapien.com\/blog\/author\/alexander-riedel\/#author","url":"https:\/\/dev.sapien.com\/blog\/author\/alexander-riedel\/","name":"Alex Riedel"},{"@type":"WebPage","@id":"https:\/\/dev.sapien.com\/blog\/2013\/03\/06\/first-rule-of-powershell-scoping-rules\/#webpage","url":"https:\/\/dev.sapien.com\/blog\/2013\/03\/06\/first-rule-of-powershell-scoping-rules\/","name":"First rule of PowerShell scoping rules\u2026 - DEV SAPIEN Blog","description":"\u2026 never talk about PowerShell scoping rules. Judging from the posts, emails and questions we get about variable scope in PowerShell Studio forms, PowerShell scoping rules are shrouded in mystery. When you read about_scopes you get a lot of information. When you come from any other scripting language, for example VBScript, you are used to","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/dev.sapien.com\/blog\/#website"},"breadcrumb":{"@id":"https:\/\/dev.sapien.com\/blog\/2013\/03\/06\/first-rule-of-powershell-scoping-rules\/#breadcrumblist"},"author":{"@id":"https:\/\/dev.sapien.com\/blog\/author\/alexander-riedel\/#author"},"creator":{"@id":"https:\/\/dev.sapien.com\/blog\/author\/alexander-riedel\/#author"},"datePublished":"2013-03-06T11:23:00-08:00","dateModified":"2013-03-06T11:23:57-08:00"},{"@type":"WebSite","@id":"https:\/\/dev.sapien.com\/blog\/#website","url":"https:\/\/dev.sapien.com\/blog\/","name":"DEV SAPIEN Blog","description":"Tools for IT Success","inLanguage":"en-US","publisher":{"@id":"https:\/\/dev.sapien.com\/blog\/#organization"}}]},"og:locale":"en_US","og:site_name":"DEV SAPIEN Blog - Tools for IT Success","og:type":"article","og:title":"First rule of PowerShell scoping rules\u2026 - DEV SAPIEN Blog","og:description":"\u2026 never talk about PowerShell scoping rules. Judging from the posts, emails and questions we get about variable scope in PowerShell Studio forms, PowerShell scoping rules are shrouded in mystery. When you read about_scopes you get a lot of information. When you come from any other scripting language, for example VBScript, you are used to","og:url":"https:\/\/dev.sapien.com\/blog\/2013\/03\/06\/first-rule-of-powershell-scoping-rules\/","article:published_time":"2013-03-06T19:23:00+00:00","article:modified_time":"2013-03-06T19:23:57+00:00","twitter:card":"summary_large_image","twitter:title":"First rule of PowerShell scoping rules\u2026 - DEV SAPIEN Blog","twitter:description":"\u2026 never talk about PowerShell scoping rules. Judging from the posts, emails and questions we get about variable scope in PowerShell Studio forms, PowerShell scoping rules are shrouded in mystery. When you read about_scopes you get a lot of information. When you come from any other scripting language, for example VBScript, you are used to"},"aioseo_meta_data":{"post_id":"5782","title":null,"description":null,"keywords":null,"keyphrases":null,"focus_keyword":null,"additional_keywords":null,"truseo_locale":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_custom_url":null,"og_image_custom_fields":null,"og_image_url":null,"og_image_width":null,"og_image_height":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_image_url":null,"twitter_title":null,"twitter_description":null,"schema_type":"default","schema_type_options":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[]},"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"limit_modified_date":false,"ai":null,"breadcrumb_settings":null,"seo_analyzer_scan_date":null,"created":"2026-08-28 15:09:03","updated":"2026-08-28 15:09:03"},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/dev.sapien.com\/blog\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/dev.sapien.com\/blog\/topics\/windows-powershell\/\" title=\"Windows PowerShell\">Windows PowerShell<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tFirst rule of PowerShell scoping rules\u2026\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/dev.sapien.com\/blog"},{"label":"Windows PowerShell","link":"https:\/\/dev.sapien.com\/blog\/topics\/windows-powershell\/"},{"label":"First rule of PowerShell scoping rules&hellip;","link":"https:\/\/dev.sapien.com\/blog\/2013\/03\/06\/first-rule-of-powershell-scoping-rules\/"}],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/posts\/5782","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/comments?post=5782"}],"version-history":[{"count":3,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/posts\/5782\/revisions"}],"predecessor-version":[{"id":5794,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/posts\/5782\/revisions\/5794"}],"wp:attachment":[{"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/media?parent=5782"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/categories?post=5782"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/tags?post=5782"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}