Win32 Classes


Win32_Product Class

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

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   PackageName;
  string   RegOwner;
  string   RegCompany;
  string   SKUNumber;
  string   Transforms;
  string   URLInfoAbout;
  string   URLUpdateInfo;
  string   Vendor;
  uint32   WordCount;
  string   Version;
};

Methods

The Win32_Product class defines the following methods.

MethodDescription

Install

Installs an associated Win32_Product instance using the installation package provided through PackageLocation and any command line options that are supplied.

Admin

Performs an administrative install of an associated Win32_Product instance using the installation package provided through PackageLocation, and any command line options that are supplied.

Advertise

Advertises an associated Win32_Product instance using the installation package provided through PackageLocation and any command line options that are supplied.

Reinstall

Reinstalls the associated instance of Win32_Product using the specified reinstallation mode.

Upgrade

Upgrades the associated Win32_Product instance using the upgrade package provided through PackageLocation and any command line options that are supplied.

Configure

Configures the associated instance of Win32_Product to the specified install state and level.

Uninstall

Uninstalls the associated instance of Win32_Product.

 

Properties

The Win32_Product class defines the following properties.

AssignmentType
Data type: uint16
Access type: Read-only

Assignment type of the product.

Windows Server 2003, Windows XP, and Windows 2000:  This property is not available.

Possible values are

ValueMeaning
0

The product is assigned by user.

1

The product is assigned by computer.

 

Caption
Data type: string
Access type: Read-only

Short textual description for the product—a one-line string.

Description
Data type: string
Access type: Read-only

Description of the product.

HelpLink
Data type: string
Access type: Read-only

The support link for the product.

Windows Server 2003, Windows XP, and Windows 2000:  This property is not available.
HelpTelephone
Data type: string
Access type: Read-only

The support telephone for the product.

Windows Server 2003, Windows XP, and Windows 2000:  This property is not available.
IdentifyingNumber
Data type: string
Access type: Read-only

Product identification such as a serial number on software, or a die number on a hardware chip.

InstallDate
Data type: string
Access type: Read-only

Starting with Windows XP this property is no longer supported for Win32_Product. Instead, use the InstallDate2 property, which is in the WMI CIM_DATETIME format.

Windows 2000:  Date that this product is installed on the system. This property does not need a value to indicate that the object is installed.

InstallDate2
Data type: datetime
Access type: Read-only

Date that this product was installed on the system. This property does not require a value to indicate that the object is installed. For more information about WMI dates and times, see Date and Time Format.

Windows 2000:  This property is not available.
InstallLocation
Data type: string
Access type: Read-only

Location of the installed product.

InstallSource
Data type: string
Access type: Read-only

The installation source directory of the product.

Windows Server 2003, Windows XP, and Windows 2000:  This property is not available.
InstallState
Data type: sint16
Access type: Read-only

Installed state of the product.

ValueMeaning
-6

Bad Configuration

-2

Invalid Argument

-1

Unknown Package

1

Advertised

2

Absent

5

Installed

 

Language
Data type: string
Access type: Read-only

The language of the product.

Windows Server 2003, Windows XP, and Windows 2000:  This property is not available.
LocalPackage
Data type: string
Access type: Read-only

The location of the locally cached package for this product.

Windows Server 2003, Windows XP, and Windows 2000:  This property is not available.
Name
Data type: string
Access type: Read-only
Qualifiers: Key

Commonly used product name.

PackageCache
Data type: string
Access type: Read-only

Location of the locally cached package for this product.

PackageCode
Data type: string
Access type: Read-only

The identifier for the package from which this product was installed.

Windows Server 2003, Windows XP, and Windows 2000:  This property is not available.
PackageName
Data type: string
Access type: Read-only

The original package name for the product.

Windows Server 2003, Windows XP, and Windows 2000:  This property is not available.
PackageName
Data type: string
Access type: Read-only

The original package name for the product.

ProductID
Data type: string
Access type: Read-only

The product ID.

Windows Server 2003, Windows XP, and Windows 2000:  This property is not available.
RegCompany
Data type: string
Access type: Read-only

The company registered to use the product.

Windows Server 2003, Windows XP, and Windows 2000:  This property is not available.
RegOwner
Data type: string
Access type: Read-only

The owner registered to use the product.

Windows Server 2003, Windows XP, and Windows 2000:  This property is not available.
SKUNumber
Data type: string
Access type: Read-only

Product SKU (stock-keeping unit) information.

Transforms
Data type: string
Access type: Read-only

The transforms of the product.

Windows Server 2003, Windows XP, and Windows 2000:  This property is not available.
URLInfoAbout
Data type: string
Access type: Read-only

The URL information for the product.

Windows Server 2003, Windows XP, and Windows 2000:  This property is not available.
URLUpdateInfo
Data type: string
Access type: Read-only

The URL update information the product.

Windows Server 2003, Windows XP, and Windows 2000:  This property is not available.
Vendor
Data type: string
Access type: Read-only

Name of the product supplier. Corresponds to the Vendor property in the product object in the Desktop Management Task Force (DMTF) Solution Exchange Standard.

Version
Data type: string
Access type: Read-only

Product version information. Corresponds to the Version property in the product object in the DMTF Solution Exchange Standard.

WordCount
Data type: uint32
Access type: Read-only

Number of words in the summary information for the product.

Windows Server 2003, Windows XP, and Windows 2000:  This property is not available.

Remarks

The Win32_Product class is derived from CIM_Product.

Examples

For script code examples, see WMI Tasks for Scripts and Applications and the TechNet ScriptCenter Script Repository.

For C++ code examples, see WMI C++ Application Examples.

The following code example shows how to generate an inventory list of installed software on a local computer. The script generates a text file with a list of the software and versions installed on a local computer.

strComputer = "."

Set objWMIService = GetObject("winmgmts:" & _
    "{impersonationLevel=impersonate}!\\" & _
    strComputer & _
    "\root\cimv2")

Set colSoftware = objWMIService.ExecQuery _
    ("SELECT * FROM Win32_Product")   

If colSoftware.Count > 0 Then

    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objTextFile = objFSO.CreateTextFile( _
        "c:\SoftwareList.txt", True)

    For Each objSoftware in colSoftware
        objTextFile.WriteLine objSoftware.Caption & vbtab & _
        objSoftware.Version
    Next

    objTextFile.Close

Else
    WScript.Echo "Cannot retrieve software from this computer."

End If

Requirements

Minimum supported clientWindows 2000 Professional
Minimum supported serverWindows 2000 Server
MOFMsi.mof
DLLMsiprov.dll
Namespace\root\cimv2

See Also

Installed Applications Classes

Send comments about this topic to Microsoft

Build date: 11/3/2009

Tags :


Community Content

Roland Żerek
The win32_product class on Vista
The provided VB script does not work on Windows Vista as well as the equivalent C# code does not. Is it a bug?
Tags : windows vista

Papy Normand
Error ( ? ) in the documentation of W32_Product

1) We can find twice PackageName in the part Properties ( one without the remark not available for Server 2003,XP,2000

2) We can find twice PackageName in the list of properties before the methods ( the 2nd PackageName is written Packagename )

3) PackageCache is not available for Windows XP (Pro) it"s not indicated in the documentation

I would want to know if these remarks are bugs or not ( if bug(s), is it possible to obtain a correction ?

Thanks beforehand


Narayanan A R
Generic failure

I get the following error if I run "wmic PRODUCT GET Name" in Windows Vista Business edition.

Node - WVST-SC-VM02
ERROR:
Code = 0x80041001
Description = Generic failure
Facility = WMI

Tags : vista

Yaggoth
Generic failure
Same error as above.

With this powershell code :

$lobjapp = get-wmiobject -class WiN32_Product -computerName $lstrTargetComputer

Get-WmiObject : Échec générique
At line:1 char:21
+ $app = get-wmiobject <<<< -class WiN32_Product -computerName *****



With the Windows utility wbemtest in %systemroot%\system32\wbem i got the same error.

Win32_Service or Win32_Process classes work fine.

I use Windows XP Pro SP3 and the target computer run Windows XP Pro SP3 too.


They have same version of msiprov.dll (5.1.2600.0) and the have Windows Installer 3.1

Page view tracker