# Quickly allow filtering of the available updates by using the Out-GridView cmdlet Import-Csv -Path 'C:\computers.txt' | Get-WindowsUpdate | Out-GridView # Export the Results of Windows Update to a CSV File Import-Csv -Path 'C:\computers.txt' | Get-WindowsUpdate | Export-CSV -Path '.\WindowsUpdate.csv' -NoTypeInformation -Force Import-Csv -Path '.\WindowsUpdate.csv' Function Out-WindowsUpdateReport { <# .SYNOPSIS This function will output all piped in updates, remote or local, to an HTML page saved on disk. .DESCRIPTION Output the results of gathering Windows Updates to an HTML file on disk. .EXAMPLE PS> Get-WindowsUpdate | Out-WindowsUpdateReport .PARAMETER FilePath Location to output the report. .PARAMETER UpdateResult Updates to export. #> [OutputType('void')] [CmdletBinding()] Param( [Parameter()] [ValidateNotNullOrEmpty()] [String]$FilePath = '.\WindowsUpdates.html', [Parameter(Mandatory, ValueFromPipeline)] [ValidateNotNullOrEmpty()] [PSCustomObject]$UpdateResult ) begin { $ErrorActionPreference = 'Stop' $header = @" "@ $body = "" $footer = @"
Computer KB ID IsDownloaded IsInstalled RebootRequired
"@ } Process { If ($UpdateResult.IsInstalled) { $class = 'installed' } Else { $class = 'notinstalled' } $body += "`t`t`t$($UpdateResult.ComputerName)$($UpdateResult.'KB ID')$($UpdateResult.IsDownloaded)$($UpdateResult.IsInstalled)$($UpdateResult.RebootRequired)`r`n" } End { $html = $header + $body + $footer $html | Out-File -FilePath $FilePath -Force } } # Save the Results as an HTML Page Get-WindowsUpdate | Out-WindowsUpdateReport ## Check the results of the report Invoke-Item '.\WindowsUpdates.html' # Save the Results as an HTML Page from a list of computers Import-Csv -Path 'C:\computers.txt' | Get-WindowsUpdate | Out-WindowsUpdateReport ## Check the results of the report Invoke-Item '.\WindowsUpdates.html'