Skip to content

Instantly share code, notes, and snippets.

@OSDeploy
Created February 15, 2019 16:02
Show Gist options
  • Save OSDeploy/eb53608b12bffdcb2776d114209cb6dd to your computer and use it in GitHub Desktop.
Save OSDeploy/eb53608b12bffdcb2776d114209cb6dd to your computer and use it in GitHub Desktop.
Generates the Office 2016 XML used in Update-MSOffice2016.ps1 (Requires PoshWsus)
Import-Module -Name PoshWsus -Force
Connect-PSWSUSServer -WSUSserver 'wsus2019' -Port 8530
$Categories = Get-PSWSUSCategory | Where-Object {$_.Title -match 'Office 2016'}
$Office2016 = Get-PSWSUSUpdate -Category $Categories | Select-Object -Property *
$Office2016 = $Office2016 | Where-Object {$_.IsSuperseded -eq $false}
$Office2016 = $Office2016 | Where-Object {$_.IsLatestRevision -eq $true}
$Office2016 = $Office2016 | Where-Object {$_.Title -notlike "*farm-deployment*"}
$Office2016 | Export-Clixml -Path "C:\Users\Administrator\Desktop\Office\RawOffice2016.xml"
$UpdateProperties = @()
$AllUpdates = @()
foreach ($Update in $Office2016) {
$UpdateFile = Get-PSWSUSUpdateFile -UpdateName $($Update.Title) | Select-Object -Property *
$UpdateProperties = [PSCustomObject]@{
'Category' = $Update.ProductTitles;
'KBNumber' = $UpdateFile.KnowledgeBaseArticles;
'Title' = $UpdateFile.Title;
'KBUrl' = $Update.AdditionalInformationUrls;
'Severity' = $Update.UpdateClassificationTitle;
'DateCreated' = $Update.CreationDate;
'DateLastModified' = $UpdateFile.Modified;
'FileName' = $UpdateFile.Name;
'OriginUri' = $UpdateFile.OriginUri
}
$AllUpdates += $UpdateProperties
}
$AllUpdates
$AllUpdates | Export-Clixml -Path "C:\Users\Administrator\Desktop\Office\Office2016.xml"
$AllUpdates | ConvertTo-Json | Out-File "C:\Users\Administrator\Desktop\Office\Office2016.json"
$AllUpdates | Out-GridView
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment