大网数据广告活动
Windows 系统接口

Win32_Account class

· 52CE 我爱测

Contains information about user accounts and group accounts known to the computer system running Windows.

The Win32_Account abstract WMI class contains information about user accounts and group accounts known to the computer system running Windows. User or group names recognized by a Windows domain are descendants (or members) of this class.

The following syntax is simplified from Managed Object Format (MOF) code and includes all of the inherited properties. Properties are listed in alphabetic order, not MOF order.

Syntax

[Abstract, UUID("{8502C4C9-5FBB-11D2-AAC1-006008C78BC7}"), AMENDMENT]
class Win32_Account : CIM_LogicalElement
{
  string   Caption;
  string   Description;
  string   Domain;
  datetime InstallDate;
  boolean  LocalAccount;
  string   Name;
  string   SID;
  uint8    SIDType;
  string   Status;
};

Members

The Win32_Account class has these types of members:

Properties

The Win32_Account class has these properties.

Caption

Data type: string

Access type: Read-only

Qualifiers: MaxLen (64), DisplayName ("Caption")

Short description of the object.

This property is inherited from the CIM_ManagedSystemElement class.

Description

Data type: string

Access type: Read-only

Qualifiers: DisplayName ("Description")

Description of the object.

This property is inherited from the CIM_ManagedSystemElement class.

Domain

Data type: string

Access type: Read-only

Qualifiers: key, MappingStrings ("Win32API|Network Management Functions|Domain")

Name of the Windows domain to which a group or user belongs.

Example: "NA-SALES"

InstallDate

Data type: datetime

Access type: Read-only

Qualifiers: MappingStrings ("MIF.DMTF|ComponentID|001.5"), DisplayName ("Install Date")

Date and time that the object was installed. This property does not require a value to indicate that the object is installed.

This property is inherited from the CIM_ManagedSystemElement class.

LocalAccount

Data type: boolean

Access type: Read-only

Qualifiers: Fixed

If TRUE, the account is defined on the local machine. To retrieve only accounts defined on the local machine, design a query that includes the condition "LocalAccount=TRUE".

Name

Data type: string

Access type: Read-only

Qualifiers: Override ("Name"), key, MappingStrings ("Win32API|Network Management Structures|name")

Name of the Windows system account on the domain specified by the Domain property of this class. This property overrides the Name property inherited from CIM_ManagedSystemElement.

SID

Data type: string

Access type: Read-only

Qualifiers: Fixed, MappingStrings ("Win32API|Security Identifiers (SIDs)")

Security identifier (SID) for this account. A SID is a string value of variable length used to identify a trustee. Each account has a unique SID issued by an authority (such as a Windows domain), stored in a security database. When a user logs on, the system retrieves the user's SID from the database and places it in the user's access token. The system uses the SID in the user's access token to identify the user in all subsequent interactions with Windows security. When a SID has been used as the unique identifier for a user or group, it cannot be used again to identify another user or group.

SIDType

Data type: uint8

Access type: Read-only

Qualifiers: Fixed, MappingStrings ("Win32API|Access Control Enumeration Types|SID_NAME_USE")

Enumerated values that specify the type of security identifier (SID).

SidTypeUser (1)

SidTypeGroup (2)

SidTypeDomain (3)

SidTypeAlias (4)

SidTypeWellKnownGroup (5)

SidTypeDeletedAccount (6)

SidTypeInvalid (7)

SidTypeUnknown (8)

SidTypeComputer (9)

Status

Data type: string

Access type: Read-only

Qualifiers: MaxLen (10), DisplayName ("Status")

Current status of the object. Various operational and nonoperational statuses can be defined. Operational statuses include: "OK", "Degraded", and "Pred Fail" (an element, such as a SMART-enabled hard disk drive, may be functioning properly but predicts 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.

This property is inherited from the CIM_ManagedSystemElement class.

The values are:

OK ("OK")

Error ("Error")

Degraded ("Degraded")

Unknown ("Unknown")

Pred Fail ("Pred Fail")

Starting ("Starting")

Stopping ("Stopping")

Service ("Service")

Stressed ("Stressed")

NonRecover ("NonRecover")

No Contact ("No Contact")

Lost Comm ("Lost Comm")

Remarks

The Win32_Account class is derived from CIM_LogicalElement.

Examples

The following PowerShell code retrieves the local accounts.

Get-WmiObject Win32_Account -Filter "Domain='$Env:ComputerName'"

The following PowerShell code retrieves the domain accounts.

 Get-WmiObject Win32_Account -Filter "Domain='$Env:UserDomain'" 

Requirements

Requirement Value
Minimum supported client Windows Vista
Minimum supported server Windows Server 2008
Namespace Root\CIMV2
MOF CIMWin32.mof
DLL CIMWin32.dll

See also

CIM_LogicalElement

Operating System Classes

Source: Microsoft Learn / Windows Win32 documentation by Microsoft and contributors. Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.

资料来源与适用范围

资料来源
Microsoft Learn / Windows Win32 documentation
适用范围
Windows Win32 API · Source date 05/31/2018
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。