Get Installed Software

by Feb 16, 2011

You can get a list of installed software right from the registry as long as the target system runs PowerShell v2 and is set up for PowerShell Remote, which also works for remote machines. When you run Get-InstalledSoftware, it will return the locally installed software. By adding a ComputerName, you can then use PowerShell Remote to get the same information from a remote machine:

function Get-InstalledSoftware {
param(
$computername = $null
)

$code = {
get-itemproperty 'hklm:\software\microsoft\windows\currentversion\`

uninstall\*' |
where-object { $_.DisplayName } |
Select-Object DisplayName, DisplayVersion, Publisher
}

if ($computername) {
Invoke-Command -ScriptBlock $code -computerName $computername |
Select-Object DisplayName, DisplayVersion, Publisher
} else {
Invoke-Command -ScriptBlock $code
}
}

Twitter This Tip!
ReTweet this Tip!