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