Quantcast
Channel: Azure Virtual Machines forum
Viewing all articles
Browse latest Browse all 12545

Having problem with Powershell script for VM Agent Status and WindowsAzureGuestAgent service..

$
0
0
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 ?

Viewing all articles
Browse latest Browse all 12545

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>