Need help with powershell script to get the list of systems and when they were last patched

Neelesh Kumar Tiwari 21 Reputation points
2021-05-06T19:23:18.163+00:00

Hello Everyone,

Need help with getting the list of systems and also when they were last patched.

Windows for business Windows Server User experience PowerShell
0 comments No comments
{count} votes

Accepted answer
  1. Andreas Baumgarten 123.4K Reputation points MVP Volunteer Moderator
    2021-05-07T20:45:50.233+00:00

    Hi @Neelesh Kumar Tiwari ,

    could please try this:

    Get-Hotfix|Where-Object {$_.Installedon -gt ((Get-Date).Adddays(-90))}|Select-Object -Property PSComputerName,InstalledOn, HotFixID, InstalledBy|Format-Table  
    

    Based on this website the computer name should be the parameter Source:
    https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.management/get-hotfix?view=powershell-7.1#example-1--get-all-hotfixes-on-the-local-computer

    ----------

    (If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

    Regards
    Andreas Baumgarten


2 additional answers

Sort by: Most helpful
  1. Andreas Baumgarten 123.4K Reputation points MVP Volunteer Moderator
    2021-05-06T20:13:26.607+00:00

    Hi @Neelesh Kumar Tiwari ,

    maybe this is helpful to get started:

    https://p0w3rsh3ll.wordpress.com/2012/10/25/getting-windows-updates-installation-history/

    Otherwise please post your script you got so far.

    ----------

    (If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

    Regards
    Andreas Baumgarten


  2. Neelesh Kumar Tiwari 21 Reputation points
    2021-05-07T20:27:44.933+00:00

    Hello @Anonymous , Thanks I did Get-Hotfix and get the details but my requirement is to get the list of systems when it was last time patched so I tried the below command and getting the output for 90 days but computer name is not coming so any idea how can I fix this.

    Get-Hotfix|Where-Object {$_.Installedon -gt ((Get-Date).Adddays(-90))}|Select-Object -Property Computername, KBArticle,InstalledOn, HotFixID, InstalledBy|Format-Table

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.