WHMCS-bridge

How to Get the Windows Patch Report in Excel though Power Shell Script Print

  • 0

$Session = New-Object -ComObject “Microsoft.Update.Session”

$Searcher = $Session.CreateUpdateSearcher()

$historyCount = $Searcher.GetTotalHistoryCount()

$Searcher.QueryHistory(0, $historyCount) | Select-Object Date,

@{name=”Operation”; expression={switch($_.operation){

1 {“Installation”}; 2 {“Uninstallation”}; 3 {“Other”}}}},

@{name=”Status”; expression={switch($_.resultcode){

1 {“In Progress”}; 2 {“Succeeded”}; 3 {“Succeeded With Errors”};

4 {“Failed”}; 5 {“Aborted”}

}}}, Title | Export-Csv -NoType “$Env:userprofile\Desktop\WindowsUpdates.csv”


Was this answer helpful?

« Back

WordPress and WHMCS integration by i-Plugins