System.Management.Automation on Nuget
System.Management.Automation.dll on NuGet, newer package from 2015, not unlisted as the previous one!
Microsoft PowerShell team packages un NuGet
Update: package is now owned by PowerShell Team. Huzzah!
A copy of System.Management.Automation.dll is installed when you install the windows SDK (a suitable, recent version of it, anyway). It should be in C:\Program Files\Reference Assemblies\Microsoft\WindowsPowerShell\v1.0\
If you don't want to install the Windows SDK you can get the dll by running the following command in powershell:
Copy ([PSObject].Assembly.Location) C:\
I couldn't get the SDK to install properly (some of the files seemed unsigned, something like that). I found another solution here and that seems to work okay for me. It doesn't require installation of new files at all. Basically, what you do is:
Edit the .csproj file in a text editor, and add:
<Reference Include="System.Management.Automation" />
to the relevant section.
Hope this helps.
if it is 64bit them - C:\Program Files (x86)\Reference Assemblies\Microsoft\WindowsPowerShell**3.0**
and version could be different
I used the VS Project Reference menu and browsed to: C:\windows\assembly\GAC_MSIL\System.Management.Automation and added a reference for the dll and the Runspaces dll.
I did not need to hack the .csprj file and add the reference line mentioned above. I do not have the Windows SDK installed.
I did do the Powershell copy mentioned above: Copy ([PSObject].Assembly.Location) C:\
My test with a Get-Process Powershell command then worked. I used examples from Powershell for developers Chapter 5.
The assembly coming with Powershell SDK (C:\Program Files\Reference Assemblies\Microsoft\WindowsPowerShell\v1.0) does not come with Powershell 2 specific types.
Manually editing the csproj file solved my problem.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With