0

I'm hoping my question is not a duplicated one. By googling all existing answers they are either too old or too new to me.

I'm trying to call PowerShell script from C# code. I'm using Visual Studio 2019, .NetFramework 4.7.2. PowerShell installed on my computer is "PSVersion 5.1.19041.1682" The only System.Management.Automation.dll I found on my computer is at "C:\Program Files (x86)\Reference Assemblies\Microsoft\WindowsPowerShell\3.0".

Based on some instructions found, I installed 2 Nuget Packages "System.Management.Automation 7.3.2" and "Microsoft.PowerShell.SDK 7.3.2" Both of them have a lowest version down to 6.0.4.

With their latest version 7.3.2 They are not adding "System.Management.Automation.dll" to my reference list.

Is there a way I can download a version of System.Management.Automation.dll that is compatible with Powershell version 5.1, so I can add it to my project reference list and then just follow the standard step from Microsoft to call PS script?

mklement0
  • 382,024
  • 64
  • 607
  • 775
myajax95
  • 29
  • 7

0 Answers0