Closed q-lng closed 4 months ago
Could you provide a script with all computers status ? And we could filter in Perl ?
Well the output of GetSummariesPerComputerTarget
looks like this :
UnknownCount : 231
NotApplicableCount : 3114
NotInstalledCount : 4
DownloadedCount : 0
InstalledCount : 145
InstalledPendingRebootCount : 0
FailedCount : 6
IsSummedAcrossAllUpdates : True
UpdateId : 00000000-0000-0000-0000-000000000000
ComputerTargetGroupId : 00000000-0000-0000-0000-000000000000
ComputerTargetId : a837c398-6809-46bc-8563-583566cf7d91
LastUpdated : 25/10/2022 05:04:03
There is only the ComputerID, so i guess it is still needed to convert the Hostname to the ComputerID.
Using a plugin variable like --wsus-server
is not possible ?
Yes we can. But i prefer to get everythin if we can.
When the filtering with Perl is made ? Because it might be possible to filter the output with something like this :
$wsusStatus | Where ComputerTargetId -like $computerID
But we still need to convert the Hostname to the computerID, maybe at the beginning of the script?
Could you do something like that:
$computerTargetScope.NameIncludes = "*"
An empty value do not filter computers by name so it takes all computers. But names aren't displayed in output : (output is very long here so there is only few results here)
I will be nice if we could have the computerName
PS C:\Windows\system32> $computerID = $wsusObject.GetComputerTargetByName("VIREXTRANET01P.sdlnet.fr")
PS C:\Windows\system32> $computerID
UpdateServer : Microsoft.UpdateServices.Internal.BaseApi.UpdateServer
Id : 56db6148-65be-4294-8ad4-a0db86f66fe6
FullDomainName : virextranet01p.sdlnet.fr
IPAddress : X.X.X.X
Make : VMware, Inc.
Model : VMware7,1
BiosInfo : Microsoft.UpdateServices.Administration.BiosInfo
OSInfo : Microsoft.UpdateServices.Administration.OSInfo
OSArchitecture : AMD64
ClientVersion : 7.9.9600.19915
OSFamily : Windows
OSDescription : Windows Server 2012 R2
ComputerRole : Server
LastSyncTime : 25/10/2022 06:24:34
LastSyncResult : Succeeded
LastReportedStatusTime : 25/10/2022 06:32:45
LastReportedInventoryTime : 01/01/0001 00:00:00
RequestedTargetGroupName : Servers
RequestedTargetGroupNames : {Servers}
ComputerTargetGroupIds : {bc2a801b-4bad-4bc9-abc5-3ea59164d102, a0a08746-4dbe-4a37-9adf-9e7652c0b421}
ParentServerId : 00000000-0000-0000-0000-000000000000
SyncsFromDownstreamServer : False
PS C:\Windows\system32> $wsusStatus | Where ComputerTargetId -like $computerID.Id
UnknownCount : 0
NotApplicableCount : 3375
NotInstalledCount : 0
DownloadedCount : 0
InstalledCount : 112
InstalledPendingRebootCount : 13
FailedCount : 0
IsSummedAcrossAllUpdates : True
UpdateId : 00000000-0000-0000-0000-000000000000
ComputerTargetGroupId : 00000000-0000-0000-0000-000000000000
ComputerTargetId : 56db6148-65be-4294-8ad4-a0db86f66fe6
LastUpdated : 25/10/2022 06:32:45
This works but i feel like going back and forth to look for the ID inside WSUS is a lot more than just "hardcoding" the hostname and add it in the ComputerScope. I don't even know if it will work for the Perl filtering :/
Do you have a method to get all computerId and computerName associated ?
$computerTargetScope = New-object Microsoft.UpdateServices.Administration.ComputerTargetScope
$computerTargetScope.IncludeDownstreamComputerTargets = $true
#Basically an empty ComputerScope that includes downstream servers, so it matches every computers in WSUS
$wsusObject.GetComputerTargets($computerTargetScope)
That method output every computer inside WSUS Servers with FQDN IDs.
I forgot to add this, but you need to use FQDN with this, which need others tricks if hosts on Centreon don't have their full FQDN as Hostname or IP.
What do you mean by the FQDN IDs ? It's not the computerName ?
FQDN and IDs, sorry.
But long story short, when displayed with GetComputerTargets
, Computers' names is their FQDN (server01.domain.com), but using GetSummariesPerComputerTarget
, you add Computers in a ComputerScope and you just need the Hostname (server01).
Windows things i guess...
Hello :)
This enhancement request seems particularly old so let me close it. If the enhancement request is still current, please address it here to be take into account and vote on (you can link this github issue in your idea proposition). Thank you for your understanding.
Hello : Here again to ask for some improvements for WSUS plugin :)
After our last exchanges, I have been asked by my team to have something to monitor each Windows Server updates status.
I think it is nice to monitor that from WSUS as you can clearly see updates status for each server.
Basically the PS Script down here is working and follow other scripts' layout :
Of course the
$computerName
variable should be the$HOSTNAME$
or$HOSTIPADDRESS$
. Also, i added the "LastUpdated" field to the item array, i think it can be a good warning / critical threshold.Do you think this new mode could be added to the plugin ?
Regards !