My current code:
$vm = Get-AzVM -ResourceGroupName powershell-testing -Name vmm -Status
if($VM.VMAgent.Statuses[0].DisplayStatus -eq "Not Ready"){
Write-Host $VM.VMAgent.Statuses.Message
}else{
Start-Service $AzureAgentServiceName
}
-------------------------------------------------------------------------
Scenario:
-Check VM Agent status Good or Not Good
-If VM Agent status GOOD not require to Start WindowsAzureGuestAgent service.
-If VM Agent status NOT GOOD require to Start WindowsAzureGuestAgent service.
Problem now in my script:
I can't check the agent status is Good or not good to excute. Can anyone help me with the code ?
$vm = Get-AzVM -ResourceGroupName powershell-testing -Name vmm -Status
if($VM.VMAgent.Statuses[0].DisplayStatus -eq "Not Ready"){
Write-Host $VM.VMAgent.Statuses.Message
}else{
Start-Service $AzureAgentServiceName
}
-------------------------------------------------------------------------
Scenario:
-Check VM Agent status Good or Not Good
-If VM Agent status GOOD not require to Start WindowsAzureGuestAgent service.
-If VM Agent status NOT GOOD require to Start WindowsAzureGuestAgent service.
Problem now in my script:
I can't check the agent status is Good or not good to excute. Can anyone help me with the code ?