Export to CSV

I have a working script. Need help exporting the data.

I know I need to use Export-Csv c:\scripts\test.txt. But having hard time understanding where to insert it?

$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"}
}}}

Another question this only show Microsoft updates "Microsoft.Update.Session"

How can I find out about other comobjects to get other updates? Adobe?

Thanks for the help.

September 9th, 2015 2:24pm

$Session = New-Object -ComObject "Microsoft.Update.Session"
$Searcher = $Session.CreateUpdateSearcher()
$historyCount = $Searcher.GetTotalHistoryCount()
$results = $Searcher.QueryHistory(0, $historyCount) | Select-Object Title, Description, Date,
    @{name="Operation"; expression={switch($_.operation){
        1 {"Installation"}; 2 {"Uninstallation"}; 3 {"Other"}
}}}
$results | Out-File C:\Temp\updates.txt -Append

Add $results and the last line.

or  last line as $results | Export-Csv C:\Temp\updates.csv -NoTypeInformation

Free Windows Admin Tool Kit Click here and download it now
September 9th, 2015 2:39pm

Thank you. DO you know why am I missing a lot of HotFixes with this list? Is there a way to get a complete list?
September 9th, 2015 3:12pm

Thank you. DO you know why am I missing a lot of HotFixes with this list? Is there a way to get a complete list?

Like what?

I generally just use Get-HotFix instead of using the COM o

Free Windows Admin Tool Kit Click here and download it now
September 9th, 2015 3:15pm

Get-HotFix will not list office, lync, .NET and others, I think its just for OS.
September 9th, 2015 3:30pm

Windows update will not list Office 365 updates either.

Free Windows Admin Tool Kit Click here and download it now
September 9th, 2015 3:41pm

Is there a way to get compete list?
September 9th, 2015 4:17pm

You can only get the patch level for office 365 products.  Interim security patches, when needed, are distributed as hotfixes and Get-HotFix gets them.

Post in O365 forums for more info on reading patch levels for Office.

Free Windows Admin Tool Kit Click here and download it now
September 9th, 2015 4:53pm

Here is the update list for Office 2013 (online O365): https://support.microsoft.com/en-us/gp/office-2013-365-update

Every patch is cumulative.

September 9th, 2015 4:59pm

$Session = New-Object -ComObject "Microsoft.Update.Session"
$Searcher = $Session.CreateUpdateSearcher()
$historyCount = $Searcher.GetTotalHistoryCount()
$results = $Searcher.QueryHistory(0, $historyCount) | Select-Object Title, Description, Date,
    @{name="Operation"; expression={switch($_.operation){
        1 {"Installation"}; 2 {"Uninstallation"}; 3 {"Other"}
}}}
$results | Out-File C:\Temp\updates.txt -Append

Add $results and the last line.

or  last line as $results | Export-Csv C:\Temp\updates.csv -NoTypeInformation

Free Windows Admin Tool Kit Click here and download it now
September 9th, 2015 6:38pm

Thanks you for the help. That is not what I am looking for. I need a scripted way to export all installed patches on the client. The script above gives me most of them, but not all. I am missing some lync, some office 2013.

Don't really understand why I am just missing some.

Thanks.

September 10th, 2015 8:59am

Thanks you for the help. That is not what I am looking for. I need a scripted way to export all installed patches on the client. The script above gives me most of them, but not all. I am missing some lync, some office 2013.

Don't really understand why I am just missing some.

Thanks.

Everything that is a patch is  available from both Get-Hotfix and WU.  There is no other method or any other patches.

If you don't believe this then post in Office forum or other software forum to verify.

Free Windows Admin Tool Kit Click here and download it now
September 10th, 2015 9:07am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics