Ying Li at myITforum.com

PowerShell & System Center

PowerShell script to list installed software on local computer

As you might guessed, the best place to find currently installed software is from the place that stores information about how to uninstall it – the HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall registry key.

Here is a PS script to list installed software on a local machine – you could add more propertites as you deem approriate

$a = New-Object -comobject Excel.Application
$a.visible = $True

$b = $a.Workbooks.Add()
$c = $b.Worksheets.Item(1)

$c.Cells.Item(1,1) = "Name"
$c.Cells.Item(1,2) = "Version"
$c.Cells.Item(1,3) = "Publisher"
$c.Cells.Item(1,4) = "InstalledOn"
$c.Cells.Item(1,5) = "HelpLink"
$c.Cells.Item(1,6) = "UninstallString"

$d = $c.UsedRange
$d.Interior.ColorIndex = 19
$d.Font.ColorIndex = 11
$d.Font.Bold = $True

$intRow = 2

$Keys = Get-ChildItem HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall

$Items = $keys |foreach-object {Get-ItemProperty $_.PsPath}

foreach ($item in $items)
{
$c.Cells.Item($intRow,1) = $item.Displayname
$c.Cells.Item($intRow,2) = $item.DisplayVersion
$c.Cells.Item($intRow,3) = $item.Publisher
$c.Cells.Item($intRow,4) = $item.InstallDate
$c.Cells.Item($intRow,5) = $item.HelpLink
$c.Cells.Item($intRow,6) = $item.UninstallString

$intRow = $intRow + 1
}

$d.EntireColumn.AutoFit()


 

Posted: Jan 16 2008, 09:46 PM by yli628 | with 2 comment(s)
Filed under:

Comments

AlbLog - Il blog di Alberto Dallagiacoma said:

Software installato e PowerShell

# November 15, 2009 5:19 PM

Exchange Powershell » I Can Do That With 1 Line of PowerShell: Installed Software said:

Pingback from  Exchange Powershell » I Can Do That With 1 Line of PowerShell: Installed Software

# November 18, 2009 4:37 PM