{"id":4171,"date":"2013-02-12T11:59:00","date_gmt":"2013-02-12T11:59:00","guid":{"rendered":"https:\/\/blogs.technet.microsoft.com\/heyscriptingguy\/2013\/02\/12\/powertip-start-your-powershell-3-0-script-in-powershell-2-0\/"},"modified":"2013-02-12T11:59:00","modified_gmt":"2013-02-12T11:59:00","slug":"powertip-start-your-powershell-3-0-script-in-powershell-2-0","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/scripting\/powertip-start-your-powershell-3-0-script-in-powershell-2-0\/","title":{"rendered":"PowerTip: Start Your PowerShell 3.0 Script in PowerShell 2.0"},"content":{"rendered":"<p><strong style=\"font-size: 12px\">Summary:<\/strong><span style=\"font-size: 12px\">&nbsp;Learn how to start your Windows PowerShell&nbsp;3.0 script in Windows PowerShell&nbsp;2.0 mode.<\/span><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/q-for-powertip.jpg\" alt=\"Hey, Scripting Guy! Question\" \/>&nbsp;I have a Windows PowerShell script I wrote several years ago. The script runs fine on a computer running Windows&nbsp;7 with Windows PowerShell&nbsp;2.0, but it does not work on my Windows&nbsp;8 computer. I want to see if I can make the script work. What is the easiest thing to do?<\/p>\n<p style=\"padding-left: 60px\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/a-for-powertip.jpg\" alt=\"Hey, Scripting Guy! Answer\" \/>&nbsp;Start Windows PowerShell in version 2.0 mode. To do this, use the&nbsp;<strong>Run<\/strong>&nbsp;command and launch&nbsp;<strong>powershell -version 2<\/strong>. You can use the&nbsp;<strong>$psversionTable<\/strong>&nbsp;automatic variable to confirm you are now running in Windows PowerShell&nbsp;2.0 (PowerShell will also be running in MTA apartment mode), as shown here.<\/p>\n<p style=\"padding-left: 120px\">PS C:\\&gt; $PSVersionTable<\/p>\n<p style=\"padding-left: 120px\">Name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Value<\/p>\n<p style=\"padding-left: 120px\">&#8212;-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8212;&#8211;<\/p>\n<p style=\"padding-left: 120px\">CLRVersion&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2.0.50727.6400<\/p>\n<p style=\"padding-left: 120px\">BuildVersion&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 6.1.7600.16385<\/p>\n<p style=\"padding-left: 120px\">PSVersion&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2.0<\/p>\n<p style=\"padding-left: 120px\">WSManStackVersion&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2.0<\/p>\n<p style=\"padding-left: 120px\">PSCompatibleVersions&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {1.0, 2.0}<\/p>\n<p style=\"padding-left: 120px\">SerializationVersion&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1.1.0.1<\/p>\n<p style=\"padding-left: 120px\">PSRemotingProtocolVersion&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2.1<\/p>\n<p><a href=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/7610.Dr.ScriptoForTips.jpg\"><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/wp-content\/uploads\/sites\/29\/2019\/02\/7610.Dr.ScriptoForTips.jpg\" alt=\"\" border=\"0\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Summary:&nbsp;Learn how to start your Windows PowerShell&nbsp;3.0 script in Windows PowerShell&nbsp;2.0 mode. &nbsp;I have a Windows PowerShell script I wrote several years ago. The script runs fine on a computer running Windows&nbsp;7 with Windows PowerShell&nbsp;2.0, but it does not work on my Windows&nbsp;8 computer. I want to see if I can make the script work. [&hellip;]<\/p>\n","protected":false},"author":596,"featured_media":87096,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[356,3,45],"class_list":["post-4171","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-scripting","tag-powertip","tag-scripting-guy","tag-windows-powershell"],"acf":[],"blog_post_summary":"<p>Summary:&nbsp;Learn how to start your Windows PowerShell&nbsp;3.0 script in Windows PowerShell&nbsp;2.0 mode. &nbsp;I have a Windows PowerShell script I wrote several years ago. The script runs fine on a computer running Windows&nbsp;7 with Windows PowerShell&nbsp;2.0, but it does not work on my Windows&nbsp;8 computer. I want to see if I can make the script work. [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/4171","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/users\/596"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/comments?post=4171"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/posts\/4171\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media\/87096"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/media?parent=4171"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/categories?post=4171"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/scripting\/wp-json\/wp\/v2\/tags?post=4171"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}