Is it possible to remove/uninstall update centrally from Azure Update Manager ?

Vedran Banjeglav 41 Reputation points
2025-03-03T10:24:33.0433333+00:00

Is it possible to remove/uninstall update centrally from Azure Update Manager if it's already installed on VM ? I know for exclusions, but e.g. we install update and it's causing troubles, is it possible to remove it not by connecting to a VM itself and then manually unistall it?

Thank you,

Regards.

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

1 answer

Sort by: Most helpful
  1. Ashok Gandhi Kotnana 4,310 Reputation points Microsoft External Staff
    2025-03-03T15:32:00.8966667+00:00

    Hi @Vedran Banjeglav ,

    This script uninstalls a specific Windows update (KB4589208) from a list of virtual machines (VMs) .It iterates through each VM, retrieves its resource group and name, and uses the Invoke-AzVMRunCommand to run a PowerShell command to uninstall the update. If the command fails, it catches and logs the error.

    $vms= @( "vm1", "vm02")
     $KB= "4589208"
     foreach ($vm in $vms) {
     $Temp= get-azvm|?{$_.Name -eq $vm}
     $resourceGroupName = $Temp.ResourceGroupName
     $vmName = $Temp.Name
     Write-Output "Uninstalling update on VM: $vmName in Resource Group: $resourceGroupName"
     try {
     Invoke-AzVMRunCommand -ResourceGroupName $resourceGroupName -VMName $vmName -CommandId 'RunPowerShellScript' -ScriptString "wusa /uninstall /kb:$KB /quiet /norestart"
     Write-Output "Update uninstall command sent to VM: $vmName"
     } catch {
     Write-Output "Failed to send command to VM: $vmName. Error: $_"
     }
    }
    

    Let me know if you need further clarification or assistance!

    Feel free to reach out if you have any further questions or need additional information—I’m happy to assist!

    Please provide your valuable comments User's image

    Please do not forget to "Accept the answer” and “upvote it” wherever the information provided helps you, this can be beneficial to other community members.it would be greatly appreciated and helpful to others.

    1 person found this answer helpful.

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.