Skip to content

Instantly share code, notes, and snippets.

@Stephanevg
Last active January 28, 2021 11:16
Show Gist options
  • Save Stephanevg/dc2d5838dd8b92a76aec54fb047ffd3c to your computer and use it in GitHub Desktop.
Save Stephanevg/dc2d5838dd8b92a76aec54fb047ffd3c to your computer and use it in GitHub Desktop.
Function to get servicing stack information from WSUS server
Function Get-ServicingStackInfos {
Param(
)
$Hash = @{}
$Updates = Get-WsusUpdate
Foreach($Update in $Updates){
#2021-01 Servicing Stack Update für Windows Server 2019 für x64-basierte Systeme (KB4598480)
If($update.update.title -like '*servicing*' ){
If($update.Update.title -match "(?'Date'\d{4}-\d{2})(?'Title'.*)\((?'KbNumber'KB\d{7})\)$"){
$Hash.ReleaseDate = $Matches.Date
$Hash.Title = $Matches.Title
$Hash.KBNumber = $Matches.KbNumber
$Hash.Products = $Update.Products
}
}
}
New-Object psobject -Property $Hash
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment