Archive

Archive for January, 2015

How to output a list of installed programs on Windows with PowerShell

A vanilla script, but including all Win32_Product class properties – a quick search found only a very basic version how to do this in PowerShell:

# to write a installed program listing to a CSV file - just adapt the output dir below
Get-WmiObject -Class Win32_Product |`
foreach{
$AssignmentType = $_.AssignmentType
$Caption = $_.Caption
$Description = $_.Description
$IdentifyingNumber = $_.IdentifyingNumber
$InstallDate = $_.InstallDate
$InstallDate2 = $_.InstallDate2
$InstallLocation = $_.InstallLocation
$InstallState = $_.InstallState
$HelpLink = $_.HelpLink
$HelpTelephone = $_.HelpTelephone
$InstallSource = $_.InstallSource
$Language = $_.Language
$LocalPackage = $_.LocalPackage
$Name = $_.Name
$PackageCache = $_.PackageCache
$PackageCode = $_.PackageCode
$PackageName = $_.PackageName
$ProductID = $_.ProductID
$RegOwner = $_.RegOwner
$RegCompany = $_.RegCompany
$SKUNumber = $_.SKUNumber
$Transforms = $_.Transforms
$URLInfoAbout = $_.URLInfoAbout
$URLUpdateInfo = $_.URLUpdateInfo
$Vendor = $_.Vendor
$WordCount = $_.WordCount
$Version = $_.Version

$Name | Select-Object `
@{n="AssignmentType";e={$AssignmentType}},
@{n="Caption";e={$Caption}},
@{n="Description";e={$Description}},
@{n="IdentifyingNumber";e={$IdentifyingNumber}},
@{n="InstallDate";e={$InstallDate}},
@{n="InstallDate2";e={$InstallDate2}},
@{n="InstallLocation";e={$InstallLocation}},
@{n="InstallState";e={$InstallState}},
@{n="HelpLink";e={$HelpLink}},
@{n="HelpTelephone";e={$HelpTelephone}},
@{n="InstallSource";e={$InstallSource}},
@{n="Language";e={$Language}},
@{n="LocalPackage";e={$LocalPackage}},
@{n="Name";e={$Name}},
@{n="PackageCache";e={$PackageCache}},
@{n="PackageCode";e={$PackageCode}},
@{n="PackageName";e={$PackageName}},
@{n="ProductID";e={$ProductID}},
@{n="RegOwner";e={$RegOwner}},
@{n="RegCompany";e={$RegCompany}},
@{n="SKUNumber";e={$SKUNumber}},
@{n="Transforms";e={$Transforms}},
@{n="URLInfoAbout";e={$URLInfoAbout}},
@{n="URLUpdateInfo";e={$URLUpdateInfo}},
@{n="Vendor";e={$Vendor}},
@{n="WordCount";e={$WordCount}},
@{n="Version";e={$Version}}
}| Export-Csv c:\temp\installed-programs.csv -NoTypeInformation

Output:

image

image