forked from proxb/PoshWSUS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGet-PSWSUSUpdateCategory.ps1
61 lines (52 loc) · 1.51 KB
/
Get-PSWSUSUpdateCategory.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
function Get-PSWSUSUpdateCategory {
<#
.SYNOPSIS
Retrieves the list of Update categories available from WSUS.
.DESCRIPTION
Retrieves the list of Update categories available from WSUS.
.PARAMETER Id
Find update category by guid
.PARAMETER Title
Find update category by Title. Use of wildcards not allowed.
.NOTES
Name: Get-PSWSUSUpdateCategory
Author: Boe Prox
DateCreated: 24SEPT2010
.LINK
https://learn-powershell.net
.EXAMPLE
Get-PSWSUSUpdateCategory
Description
-----------
This command will list all of the categories for updates in WSUS.
#>
[cmdletbinding()]
Param (
[Parameter(
Position = 0,
ValueFromPipeline = $True)]
[string]$Id,
[Parameter(
Position = 1,
ValueFromPipeline = $True)]
[string]$Title
)
Begin {
if(-not $wsus)
{
Write-Warning "Use Connect-PSWSUSServer to establish connection with your Windows Update Server"
Break
}
}
Process {
If ($PSBoundParameters['Id']) {
$Wsus.GetUpdateCategory($Id)
} ElseIf ($PSBoundParameters['Title']) {
$wsus.GetUpdateCategories() | Where {
$_.Title -eq $Title
}
} Else {
$wsus.GetUpdateCategories()
}
}
}