Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

2.0 version of System.Management.Automation?

Tags:

c#

powershell

gac

Is there a 2.0 (or greater) version of the System.Management.Automation assembly?

I'm looking at the PowerShell class in C# which says that this class was introduced with PowerShell 2.0. Does that version number correspond with the version number I'm seeing when I add the reference to the assembly in Visual Studio?

This is kind of an additional question to my other question which is in regards to having trouble resolving the PowerShell class inside that assembly.

I've tried the System.Management.Automation assembly in both the GAC:

C:\Windows\assembly\GAC_MSIL\System.Management.Automation\1.0.0.0__31bf3856ad364e35

And Reference Assemblies:

C:\Program Files\Reference Assemblies\Microsoft\WindowsPowerShell\v1.0

Both containing folders only have version 1.0

I have PowerShell 2.0 installed.

like image 784
tnw Avatar asked Jun 11 '13 21:06

tnw


1 Answers

The strong name version for both powershell v1 and powershell v2 is 1.0.0.0. Surprising, yes, but this is a function of the backwards compatibility design. Both powershell v1 and v2 run on CLR2. Powershell v3 runs on CLR4, so they bumped the strong name version to 3.0.0.0 for that one.

Just to confuse matters further, the windows folder name for all versions is v1.0 - again, for reasons of compatibility.

The only way you could actually be running the real powershell v1.0 is if you're on windows XP, vista or server 2003/2008. If you are running windows 7, 2008r2, you are on v2 at a minimum. If you are on 8 or 2012, you are on v3 of powershell at a minimum.

I hope this helps.

like image 54
x0n Avatar answered Sep 21 '22 12:09

x0n