次の方法で共有


Win32_SoftwareFeature class

The Win32_SoftwareFeature WMI class represents a distinct subset of a product that consists of one or more software elements. Each software element is defined in a Win32_SoftwareElement instance, and the association between a feature and its Win32_SoftwareFeature instance is defined in the Win32_SoftwareFeatureSoftwareElements association class.

Note  For more information about support or requirements for installation on 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_SoftwareFeature : CIM_SoftwareFeature
{
  uint16   Accesses;
  uint16   Attributes;
  string   Caption;
  string   Description;
  string   IdentifyingNumber;
  datetime InstallDate;
  sint16   InstallState;
  datetime LastUse;
  string   Name;
  string   ProductName;
  string   Status;
  string   Vendor;
  string   Version;
};

Members

The Win32_SoftwareFeature class has these types of members:

  • Methods
  • Properties

Methods

The Win32_SoftwareFeature class has these methods.

Method Description
Configure

Configures the associated instance of Win32_SoftwareFeature to the specified install state.

Reinstall

Reinstalls the associated instance of Win32_SoftwareFeature by using the specified reinstallation mode.

 

Properties

The Win32_SoftwareFeature class has these properties.

Accesses

Data type: uint16

Access type: Read-only

Number of times the software feature has been used.

Attributes

Data type: uint16

Access type: Read-only

Remote execution option.

Value Meaning
0

ifrsFavorLocal - Install components locally, if possible.

1

ifrsFavorSource - Install components to run from the source CD/server, if possible.

2

ifrsFollowParent - Follow the remote execution option of the parent feature.

 

Caption

Data type: string

Access type: Read-only

Short textual description of the object—a one-line string.

Description

Data type: string

Access type: Read-only

Textual description of the object.

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: datetime

Access type: Read-only

Object was installed. This property does not need a value to indicate that the object is installed.

InstallState

Data type: sint16

Access type: Read-only

Installed state of the software feature.

Value Meaning
-6

Bad Configuration

-2

Invalid Argument

-1

Unknown Package

1

Advertised

2

Absent

3

Local

4

Source

 

LastUse

Data type: datetime

Access type: Read-only

Software feature was last used.

Name

Data type: string

Access type: Read-only

Label by which the object is known to the world outside the data processing system. This label is a human-readable name that uniquely identifies the element in the context of the element's namespace.

ProductName

Data type: string

Access type: Read-only

Commonly used product name.

Status

Data type: string

Access type: Read-only

Current status of the object. Various operational and non-operational statuses can be defined. Operational statuses include: "OK", "Degraded", and "Pred Fail". An element, such as a SMART-enabled hard disk drive, can function properly but predict a failure in the near future. Nonoperational statuses include: "Error", "Starting", "Stopping", and "Service". The latter, "Service", can apply during mirror-resilvering of a disk, reload of a user permissions list, or other administrative work. Not all such work is online, yet the managed element is neither "OK" nor in one of the other states.

Values are the following:

"OK"

"Error"

"Degraded"

"Unknown"

"Pred Fail"

"Starting"

"Stopping"

"Service"

"Stressed"

"NonRecover"

"No Contact"

"Lost Comm"

Vendor

Data type: string

Access type: Read-only

Name of the product supplier. Corresponds to the Vendor property in the product object in the Distributed 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.

Remarks

Because much of the software developed today allows the user to choose which features to install, enumerating only the software packages might not provide a complete picture of the software installed on that computer. To obtain more detailed information about the software installed on a computer, you might need to enumerate the installed features of each software package, including such things as a dictionary, clip art, and design templates. You can retrieve a list of software features by using the Win32_SoftwareFeature class.

Any component can be shared between two or more Win32_SoftwareFeature instances. If two or more features reference the same component, that component is selected for installation if any of these features are selected.

The Win32_SoftwareFeature class is derived from CIM_SoftwareFeature.

Examples

The following VBScript code sample enumerates the software features installed on a computer.

strComputer = "."
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colFeatures = objWMIService.ExecQuery("SELECT * FROM Win32_SoftwareFeature")
For each objFeature in colFeatures
 Wscript.Echo "Accesses: " & objFeature.Accesses
 Wscript.Echo "Attributes: " & objFeature.Attributes
 Wscript.Echo "Caption: " & objFeature.Caption
 Wscript.Echo "Description: " & objFeature.Description
 Wscript.Echo "Identifying Number: " & objFeature.IdentifyingNumber
 Wscript.Echo "Install Date: " & objFeature.InstallDate
 Wscript.Echo "Install State: " & objFeature.InstallState
 Wscript.Echo "Last Use: " & objFeature.LastUse
 Wscript.Echo "Name: " & objFeature.Name
 Wscript.Echo "Product Name: " & objFeature.ProductName
 Wscript.Echo "Vendor: " & objFeature.Vendor
 Wscript.Echo "Version: " & objFeature.Version
Next

Requirements

Minimum supported client

Windows XP

Minimum supported server

Windows Server 2003

Namespace

Root\CIMV2

MOF

Msi.mof

DLL

Msiprov.dll

See also

Installed Applications Classes

Win32_Product