Mit diesem PowerShell-Skript werden die neuen Produkte und Klassifizierungen der letzten X Tage (in diesem Beispiel: 14 Tage) ansgegeben.
Die Parameter (WSUS-Servername, Port, SSL) müssen ggf. anpasst werden.
Hier das Skript:
# Variables - set these to fit your needs
###############################################################################
# The server name of your WSUS server
$serverName = 'localhost'
# use SSL connection?
$useSecureConnection = $False
# the port number of your WSUS IIS website
$portNumber = 80
# scan for new categories in the last ... days
$categoryAge = 14
# Script - don't change anything below this line!
###############################################################################
# load WSUS framework
[void][reflection.assembly]::LoadWithPartialName("Microsoft.UpdateServices.Administration")
# connect to specified WSUS server
$wsus = [Microsoft.UpdateServices.Administration.AdminProxy]::getUpdateServer($serverName, $useSecureConnection, $portNumber)
[System.DateTime] $fromDate = [System.DateTime]::Now
[System.DateTime] $toDate = [System.DateTime]::Now
$fromDate = $fromDate.AddDays(-$categoryAge)
[Microsoft.UpdateServices.Administration.UpdateCategoryCollection] $coll = $wsus.GetUpdateCategories($fromDate, $toDate)
foreach ($category in $coll) {
if ($category.Type -eq [Microsoft.UpdateServices.Administration.UpdateCategoryType]::Company) {
$catTitle = $category.Title
$catDate = $category.ArrivalDate
"New company: $catTitle - added $catDate"
}
if ($category.Type -eq [Microsoft.UpdateServices.Administration.UpdateCategoryType]::ProductFamily) {
$catTitle = $category.Title
$catDate = $category.ArrivalDate
$catParent = $category.GetParentUpdateCategory()
$catParentTitle = $catParent.Title
"New family: $catParentTitle \ $catTitle - added $catDate"
}
if ($category.Type -eq [Microsoft.UpdateServices.Administration.UpdateCategoryType]::Product) {
$catTitle = $category.Title
$catDate = $category.ArrivalDate
$catParent = $category.GetParentUpdateCategory()
$catParentTitle = $catParent.Title
$catGrandParent = $catParent.GetParentUpdateCategory()
$catGrandParentTitle = $catGrandParent.Title
"New category: $catGrandParentTitle \ $catParentTitle \ $catTitle - added $catDate"
}
}
So sieht die Ausgabe aus:
New category: Microsoft \ Expression \ Expression Web 4 - added 03/22/2011 20:24:27 New category: Microsoft \ Microsoft Application Virtualization \ Microsoft Application Virtualization 4.6 - added 03/22/2011 20:24:27 New category: Microsoft \ Windows Embedded \ Windows Embedded Developer Update - added 03/24/2011 20:24:26 New family: Microsoft \ Windows Embedded - added 03/24/2011 20:24:24