winlin
Goto Top

WSUS API um Updatestatus zu prüfen

Hallo Leute

ich habe einen WSUS Server der meine Clients in einem "nicht"-AD Umfeld bedient. Aktuell überwache ich den Status der Windows Updates (welche Clients sind up.-to.date und bei welchen fehlen wichtige Updates etc.) über WinRM.

Ich möchte aber gerne WinRM durch RestAPI ablösen. Ziel ist es das ich über eine RestAPI Schnittstelle bestimmte WSUS Befehle absetze um die o.g. Infos zu bekommen. Müsste doch machbar sein? Wie installiere/konfiguriere ich WSUS API?

Content-Key: 362050

Url: https://administrator.de/contentid/362050

Printed on: April 25, 2024 at 22:04 o'clock

Member: wisebeer
wisebeer Jan 23, 2018 at 07:34:00 (UTC)
Goto Top
Hallo Winlin,

Ich hab mir mal was in Powershell gebastelt, damit ich die Abfragen weiterverarbeiten kann und bestimmte Tasks laufen lassen kann, vielleicht kannst du was damit anfangen.

LG Martin

$Computername = 'WSUS NAME'  
$UseSSL = $False
$Port = 8530

[void][reflection.assembly]::LoadWithPartialName("Microsoft.UpdateServices.Administration")  
$WSUS = [Microsoft.UpdateServices.Administration.AdminProxy]::GetUpdateServer($Computername,$UseSSL,$Port)


$WOL_WSUS_Gruppe = $WSUS.GetComputerTargetGroups() | ? {$_.Name -eq "NAME DER GRUPPE IM WSUS"}  
$Computerscope = New-Object Microsoft.UpdateServices.Administration.ComputerTargetScope  ;
[void]$ComputerScope.ComputerTargetGroups.Add($WOL_WSUS_Gruppe)
$Updatescope = New-Object Microsoft.UpdateServices.Administration.UpdateScope ;
$WSUS.GetSummariesPerComputerTarget($Updatescope,$ComputerScope) | Select-Object @{L='NetBios';E={($wsus.GetComputerTarget([guid]$_.ComputerTargetId)).FullDomainName}}, InstalledCount, DownloadedCount, FailedCount, UnKnownCount, NotInstalledCount, @{L= "InstalledOrNotApplicablePercentage";E={(($_.NotApplicableCount + $_.InstalledCount) / ($_.NotApplicableCount + $_.InstalledCount + $_.NotInstalledCount + $_.FailedCount + $_.UnknownCount))*100}} | Export-Csv -Path \\XY.csv  -NoTypeInformation -Append -Encoding UTF8  

Um abzufragen, welche Clients nicht zu 100% gepatcht sind, kann man folgendes machen:

$WSUS.GetSummariesPerComputerTarget($Updatescope,$ComputerScope) | Select-Object @{L='NetBios';E={($wsus.GetComputerTarget([guid]$_.ComputerTargetId)).FullDomainName}}, InstalledCount, DownloadedCount, FailedCount, UnknownCount, NotInstalledCount, InstalledPendingRebootCount, @{L= "InstalledOrNotApplicablePercentage";E={(($_.NotApplicableCount + $_.InstalledCount) / ($_.NotApplicableCount + $_.InstalledCount + $_.NotInstalledCount + $_.FailedCount + $_.UnknownCount + $_.InstalledPendingRebootCount))*100}} | Export-Csv -Path "\\..." -NoTypeInformation -Append -Encoding UTF8  
Member: sabines
sabines Jan 23, 2018 at 12:33:18 (UTC)
Goto Top
Moin,

wieso nutzt du nicht das "Reporting" unter dem WSUS?
Oder verstehe ich Deine Frage nicht richtig?

Gruss
Member: winlin
winlin Jan 30, 2018 at 08:36:15 (UTC)
Goto Top
Interessantface-smile

Wie kann ich dein Beispiel nutzen? Sorry für die dumme Frage, aber bin eher ein Linuxerface-smile
Member: sabines
sabines Jan 31, 2018 at 10:26:01 (UTC)
Goto Top
Moin,

ruf die WSUS Verwaltungskonsole auf und gehe dort in den Reiter/Bereich Computer, hier findest Du alle wesentlichen Informationen.
Vielleicht liest Du Dich ein bißchen in WSUS ein.

https://wsus.de/de/

Gruss