No PowerShell in System.Management.Automation?

It's hard for me to solve the PowerShell class. I am following the example of this question .

I have a link added to System.Management.Automation from C:\Program Files\Reference Assemblies\Microsoft\WindowsPowerShell\v1.0\System.Management.Automation.dll

I have using System.Management.Automation; included at the beginning of my class.

However, when I try to create an instance of powershell: PowerShell ps = PowerShell.Create() , PowerShell will not be resolved.

Using ctrl + . to automatically add the full namespace (or using the operator), it simply offers Microsoft.Powershell instead of PowerShell .

I am very confused why this is happening, since even the example contained in the MSDN documentation in the PowerShell class has exactly the same thing I have.

I am in .NET 3.5, Visual Studio 2010 and Windows Server 2008 R2

+1
source share
1 answer

The PowerShell class is new to PowerShell 2.0. Make sure that you are referring to SMA.dll 2.0. Do you have PowerShell 2.0 installed?

+1
source

Source: https://habr.com/ru/post/947064/


All Articles