0
我試圖運行我的azurewebsite「設置AzureWebsite」沒有被識別爲cmdlet的名稱,
public string RunPowerShellScript()
{
try
{
RunspaceConfiguration runspaceConfiguration = RunspaceConfiguration.Create();
Runspace runspace = RunspaceFactory.CreateRunspace(runspaceConfiguration);
runspace.Open();
RunspaceInvoke scriptInvoker = new RunspaceInvoke(runspace);
Pipeline pipeline = runspace.CreatePipeline();
//Here's how you add a new script with arguments
Command myCommand = new Command("Set-AzureWebsite");
myCommand.Parameters.Add("Name", "rmssimple");
myCommand.Parameters.Add("HostNames ", "@('test.posxyz.com', 'xyz.com')");
pipeline.Commands.Add(myCommand);
var results = pipeline.Invoke();
return Content(results[0].ToString());
}
catch (Exception ex)
{
return Content(ex.Message);
}
}
以下PowerShell命令,但我得到波紋錯誤
術語「 Set-AzureWebsite'不被識別爲cmdlet,函數,腳本文件或可操作程序的名稱。檢查名稱的拼寫,或者如果包含路徑,請驗證路徑是否正確,然後重試。
我已經安裝了Powershell工具,用於Windows PowerShell的Windows Azure Active Directory模塊等 –
當我嘗試在PowerShell導入模塊Azure中運行命令時,它給了我錯誤「找不到指定的模塊「Azure」 –
powershell工具有單獨的下載:http://azure.microsoft.com/en-us/downloads/請參閱命令行部分 – techmike2kx