abbgrade
abbgrade

Reputation: 578

Run Powershell with lower version

How can i test a powershell script with powershell.exe version 1? There is a version parameter but it doesn't work as expected:

C:\Users\skampmann>powershell -version 1 -command "$psversiontable.psversion.major"
2

Upvotes: 5

Views: 9331

Answers (1)

Peter Hahndorf
Peter Hahndorf

Reputation: 11222

I think the -version parameter only works for the value 2.0 or just 2 but not for 1 or 3.

To test your scripts in PowerShell 1 you have to find a machine which still has that. Just set up a VM with an old OS.

Upvotes: 5

Related Questions