Skip to content

Commit

Permalink
Added wsus report script and created staging-scripts folder
Browse files Browse the repository at this point in the history
  • Loading branch information
Jesse Russell committed Nov 19, 2018
1 parent 709b2b3 commit 2be7d4b
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 21 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
debug.log
debug.log
.vs
staging-scripts
20 changes: 0 additions & 20 deletions join-server-to-domain.ps1

This file was deleted.

48 changes: 48 additions & 0 deletions wsus-critical-report.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,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

0 comments on commit 2be7d4b

Please sign in to comment.