Monday, December 18, 2017

Getting last modified software on Windows using Powershell

I like getting weird requests and resolving them with one line of code in Powershell. Powershell is indeed a very polished tool for working in the terminal in Windows.

This week I was asked by a friend this question: "hey, how can I get the lastly installed software on my machine"?


# getting windows diag information - expot all installed software on my machine
Get-WmiObject -Class Win32_Product | Export-Csv installed.csv

And how do I look for what was modified most recently in our machine?


# getting last modified files
Get-ChildItem C:\ -rec | sort LastWriteTime | select -last 1000 | Export-Csv files.csv

Fun! I do not miss the old DOS command prompt.