Friday, October 24, 2014

Get Installed Patches – Automatic Services on remote servers

Get Installed Patches and All Services which are set Automatic on remote servers

If you ever want to know what patches have been installed on remote clients/servers you would require the below powershell script.

Local Commands:

Get-WmiObject Win32_QuickFixEngineering| Where-Object {$_.installedon -match "MM/DD/YYYY"} | Select-object CSName,Description,HotFixID,InstalledOn,InstalledBy,Caption | Export-Csv -Path Report.csv -NoTypeInformation


Remote Commands:

FullList:-
Get-WmiObject Win32_QuickFixEngineering -Computer (Get-Content –path Servers.txt)|Select-object CSName,Description,HotFixID,InstalledOn,InstalledBy,Caption | Export-Csv -Path C:\Report.csv –NoTypeInformation
InstalledOn Date Report:-
Get-WmiObject Win32_QuickFixEngineering -Computer (Get-Content –path C:\Servers.txt) | Where-Object {$_.installedon -match "MM/DD/YYYY"} | Select-object CSName,Description,HotFixID,InstalledOn,InstalledBy,Caption | Export-Csv -Path Report.csv -NoTypeInformation

GreaterThan-Date Report:-
Get-WmiObject Win32_QuickFixEngineering -Computer (Get-Content –path C:\ Servers.txt) | Where-Object {$_.installedon -GT "MM/DD/YYYY"} | Select-object CSName,Description,HotFixID,InstalledOn,InstalledBy,Caption | Export-Csv -Path Report.csv -NoTypeInformation

GT Sort by Date:
Get-WmiObject Win32_QuickFixEngineering -Computer (Get-Content –path C: \Servers.txt) | Where-Object {$_.installedon -GT "MM/DD/YYYY"} | Select-object CSName,Description,HotFixID,InstalledOn,InstalledBy,Caption | Sort-Object InstalledOn -Descending | Export-Csv -Path c:\Report.csv -NoTypeInformation

Check the Windows services are in “Running” states which are set to “Auto”.

Get-WmiObject Win32_Service -ComputerName (Get-content " Servers.txt") |where {($_.startmode -like "*auto*") -and ($_.state -notlike "*running*")}| select SystemName,DisplayName,Name,StartMode,State| Export-csv –path “C:\ Services_Report.csv” –NoTypeInformation