PowerShell : Quick Windows Software Audit
A while ago I publised a lovely little script on how to run 'Invoke-command' on arrays of machines quickly to get results quickly
You can find that here https://grumpy.tech/powershell-system-audit/
Today I thought I would expand on that a little and show you it in action.
For this lets do a hypothetical. Lets say we want a list of all the software installed on Windows 8.1 desktops accross youe entire estate.
Well we can get the computer objects from AD and filter to the OS we are interested in pretty easiy, Then its just case of querying each one to find out whats installed. You could use a 'ForEach' loop and that would work fine but take a long time. This method performs multiple quiries at once and returns the results much quicker.
$PC = (Get-ADComputer -Filter {OperatingSystem -like "*Windows 8.1 Pro*"} -Properties *)
$parameters = @{
Computername = $PC.name
ScriptBlock = {Get-ItemProperty HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object DisplayName, DisplayVersion, Publisher, InstallDate }
}
$RawResult = Invoke-Command @parameters
You can obviously use this snipped of code for all sorts of things. Enjoy.