WSUS Reporting

This topic contains 1 reply, has 2 voices, and was last updated by  Don Jones 2 weeks, 2 days ago.

  • Author
    Posts
  • #76228

    TobiasHan88
    Participant

    Hello,

    i want to get Reports from WSUS by Powershell.

    I want to get following Information:
    Update #1 | Count Installation | CreationDate | Cricitcal or high
    Update #2 | Count Installation | CreationDate | Cricitcal or high
    Update #3 | Count Installation | CreationDate | Cricitcal or high
    etc.

    But only for these updates, which are not complete.
    And, when possible for a specific period ( 3 month)

    I have following script:

    $wsusserver = "wsus"
    [void][reflection.assembly]::LoadWithPartialName("Microsoft.UpdateServices.Administration")
    $wsus = [Microsoft.UpdateServices.Administration.AdminProxy]::getUpdateServer($wsusserver,$False)
    $wsus.GetUpdates() | ? {$_.CreationDate -gt (Get-Date).addMonths(-3)} | Select Title, UpdateClassificationTitle, CreationDate, ArrivalDate | export-csv "G:\Sonstiges\WSUS Reporting\test.csv" -Delimiter ";"

    This script is giving me the Updates of the last 3 months wird CreationDate and export them to a .csv.

    But i don't get the other parameter in the script.

    Had anyone an idea?

    Thank you

    Best regards
    TobiasHan

  • #76256

    Don Jones
    Keymaster

    Your Where-Object command is only filtering for 3 months back; you would need to add an additional condition if you only wanted incomplete updates.

    You might look at https://msdn.microsoft.com/en-us/library/ms747095(v=vs.85).aspx Instead of the GetUpdates() with no arguments. It's a more granular way of querying updates and will probably run faster.

    I'm having some trouble with the docs, but it looks like an Update object should have an UpdateState property, which you could filter on?

    ... -and $_.UpdateState -eq XXX ...

    You just need to figure out if that's the actual property name and what the valid values are.

You must be logged in to reply to this topic.