0

I need to provide a monthly report to our client listing the updates needed by each Windows server in our environment. Ideally, the report would list the updates for the month and the servers in my environment that need them.

My PowerShell knowledge is limited but I found some scripts (see below) and tweaked them a bit to pull the updates and the targets, but I can't figure out a way to combine this information into one script that shows the specific updates are needed by each server:

$wsus = Get-WsusServer -Name "<server-name>" -PortNumber 8530

$wsus.GetComputerTargets()

$updates = $wsus.GetUpdates() | where {$_.CreationDate -gt (Get-Date).addMonths(-1) }

# Iterate through every update, output some info

$results = ForEach ($update in $updates) {

$update.Title

$update.Description

$update.CreationDate

}

$results | Out-File C:\Temp\results.txt

## Select all WSUS clients export to file

$serverlist = ForEach ($server in $wsus.GetComputerTargets()) {

$server.FullDomainName
$server.OSDescription
}

$serverlist | Out-File C:\Temp\servers.txt

Any suggestions or advice would be greatly appreciated, thank you!

jrd1989
  • 628
  • 10
  • 35

0 Answers0