Why am I getting this exception:
System.Management.Automation.CommandNotFoundException: The term new-storagegroup....
Relevant Code:
RunspaceConfiguration rsConfig = RunspaceConfiguration.Create();
PSSnapInException snapInException = null;
PSSnapInInfo info = rsConfig.AddPSSnapIn("Microsoft.Exchange.Management.PowerShell.Admin", out snapInException);
Runspace myRunSpace = RunspaceFactory.CreateRunspace(rsConfig);
myRunSpace.Open();
Pipeline pipeline = myRunSpace.CreatePipeline();
string strScript = "new-storagegroup -Server KINGKONG"
+ " -LogFolderPath c:\\rsg\\logs -Name RecoveryGroup -SystemFolderPath c:\\rsg\\data -Recovery";
Command myCommand = new Command(strScript);
pipeline.Commands.Add(myCommand);
Collection<PSObject> results = pipeline.Invoke();
source
share