-
Notifications
You must be signed in to change notification settings - Fork 2
/
Stop-GCWindowsUpdate.ps1
40 lines (31 loc) · 1.19 KB
/
Stop-GCWindowsUpdate.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<#
.SYNOPSIS
Completes the Windows Update initiated by Start-GCWindowsUpdate.
.DESCRIPTION
Due to the latest versions of Microsoft Windows being rather forward about applying
updates and rebooting machines, this function allows you to install the updates on your own schedule.
Stop-GCWindowsUpdate performs the following tasks:
- Stops the Windows Update service
- Sets the Windows Update service, named wuauserv, to a StartType of Disabled
WARNING: Running this function will prevent your computer from receiving Windows Updates
until you either enable the Windows Update service or run the Start-GCWindowsUpdate function.
.EXAMPLE
The following example installs all required updates on the local machine:
> Stop-GCWindowsUpdate
#>
function Stop-GCWindowsUpdate {
[CmdletBinding()]
[Alias()]
[OutputType([String])]
Param()
"Stop-GCWindowsUpdate initiated"
Import-Module -Name GCTest
if (Test-GCAdminShell -ShowError) {
"Stopping the Windows Update service"
$wu = Get-Service -Name wuauserv
Stop-Service -InputObject $wu
"Disabling the Windows Update service"
Set-Service -InputObject $wu -StartupType Disabled
}
"Stop-GCWindowsUpdate completed"
}