I'm looking for help scripting with PowerShell, Windows Server 2008 R2 so Windows Updates is set to "Never check for updates." I found some near answers but I still can't do what I want. Currently, I have to set it by clicking Windows Update > Change Settings > Never Check for Updates. Thanks in advance.
Open Start. Search for PowerShell, right-click the top result, and select the Run as administrator option. Type the following command to disable a service and press Enter: Set-Service -Name "SERVICE-NAME" -Status stopped -StartupType disabled In the command, update "SERVICE-NAME" for the name of the service.
Disabling the Windows Update service Then, type “services” in the Windows 10 search box and click View Local Services. Scroll down to Windows Update and double-click the service. Set the startup type to Disabled. If the service is already running, click Stop.
You can use a COM object for that :
$WUSettings = (New-Object -com "Microsoft.Update.AutoUpdate").Settings
$WUSettings
NotificationLevel : 2
ReadOnly : True
Required : False
ScheduledInstallationDay : 0
ScheduledInstallationTime : 3
IncludeRecommendedUpdates : True
NonAdministratorsElevated : True
FeaturedUpdatesEnabled : True
With :
NotificationLevel :
0 = Not configured;
1 = Disabled;
2 = Notify before download;
3 = Notify before installation;
4 = Scheduled installation;
You can test :
$WUSettings = (New-Object -com "Microsoft.Update.AutoUpdate").Settings
$WUSettings.NotificationLevel=1
$WUSettings.save()
(Edited)
You must use a PowerShell session run as administrator in an elevated mode.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With