forked from proxb/PoshWSUS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathStop-PSWSUSDownload.ps1
40 lines (36 loc) · 982 Bytes
/
Stop-PSWSUSDownload.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
function Stop-PSWSUSDownload {
<#
.SYNOPSIS
Cancels all current WSUS downloads.
.DESCRIPTION
Cancels all current WSUS downloads.
.NOTES
Name: Stop-PSWSUSDownload
Author: Boe Prox
DateCreated: 24SEPT2010
.LINK
https://learn-powershell.net
.EXAMPLE
Stop-PSWSUSDownload
Description
-----------
This command will stop all updates being downloaded to the WSUS server.
#>
[cmdletbinding()]
Param()
Begin
{
if(-not $wsus)
{
Write-Warning "Use Connect-PSWSUSServer to establish connection with your Windows Update Server"
Break
}
}
Process {
#Cancel all downloads running on WSUS
If ($pscmdlet.ShouldProcess($($wsus.name))) {
$wsus.CancelAllDownloads()
"Downloads have been cancelled on {0}." -f $wsus.name
}
}
}