
This script gets the installed software list on a specific computer using WMI
Script :
$strComputer = "computer_hostname" $colItems = get-wmiobject -class "Win32_Product" -namespace "root\CIMV2" ` -computername $strComputer foreach ($objItem in $colItems) { write-host "Caption: " $objItem.Caption write-host "Description: " $objItem.Description write-host "Identifying Number: " $objItem.IdentifyingNumber write-host "Installation Date: " $objItem.InstallDate write-host "Installation Date 2: " $objItem.InstallDate2 write-host "Installation Location: " $objItem.InstallLocation write-host "Installation State: " $objItem.InstallState write-host "Name: " $objItem.Name write-host "Package Cache: " $objItem.PackageCache write-host "SKU Number: " $objItem.SKUNumber write-host "Vendor: " $objItem.Vendor write-host "Version: " $objItem.Version write-host }
Reference
Win32_Product
The Win32_Product WMI class represents products as they are installed by Windows Installer. A product generally correlates to one installation package.
Note For more information about support or requirements for installation of a specific operating system, see Operating System Availability of WMI Components.
The following syntax is simplified from Managed Object Format (MOF) code and includes all inherited properties. Properties and methods are in alphabetic order, not MOF order.
Syntax
[Provider("MSIProv"), Dynamic]class Win32_Product : CIM_Product { uint16 AssignmentType; string Caption; string Description; string IdentifyingNumber; string InstallDate; datetime InstallDate2; string InstallLocation; sint16 InstallState; string HelpLink; string HelpTelephone; string InstallSource; string Language; string LocalPackage; string Name; string PackageCache; string PackageCode; string PackageName; string ProductID; string RegOwner; string RegCompany; string SKUNumber; string Transforms; string URLInfoAbout; string URLUpdateInfo; string Vendor; uint32 WordCount; string Version; };
Remarks
The Win32_Product class is derived from CIM_Product.
Warning Win32_Product is not query optimized. Queries such as “select * from Win32_Product where (name like ‘Sniffer%’)” require WMI to use the MSI provider to enumerate all of the installed products and then parse the full list sequentially to handle the “where” clause. This process also initiates a consistency check of packages installed, verifying and repairing the install. With an account with only user privileges, as the user account may not have access to quite a few locations, may cause delay in application launch and an event 11708 stating an installation failure. For more information, see KB Article 794524.