N
Nandiprasad Prabhu
Guest
InitialSessionState initialSessionState = InitialSessionState.CreateDefault();
initialSessionState.ImportPSModule(new string[] { @"C:\Program Files (x86)\Microsoft SDKs\Windows Azure\PowerShell\Azure\Azure.psd1" });
Runspace runSpace = RunspaceFactory.CreateRunspace(initialSessionState);
runSpace.Open();
RunspaceInvoke runSpaceInvoker = new RunspaceInvoke( runSpace );
runSpaceInvoker.Invoke("Set-ExecutionPolicy Unrestricted");
Pipeline pipeline = runSpace.CreatePipeline();
Command import = new Command("Import-AzurePublishSettingsFile C:\\Downloads\\MyCopy.publishsettings");
pipeline.Commands.Add(import);
Import-AzurePublishSettingsFile C:\\Downloads\\MyCopy.publishsettings
This code does not work when i execute it from c# , but works fine when i execute from the powershell.
I get the exception saying the cmdlet is not found , please check the path etc
I am not able to figure out the solution , pls help
Continue reading...
initialSessionState.ImportPSModule(new string[] { @"C:\Program Files (x86)\Microsoft SDKs\Windows Azure\PowerShell\Azure\Azure.psd1" });
Runspace runSpace = RunspaceFactory.CreateRunspace(initialSessionState);
runSpace.Open();
RunspaceInvoke runSpaceInvoker = new RunspaceInvoke( runSpace );
runSpaceInvoker.Invoke("Set-ExecutionPolicy Unrestricted");
Pipeline pipeline = runSpace.CreatePipeline();
Command import = new Command("Import-AzurePublishSettingsFile C:\\Downloads\\MyCopy.publishsettings");
pipeline.Commands.Add(import);
Import-AzurePublishSettingsFile C:\\Downloads\\MyCopy.publishsettings
This code does not work when i execute it from c# , but works fine when i execute from the powershell.
I get the exception saying the cmdlet is not found , please check the path etc
I am not able to figure out the solution , pls help
Continue reading...