C#C
C#2y ago
3 replies
leave

how to load the dll for System.Management.Automation on runtime ?

using System;
using System.Management.Automation;

class PowerShhel
{
    public static void Main(string[] args)
    {
        string command = "";

        using (PowerShell powerShell = PowerShell.Create())
        {
            powerShell.AddScript(command);
            var results = powerShell.Invoke();
        }
    }
}
Was this page helpful?