【发布时间】:2019-11-07 05:50:21
【问题描述】:
我当前的代码:
if ($VM.VMAgent.Statuses[0].DisplayStatus -eq "Not Ready") {
Write-Host $VM.VMAgent.Statuses.Message
} else {
Start-Service $AzureAgentServiceName
}
场景:
1. 检查VM Agent状态Good或Not Good,如果VM Agent状态GOOD不需要启动WindowsAzureGuestAgent服务。
2.如果VM Agent状态NOT GOOD需要启动WindowsAzureGuestAgent服务。
我的脚本中现在存在问题: 我无法检查代理状态是好还是不好执行。谁能帮我写代码?
【问题讨论】:
标签: azure powershell virtual-machine