Quantcast
Channel: Hey, Scripting Guy! Blog
Viewing all articles
Browse latest Browse all 3333

PowerTip: Start Your PowerShell 3.0 Script in PowerShell 2.0

$
0
0

Summary: Learn how to start your Windows PowerShell 3.0 script in Windows PowerShell 2.0 mode.

Hey, Scripting Guy! Question I have a Windows PowerShell script I wrote several years ago. The script runs fine on a computer running Windows 7 with Windows PowerShell 2.0, but it does not work on my Windows 8 computer. I want to see if I can make the script work. What is the easiest thing to do?

Hey, Scripting Guy! Answer Start Windows PowerShell in version 2.0 mode. To do this, use the Run command and launch powershell -version 2. You can use the $psversionTable automatic variable to confirm you are now running in Windows PowerShell 2.0 (PowerShell will also be running in MTA apartment mode), as shown here.

PS C:\> $PSVersionTable

Name                           Value

----                           -----

CLRVersion                     2.0.50727.6400

BuildVersion                   6.1.7600.16385

PSVersion                      2.0

WSManStackVersion              2.0

PSCompatibleVersions           {1.0, 2.0}

SerializationVersion           1.1.0.1

PSRemotingProtocolVersion      2.1


Viewing all articles
Browse latest Browse all 3333

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>