PowerShell powershell = PowerShell.Create(); powerShell.Commands.AddCommand("Import-Module").AddParameter("Name", "virtualmachinemanager"); powerShell.Invoke(); // This throws exception.
InitialSessionState iss = InitialSessionState.CreateDefault(); iss.ImportPSModule(new string[] { @"C:\vm\vm.psd1"}); Runspace runSpace = RunspaceFactory.CreateRunspace(iss); runSpace.Open();
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)