none
Querying last WSUS synchronization time

    Pregunta

  • Hi all,

    I have searched for the way to query the last WSUS synchronization time, but found only how to clear the syncronization history.

    What would be the best way to query this time? It's all the same to use SQL, Powershell... I only need to get this synchronization time to generate an event if WSUS have not synchronized in the last x hours or days. I would get this time ang generate an alarm in Nagios, for example.

    Thanks very much in advance.

    miércoles, 18 de abril de 2018 13:22

Todas las respuestas

  • I think I got it:

    [void][reflection.assembly]::LoadWithPartialName("Microsoft.UpdateServices.Administration")
    $wsus = [Microsoft.UpdateServices.Administration.AdminProxy]::getUpdateServer($servername,$False)
    $sub = $wsus.GetSubscription()
    $sub.GetLastSynchronizationInfo()
    
    Id              : .....
    StartTime       : 18/04/2018 11:26:27
    EndTime         : 18/04/2018 11:26:38
    StartedManually : True
    Result          : Succeeded
    Error           : NotApplicable
    ErrorText       :
    UpdateErrors    : {}

    Then I can explore for result status and start and end times.

    miércoles, 18 de abril de 2018 14:10