Get list of Machines in Update Management sche

Adrian Evangelista 51 Reputation points
2023-04-22T23:10:25.95+00:00

We have setup both our OnPrem VM Windows Servers and Azure VM Windows Servers with Azure Update Management. All of our Azure VMs have the monitoring agent installed via VM Extension and the OnPrem VMs have it installed Our Azure VMs are currently in multiple Resource Groups, but all linked to the same Automation Account/Log Analytics workspace used for update management. Is there a way to query what servers is in which deployment schedule? i have found methods using powershell but that is only good for a single resource group. I would like to generate a report regularly on this if possible but wanted to see how to obtain that info.

Azure Update Manager
Azure Update Manager
An Azure service to centrally manages updates and compliance at scale.
304 questions
{count} votes

1 answer

Sort by: Most helpful
  1. Tech-Hyd-1989 5,796 Reputation points
    2023-04-24T07:10:54.64+00:00

    Hello adr

    Yes, you can use Azure PowerShell to get the update deployment schedules for all the VMs in your Azure environment, regardless of the resource group they are in. Here's an example PowerShell script that you can use:

    1. connect to azure Connect-AzAccount
    2. Get all the VMs in your Azure environment
      $vms = Get-AzVM
    3. Loop through each VM and get the update deployment schedule
      foreach ($vm in $vms) { $schedule = Get-AzAutomationSoftwareUpdateConfiguration -ResourceGroupName $vm.ResourceGroupName -AutomationAccountName "MyAutomationAccount" -Name $vm.Name Write-Host "VM Name: $($vm.Name), Schedule: $($schedule.UpdateConfiguration.ScheduleInfo)" } This script gets all the VMs in your Azure environment using the Get-AzVM cmdlet, and then loops through each VM to get the update deployment schedule using the Get-AzAutomationSoftwareUpdateConfiguration cmdlet. The ResourceGroupName parameter is set to $vm.ResourceGroupName to get the resource group for each VM, and the AutomationAccountName parameter is set to the name of your Automation Account. The Name parameter is set to $vm.Name to get the update deployment schedule for each VM.

    The output of this script will show the name of each VM and its update deployment schedule. You can modify the script to output the results to a file or email the report to yourself regularly.

    Please accept answer and upvote if the above information is helpful for the benefit of the community.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.