Skip to content

Commit fe18b3d

Browse files
pandrewMischa Taylor
pandrew
authored and
Mischa Taylor
committed
Add script to disable automatic Windows updates
1 parent 6461f27 commit fe18b3d

File tree

3 files changed

+35
-0
lines changed

3 files changed

+35
-0
lines changed

AUTHORS

+1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@
44
Julian C. Dunn <[email protected]>
55
Ken Sykora <[email protected]>
66
Mischa Taylor <[email protected]>
7+
Paul Andrew Liljenberg <[email protected]>
78
Ross Smith II <[email protected]>
89
Stefan Scherer <[email protected]>

floppy/disablewinupdate.ps1

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<#
2+
.SYNOPSIS
3+
Disables automatic windows updates
4+
.DESCRIPTION
5+
Disables checking for and applying Windows Updates (does not prevent updates from being applied manually or being pushed down)
6+
Run on the machine that updates need disabling on.
7+
.PARAMETER <paramName>
8+
None
9+
.EXAMPLE
10+
./Disable-WindowsUpdates.ps1
11+
#>
12+
$RunningAsAdmin = ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")
13+
if ($RunningAsAdmin)
14+
{
15+
16+
$Updates = (New-Object -ComObject "Microsoft.Update.AutoUpdate").Settings
17+
18+
if ($Updates.ReadOnly -eq $True) { Write-Error "Cannot update Windows Update settings due to GPO restrictions." }
19+
20+
else {
21+
$Updates.NotificationLevel = 1 #Disabled
22+
$Updates.Save()
23+
$Updates.Refresh()
24+
Write-Output "Automatic Windows Updates disabled."
25+
}
26+
}
27+
28+
else
29+
{ Write-Warning "Must be executed in Administrator level shell."
30+
Write-Warning "Script Cancelled!" }

floppy/rundisablewinupdate.cmd

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
@ECHO OFF
2+
SET ThisScriptsDirectory=%~dp0
3+
SET PowerShellScriptPath=%ThisScriptsDirectory%disablewinupdate.ps1
4+
PowerShell -NoProfile -ExecutionPolicy Bypass -Command "& '%PowerShellScriptPath%'";

0 commit comments

Comments
 (0)