Thursday, 7 June 2012

PowerShell - Enable \ Disable Automatic Updates

Hi All,

As this is my first ever blog post so I thought I would try something short and simple. Today I got asked how can the automatic updates agent be disabled as a scripted action with PowerShell. After a bit of research I found that it can easily be controlled through a native COM object. I have not included any script in this post, I just wanted to show how easy it is to do from the command line. These commands could easily dropped into a .ps1 along with any other required smarts.

PowerShell Commands Used:

Record the WUAU settings into an object
PS C:\> $AUSettigns = (New-Object -com "Microsoft.Update.AutoUpdate").Settings
View the object properties
PS C:\> $AUSettigns
Change the property value
PS C:\> $AUSettigns.NotificationLevel = 4
Commit the changes back to the system.
PS C:\> $AUSettigns.Save

Disabling Automatic Updates

 Enabling Automatic Updates:




  1. When I issue the last PS command to commit the changes, I get void Save () and changes are not saved. I am running PS in Administrator mode.

    1. You have to add () at the end.