forked from jrussellfreelance/powershell-scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwsus-critical-report.ps1
More file actions
48 lines (41 loc) · 1.24 KB
/
Copy pathwsus-critical-report.ps1
File metadata and controls
48 lines (41 loc) · 1.24 KB
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
# This script grabs WSUS information and outputs it to a HTML report. Run it from the WSUS server.
# File paths
$reportPath = $PSScriptRoot + "\report.html"
$date = Get-Date
# Get server
$server = Get-WsusServer -Name "localhost" -PortNumber 8530
# Grab critical updates
$critical = Get-WsusUpdate -UpdateServer $server -Status FailedOrNeeded -Classification Critical -Approval Unapproved | Select-Object -Property UpdateId,Approved,ComputersNeedingThisUpdate,ComputersInstalledOrNotApplicable,ComputersWithNoStatus | Sort-Object -Descending -Property ComputersNeedingThisUpdate
$critHtml = $critical | ConvertTo-Html -Fragment -PreContent "<h1>Critical & Needed/Failed & Unapproved Updates - $date</h1>"
# Create HTML file
$head = @"
<title>Critical Updates</title>
<style>
body {
background-color: #FFFFFF;
font-family: sans-serif;
}
h1 {
color: #1E87F0;
}
h2 {
color: #1E87F0;
}
table {
background-color: #1E87F0;
}
td {
background-color: #FFFFFF;
color: #666666;
padding: 3px;
}
th {
background-color: #1E87F0;
color: #FFFFFF;
text-align: left;
padding: 3px;
}
</style>
"@
# Convert everything to HTML and output to file
ConvertTo-Html -Head $head -Body "$critHtml" | Out-File $reportPath