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-ID: 362050

Url: https://administrator.de/forum/wsus-api-um-updatestatus-zu-pruefen-362050.html

Ausgedruckt am: 07.04.2025 um 08:04 Uhr

wisebeer
wisebeer 23.01.2018 um 08:34:00 Uhr
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

1
2
3
4
5
6
7
8
9
10
11
12
13
$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:

1
$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  
sabines
sabines 23.01.2018 um 13:33:18 Uhr
Goto Top
Moin,

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

Gruss
winlin
winlin 30.01.2018 um 09:36:15 Uhr
Goto Top
Interessantface-smile

Wie kann ich dein Beispiel nutzen? Sorry für die dumme Frage, aber bin eher ein Linuxerface-smile
sabines
sabines 31.01.2018 um 11:26:01 Uhr
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