Source Code and Samples

Friday, 2 February 2007

List Installed Products


This script lists the installed products on a machine by reading the registry. The complexity in the script is to deal with the variations in the way that some scripts store there uninstall data in the registry. This script may work better than some scripts that use WMI.

Source Code

$registryKeys = get-childitem -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
foreach ($registryKey in $registryKeys)
$displayName = $registryKey.GetValue("DisplayName")
if ($displayName -eq $null)
$displayName = $registryKey.MshChildName
write-object $displayName

No comments: