Win32_Product

Win32 Product
root/cimv2dynamickey : IdentifyingNumberkey : Namekey : Version

The Win32_Product WMI class represents products as they are installed by Windows Installer. A product generally correlates to one installation package.

Warning

Enumerating this class (Get-CimInstance or Get-WmiObject) runs a consistency check on every installed MSI package. It is slow, logs MsiInstaller event 1035 in the Application log and can trigger package repairs, which means it can change the system. To list installed programs, read the registry instead: see the main example.

On this page

Main example

Alternative: read the registry

# Installed programs, read from the registry (no side effects)
$uninstallPath = @(
    'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*'
    'HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*'
    'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*'
)
Get-ItemProperty -Path $uninstallPath -ErrorAction SilentlyContinue |
    Where-Object -FilterScript { $_.DisplayName } |
    Select-Object -Property DisplayName, DisplayVersion, Publisher, InstallDate |
    Sort-Object -Property DisplayName

Warning. Avoid: every enumeration of Win32_Product triggers the consistency check, and sometimes the repair, of every installed MSI package. It is slow, writes MsiInstaller events to the Application log and can change the system. Read the registry instead (example above).

Examples

List instances

# All instances of Win32_Product, with the main properties
Get-CimInstance -ClassName Win32_Product |
    Select-Object -Property Name, Version, Vendor, InstallDate, IdentifyingNumber

Warning. Avoid: every enumeration of Win32_Product triggers the consistency check, and sometimes the repair, of every installed MSI package. It is slow, writes MsiInstaller events to the Application log and can change the system. Read the registry instead (example above).

Filter with WQL

# WQL filter evaluated by the provider: products whose name starts with Microsoft
Get-CimInstance -ClassName Win32_Product -Filter "Name LIKE 'Microsoft%'" |
    Select-Object -Property Name, Version, Vendor, InstallDate, IdentifyingNumber

Warning. Avoid: every enumeration of Win32_Product triggers the consistency check, and sometimes the repair, of every installed MSI package. It is slow, writes MsiInstaller events to the Application log and can change the system. Read the registry instead (example above).

Query a remote computer (CIM session)

review before running
# Name of the remote computer
$computerName = 'SERVER01'
# The CIM session (WSMan by default) can be reused for several queries
$cimSession = New-CimSession -ComputerName $computerName
try {
    Get-CimInstance -CimSession $cimSession -ClassName Win32_Product |
        Select-Object -Property Name, Version, Vendor, InstallDate, IdentifyingNumber
} finally {
    Remove-CimSession -CimSession $cimSession
}

Warning. Avoid: every enumeration of Win32_Product triggers the consistency check, and sometimes the repair, of every installed MSI package. It is slow, writes MsiInstaller events to the Application log and can change the system. Read the registry instead (example above).

Show the class structure

# Class structure: properties, types and flags (Key, ReadOnly…)
$cimClass = Get-CimClass -ClassName Win32_Product
$cimClass.CimClassProperties |
    Select-Object -Property Name, CimType, Flags

# Methods of the class
$cimClass.CimClassMethods |
    Select-Object -Property Name, ReturnType

Warning. Avoid: every enumeration of Win32_Product triggers the consistency check, and sometimes the repair, of every installed MSI package. It is slow, writes MsiInstaller events to the Application log and can change the system. Read the registry instead (example above).

Properties

13 of 13 properties
NameTypeAccessDescription
IdentifyingNumber keystringread

Product identification, such as a serial number on software or a die number on a hardware chip. For Windows Installer, this is the product code GUID.

Code

Warning. Avoid: every enumeration of Win32_Product triggers the consistency check, and sometimes the repair, of every installed MSI package. It is slow, writes MsiInstaller events to the Application log and can change the system. Read the registry instead (example above).

# Value of IdentifyingNumber for each instance
Get-CimInstance -ClassName Win32_Product -Property Name, IdentifyingNumber |
    Select-Object -Property Name, IdentifyingNumber
Name keystringread

Commonly used product name.

Code

Warning. Avoid: every enumeration of Win32_Product triggers the consistency check, and sometimes the repair, of every installed MSI package. It is slow, writes MsiInstaller events to the Application log and can change the system. Read the registry instead (example above).

# Value of Name for each instance
Get-CimInstance -ClassName Win32_Product -Property IdentifyingNumber, Name |
    Select-Object -Property IdentifyingNumber, Name
Version keystringread

Product version information.

Code

Warning. Avoid: every enumeration of Win32_Product triggers the consistency check, and sometimes the repair, of every installed MSI package. It is slow, writes MsiInstaller events to the Application log and can change the system. Read the registry instead (example above).

# Value of Version for each instance
Get-CimInstance -ClassName Win32_Product -Property IdentifyingNumber, Name, Version |
    Select-Object -Property IdentifyingNumber, Name, Version
Vendorstringread

Name of the product supplier or manufacturer.

Code

Warning. Avoid: every enumeration of Win32_Product triggers the consistency check, and sometimes the repair, of every installed MSI package. It is slow, writes MsiInstaller events to the Application log and can change the system. Read the registry instead (example above).

# Value of Vendor for each instance
Get-CimInstance -ClassName Win32_Product -Property IdentifyingNumber, Name, Vendor |
    Select-Object -Property IdentifyingNumber, Name, Vendor
Captionstringread

Short description of the product, in one line.

Code

Warning. Avoid: every enumeration of Win32_Product triggers the consistency check, and sometimes the repair, of every installed MSI package. It is slow, writes MsiInstaller events to the Application log and can change the system. Read the registry instead (example above).

# Value of Caption for each instance
Get-CimInstance -ClassName Win32_Product -Property IdentifyingNumber, Name, Caption |
    Select-Object -Property IdentifyingNumber, Name, Caption
Descriptionstringread

Description of the product.

Code

Warning. Avoid: every enumeration of Win32_Product triggers the consistency check, and sometimes the repair, of every installed MSI package. It is slow, writes MsiInstaller events to the Application log and can change the system. Read the registry instead (example above).

# Value of Description for each instance
Get-CimInstance -ClassName Win32_Product -Property IdentifyingNumber, Name, Description |
    Select-Object -Property IdentifyingNumber, Name, Description
InstallDatestringread

Date the product was installed, as a string in the form YYYYMMDD.

Code

Warning. Avoid: every enumeration of Win32_Product triggers the consistency check, and sometimes the repair, of every installed MSI package. It is slow, writes MsiInstaller events to the Application log and can change the system. Read the registry instead (example above).

# Value of InstallDate for each instance
Get-CimInstance -ClassName Win32_Product -Property IdentifyingNumber, Name, InstallDate |
    Select-Object -Property IdentifyingNumber, Name, InstallDate
InstallLocationstringread

Location of the installed product.

Code

Warning. Avoid: every enumeration of Win32_Product triggers the consistency check, and sometimes the repair, of every installed MSI package. It is slow, writes MsiInstaller events to the Application log and can change the system. Read the registry instead (example above).

# Value of InstallLocation for each instance
Get-CimInstance -ClassName Win32_Product -Property IdentifyingNumber, Name, InstallLocation |
    Select-Object -Property IdentifyingNumber, Name, InstallLocation
InstallSourcestringread

Location from which the product was installed.

Code

Warning. Avoid: every enumeration of Win32_Product triggers the consistency check, and sometimes the repair, of every installed MSI package. It is slow, writes MsiInstaller events to the Application log and can change the system. Read the registry instead (example above).

# Value of InstallSource for each instance
Get-CimInstance -ClassName Win32_Product -Property IdentifyingNumber, Name, InstallSource |
    Select-Object -Property IdentifyingNumber, Name, InstallSource
LocalPackagestringread

Location of the locally cached installation package for the product.

Code

Warning. Avoid: every enumeration of Win32_Product triggers the consistency check, and sometimes the repair, of every installed MSI package. It is slow, writes MsiInstaller events to the Application log and can change the system. Read the registry instead (example above).

# Value of LocalPackage for each instance
Get-CimInstance -ClassName Win32_Product -Property IdentifyingNumber, Name, LocalPackage |
    Select-Object -Property IdentifyingNumber, Name, LocalPackage
PackageNamestringread

Name of the installation package, usually the .msi file name.

Code

Warning. Avoid: every enumeration of Win32_Product triggers the consistency check, and sometimes the repair, of every installed MSI package. It is slow, writes MsiInstaller events to the Application log and can change the system. Read the registry instead (example above).

# Value of PackageName for each instance
Get-CimInstance -ClassName Win32_Product -Property IdentifyingNumber, Name, PackageName |
    Select-Object -Property IdentifyingNumber, Name, PackageName
PackageCodestringread

GUID identifying the installation package.

Code

Warning. Avoid: every enumeration of Win32_Product triggers the consistency check, and sometimes the repair, of every installed MSI package. It is slow, writes MsiInstaller events to the Application log and can change the system. Read the registry instead (example above).

# Value of PackageCode for each instance
Get-CimInstance -ClassName Win32_Product -Property IdentifyingNumber, Name, PackageCode |
    Select-Object -Property IdentifyingNumber, Name, PackageCode
Languagestringread

Language code of the product, as a Windows language identifier.

Code

Warning. Avoid: every enumeration of Win32_Product triggers the consistency check, and sometimes the repair, of every installed MSI package. It is slow, writes MsiInstaller events to the Application log and can change the system. Read the registry instead (example above).

# Value of Language for each instance
Get-CimInstance -ClassName Win32_Product -Property IdentifyingNumber, Name, Language |
    Select-Object -Property IdentifyingNumber, Name, Language

Methods

Install static#

Installs a Windows Installer package.

uint32 Install(
    [in] string PackageLocation,
    [in] string Options,
    [in] boolean AllUsers
);

Parameters

ParameterTypeDirectionDescription
PackageLocationstringin

Location of the Windows Installer package (.msi).

Optionsstringin

Command-line options passed to Windows Installer, as property=value pairs.

AllUsersbooleanin

If true, the package is installed or advertised for all users of the computer.

Return values

ValueLabelDescription
0Success
OtherOtherWindows Installer error code returned by the operation.

Call the Install method

review before running
# Warning: this method can change the system. -WhatIf shows the operation without running it.
$methodParameters = @{
    ClassName  = 'Win32_Product'
    MethodName = 'Install'
    Arguments  = @{
        PackageLocation = 'Example'
        Options         = 'Example'
        AllUsers        = $false
    }
    WhatIf     = $true  # Remove this line to actually run the method
}
$result = Invoke-CimMethod @methodParameters

# With -WhatIf nothing runs and no result is returned
if ($result) {
    $result.ReturnValue
}

This method can change the system. The -WhatIf parameter shows the operation without running it: remove it only after checking.

Admin static#

Installs a package as an administrative image on a network location.

uint32 Admin(
    [in] string PackageLocation,
    [in] string TargetLocation,
    [in] string Options
);

Parameters

ParameterTypeDirectionDescription
PackageLocationstringin

Location of the Windows Installer package (.msi).

TargetLocationstringin

Network location of the administrative image.

Optionsstringin

Command-line options passed to Windows Installer, as property=value pairs.

Return values

ValueLabelDescription
0Success
OtherOtherWindows Installer error code returned by the operation.

Call the Admin method

review before running
# Warning: this method can change the system. -WhatIf shows the operation without running it.
$methodParameters = @{
    ClassName  = 'Win32_Product'
    MethodName = 'Admin'
    Arguments  = @{
        PackageLocation = 'Example'
        TargetLocation  = 'Example'
        Options         = 'Example'
    }
    WhatIf     = $true  # Remove this line to actually run the method
}
$result = Invoke-CimMethod @methodParameters

# With -WhatIf nothing runs and no result is returned
if ($result) {
    $result.ReturnValue
}

This method can change the system. The -WhatIf parameter shows the operation without running it: remove it only after checking.

Advertise static#

Advertises a package, which makes it available for installation on first use.

uint32 Advertise(
    [in] string PackageLocation,
    [in] string Options,
    [in] boolean AllUsers
);

Parameters

ParameterTypeDirectionDescription
PackageLocationstringin

Location of the Windows Installer package (.msi).

Optionsstringin

Command-line options passed to Windows Installer, as property=value pairs.

AllUsersbooleanin

If true, the package is installed or advertised for all users of the computer.

Return values

ValueLabelDescription
0Success
OtherOtherWindows Installer error code returned by the operation.

Call the Advertise method

review before running
# Warning: this method can change the system. -WhatIf shows the operation without running it.
$methodParameters = @{
    ClassName  = 'Win32_Product'
    MethodName = 'Advertise'
    Arguments  = @{
        PackageLocation = 'Example'
        Options         = 'Example'
        AllUsers        = $false
    }
    WhatIf     = $true  # Remove this line to actually run the method
}
$result = Invoke-CimMethod @methodParameters

# With -WhatIf nothing runs and no result is returned
if ($result) {
    $result.ReturnValue
}

This method can change the system. The -WhatIf parameter shows the operation without running it: remove it only after checking.

Reinstall #

Reinstalls the product.

uint32 Reinstall([in] uint16 ReinstallMode);

Parameters

ParameterTypeDirectionDescription
ReinstallModeuint16in

Reinstallation mode, such as repairing missing files or all files.

Return values

ValueLabelDescription
0Success
OtherOtherWindows Installer error code returned by the operation.

Call the Reinstall method

review before running
# Warning: this method can change the system. -WhatIf shows the operation without running it.
# Target instance
$instance = Get-CimInstance -ClassName Win32_Product -Filter "Name = 'Example'"
$methodParameters = @{
    InputObject = $instance
    MethodName  = 'Reinstall'
    Arguments   = @{ ReinstallMode = 0 }
    WhatIf      = $true  # Remove this line to actually run the method
}
$result = Invoke-CimMethod @methodParameters

# With -WhatIf nothing runs and no result is returned
if ($result) {
    $result.ReturnValue
}

This method can change the system. The -WhatIf parameter shows the operation without running it: remove it only after checking.

Uninstall #

Uninstalls the product.

uint32 Uninstall();

Return values

ValueLabelDescription
0Success
OtherOtherWindows Installer error code returned by the operation.

Call the Uninstall method

review before running
# Warning: this method can change the system. -WhatIf shows the operation without running it.
# Target instance
$instance = Get-CimInstance -ClassName Win32_Product -Filter "Name = 'Example'"
$methodParameters = @{
    InputObject = $instance
    MethodName  = 'Uninstall'
    WhatIf      = $true  # Remove this line to actually run the method
}
$result = Invoke-CimMethod @methodParameters

# With -WhatIf nothing runs and no result is returned
if ($result) {
    $result.ReturnValue
}

This method can change the system. The -WhatIf parameter shows the operation without running it: remove it only after checking.

Configure #

Configures the installation state of the product.

uint32 Configure(
    [in] sint16 InstallState,
    [in] uint16 InstallLevel,
    [in] string Options
);

Parameters

ParameterTypeDirectionDescription
InstallStatesint16in

Requested installation state.

InstallLeveluint16in

Installation level, which selects the features to install.

Optionsstringin

Command-line options passed to Windows Installer, as property=value pairs.

Return values

ValueLabelDescription
0Success
OtherOtherWindows Installer error code returned by the operation.

Call the Configure method

review before running
# Warning: this method can change the system. -WhatIf shows the operation without running it.
# Target instance
$instance = Get-CimInstance -ClassName Win32_Product -Filter "Name = 'Example'"
$methodParameters = @{
    InputObject = $instance
    MethodName  = 'Configure'
    Arguments   = @{
        InstallState = 0
        InstallLevel = 0
        Options      = 'Example'
    }
    WhatIf      = $true  # Remove this line to actually run the method
}
$result = Invoke-CimMethod @methodParameters

# With -WhatIf nothing runs and no result is returned
if ($result) {
    $result.ReturnValue
}

This method can change the system. The -WhatIf parameter shows the operation without running it: remove it only after checking.

Upgrade #

Upgrades the product with a new package.

uint32 Upgrade([in] string PackageLocation, [in] string Options);

Parameters

ParameterTypeDirectionDescription
PackageLocationstringin

Location of the Windows Installer package (.msi).

Optionsstringin

Command-line options passed to Windows Installer, as property=value pairs.

Return values

ValueLabelDescription
0Success
OtherOtherWindows Installer error code returned by the operation.

Call the Upgrade method

review before running
# Warning: this method can change the system. -WhatIf shows the operation without running it.
# Target instance
$instance = Get-CimInstance -ClassName Win32_Product -Filter "Name = 'Example'"
$methodParameters = @{
    InputObject = $instance
    MethodName  = 'Upgrade'
    Arguments   = @{
        PackageLocation = 'Example'
        Options         = 'Example'
    }
    WhatIf      = $true  # Remove this line to actually run the method
}
$result = Invoke-CimMethod @methodParameters

# With -WhatIf nothing runs and no result is returned
if ($result) {
    $result.ReturnValue
}

This method can change the system. The -WhatIf parameter shows the operation without running it: remove it only after checking.

Remarks

The class is provided by the MSI provider (MSIProv) and lists only the products installed with Windows Installer; programs installed otherwise do not appear.

Enumerating Win32_Product starts a consistency check of every installed MSI package, which can repair a package and which writes MsiInstaller events (event 1035) in the Application log. The enumeration is slow. To list installed programs, read the Uninstall registry keys instead.

Inheritance

Superclass chain

  1. CIM_Product
  2. Win32_Product

Known subclasses

No known subclass.

Requirements

Namespace
root/cimv2
Minimum client
Windows Vista
Minimum server
Windows Server 2008
Provider
MSIProv
Class qualifiers

Dynamic Provider("MSIProv")

Microsoft source

Source: Microsoft Learn

Entry written by WMI Explorer.