Get-InstalledSoftware (what software is installed?)
nishant left a comment on my “Powershell, Remote Registry and You! Part 1 (Overview)” post.
Nishant asked “I want a complete list of software installed on a remote machine using Powershell.”
I decided to post on this because it is brought up a lot. Unfortunately, getting a complete list of install applications is not that straightforward. Some applications do not store information in the Registry so the best we can do is list software that provides Uninstall regkey info. That is what the script below does. While this is not perfect it does a pretty good job getting the info.
$regKey = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey([Microsoft.Win32.RegistryHive]::LocalMachine,$Srv)
$key = $regKey.OpenSubkey("Software\Microsoft\Windows\CurrentVersion\Uninstall",$false)
$key.GetSubKeyNames()
It is common to see people use Win32_Product to list installed apps, but it is important to point out this only list applications installed by an MSI installer.
Perhaps the best options is to combine both of these options.
Param($srv=$env:ComputerName)
$regKey = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey([Microsoft.Win32.RegistryHive]::LocalMachine,$Srv)
$key = $regKey.OpenSubkey("Software\Microsoft\Windows\CurrentVersion\Uninstall",$false)
Write-Host
Write-Host "Getting Software in Uninstall Key" -Fore Green
Write-Host ("-"*60) -Fore Gray
$key.GetSubKeyNames()
Write-Host
Write-Host "Getting Software From Win32_Product" -Fore Green
Write-Host ("-"*60) -Fore Gray
get-wmiobject Win32_Product -comp $srv | foreach{$_.Name}
Write-Host
tshell :: Jan.24.2008 :: .NET, All, Powershell, Registry :: No Comments »

I made a slight variation on this, this will display the friendly name from each subkey.
Param($srv=$env:ComputerName)
$regKey = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey([Microsoft.Win32.RegistryHive]::LocalMachine,$Srv)
$key = $regKey.OpenSubkey(”Software\Microsoft\Windows\CurrentVersion\Uninstall”,$false)
Foreach($branch in $Key.GetSubKeyNames()){$sub = $key.OpenSubkey($branch, $false)
$sub.GetValue(”DisplayName”)}