Skip to content

Instantly share code, notes, and snippets.

@tylergohl
Created December 21, 2017 22:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tylergohl/2dd324ed67bf6d963ad6471dbac1aab6 to your computer and use it in GitHub Desktop.
Save tylergohl/2dd324ed67bf6d963ad6471dbac1aab6 to your computer and use it in GitHub Desktop.
# For auditing when updates were installed, useful for SOC 2
$Session = New-Object -ComObject "Microsoft.Update.Session"
$Searcher = $Session.CreateUpdateSearcher()
$historyCount = $Searcher.GetTotalHistoryCount()
$Searcher.QueryHistory(0, $historyCount) | Select-Object Title, Description, Date,
@{name="Operation"; expression={switch($_.operation) {
1 {"Installation"}; 2 {"Uninstallation"}; 3 {"Other"}
}}} | Export-CSV c:\test.csv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment