Hello Glenn Hunter,
Use PowerShell to inventory the current version of the Azure VM Agent installed across all VMs.
$Report = [System.Collections.Generic.List[Object]]::new() $vms = $null $vms = Get-azVm -Status Foreach ($vm in $vms){ $obj = [PSCustomObject][ordered]@{ "Server Name" = $vm.Name "OS" = $vm.StorageProfile.ImageReference.offer "OS Sku" = $vm.StorageProfile.ImageReference.sku "OS Name" = $vm.OsName "OS Version" = $vm.OsVersion } $report.Add($obj) }$Report | Export-CSV C:\temp\ArchieVM_Status.csv
This can be run against any subscription to retrieve Azure VMs and their corresponding operating systems.
NOTE: The OS Name and OS Version will not be populated if the VM is turned off/deallocated.
Download the latest version of the VM Agent from the https://github.com/Azure/WindowsVMAgent.
Deploy this via automation tools (like Azure Automation, PowerShell, Desired State Configuration (DSC), or Group Policy) to manage updates across multiple VMs efficiently.
deployment using powershell script
# Login and set contextConnect-AzAccount$subscriptionId = "your-subscription-id"Set-AzContext -SubscriptionId $subscriptionId# Get all VMs in the subscription$vms = Get-AzVM# Loop through each VMforeach ($vm in $vms) { # Get the status of each VM $vmStatus = Get-AzVM -ResourceGroupName $vm.ResourceGroupName -Name $vm.Name -Status # Check if the VM Agent is outdated if ($vmStatus.Statuses.DisplayStatus -contains "VM Agent is outdated") { # Output the VM name and status Write-Output "VM Agent is outdated on VM: $($vm.Name)" # Restart the VM to trigger agent update - Uncomment the next line to enable restart # Restart-AzVM -ResourceGroupName $vm.ResourceGroupName -Name $vm.Name -Force # Alternatively, you can inform the user to manually update or set auto-update settings Write-Output "Please update the VM Agent manually or ensure that auto-update is enabled." } else { # Output that the VM is up to date Write-Output "VM Agent is up to date on VM: $($vm.Name)" }}
Check with this documentation if it helps you
https://learn.microsoft.com/en-us/azure/virtual-machines/windows-in-place-upgrade
Hope this helps you
If an answer has been helpful, please consideraccepting the answerto help increase visibility of this question for other members of the Microsoft Q&A community. If not, please let us know what is still needed in the comments so the question can be answered. Thank you for helping to improve Microsoft Q&A!