Main example
List instances
# All instances of Win32_ComputerSystem, with the main properties
Get-CimInstance -ClassName Win32_ComputerSystem |
Select-Object -Property @(
'Name'
'Manufacturer'
'Model'
'Domain'
@{ Name = 'TotalPhysicalMemoryGB'; Expression = { [math]::Round($_.TotalPhysicalMemory / 1GB, 2) } }
'NumberOfLogicalProcessors'
'UserName'
)Examples
Decode numeric values
# Lookup table for AdminPasswordStatus (values documented by Microsoft)
$adminPasswordStatusName = @{
0 = 'Disabled'
1 = 'Enabled'
2 = 'Not Implemented'
3 = 'Unknown'
}
# Lookup table for BootOptionOnLimit (values documented by Microsoft)
$bootOptionOnLimitName = @{
0 = 'Reserved'
1 = 'Operating system'
2 = 'System utilities'
3 = 'Do not reboot'
}
Get-CimInstance -ClassName Win32_ComputerSystem |
Select-Object -Property @(
'Name'
'Manufacturer'
'Model'
'Domain'
@{ Name = 'TotalPhysicalMemoryGB'; Expression = { [math]::Round($_.TotalPhysicalMemory / 1GB, 2) } }
'NumberOfLogicalProcessors'
'UserName'
)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_ComputerSystem |
Select-Object -Property @(
'Name'
'Manufacturer'
'Model'
'Domain'
@{ Name = 'TotalPhysicalMemoryGB'; Expression = { [math]::Round($_.TotalPhysicalMemory / 1GB, 2) } }
'NumberOfLogicalProcessors'
'UserName'
)
} finally {
Remove-CimSession -CimSession $cimSession
}WSMan (WinRM) is used by default. For a host without WinRM, create the session with -SessionOption (New-CimSessionOption -Protocol Dcom). Add -Credential to use another account.
Show the class structure
# Class structure: properties, types and flags (Key, ReadOnly…)
$cimClass = Get-CimClass -ClassName Win32_ComputerSystem
$cimClass.CimClassProperties |
Select-Object -Property Name, CimType, Flags
# Methods of the class
$cimClass.CimClassMethods |
Select-Object -Property Name, ReturnTypeProperties
| Name | Type | Access | Description | |||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| AdminPasswordStatus# | uint16 | read | System hardware security settings for administrator password status. Values (4)
Code | |||||||||||||||||||||||||||||||||||||||||||||
| AutomaticManagedPagefile# | boolean | read/write | If True, the system manages the page file. CodeWarning. Changes the system: check with -WhatIf first. An elevated console is often required. | |||||||||||||||||||||||||||||||||||||||||||||
| AutomaticResetBootOption# | boolean | read/write | If True, the automatic reset boot option is enabled. CodeWarning. Changes the system: check with -WhatIf first. An elevated console is often required. | |||||||||||||||||||||||||||||||||||||||||||||
| AutomaticResetCapability# | boolean | read | If True, the automatic reset is enabled. Code | |||||||||||||||||||||||||||||||||||||||||||||
| BootOptionOnLimit# | uint16 | read | Boot option limit is ON. Identifies the system action when the ResetLimit value is reached. Values (4)
Code | |||||||||||||||||||||||||||||||||||||||||||||
| BootOptionOnWatchDog# | uint16 | read | Type of reboot action after the time on the watchdog timer is elapsed. Values (4)
Code | |||||||||||||||||||||||||||||||||||||||||||||
| BootROMSupported# | boolean | read | If True, indicates whether a boot ROM is supported. Code | |||||||||||||||||||||||||||||||||||||||||||||
| BootStatus# | uint16[] | read | Status and Additional Data fields that identify the boot status. This value comes from the Boot Status member of the System Boot Information structure in the SMBIOS information. Windows Server 2012 R2, Windows 8.1, Windows Server 2012, Windows 8, Windows Server 2008 R2, Windows 7, Windows Server 2008 and Windows Vista: This property is not supported before Windows 10 and Windows Server 2016. Code | |||||||||||||||||||||||||||||||||||||||||||||
| BootupState# | string | read | System is started. Fail-safe boot bypasses the user startup files also called SafeBoot. The following list contains the required values: "Normal boot" "Fail-safe boot" "Fail-safe with network boot" Values (3)
Code | |||||||||||||||||||||||||||||||||||||||||||||
| Caption# | string | read | Short description of the object a one-line string. Code | |||||||||||||||||||||||||||||||||||||||||||||
| ChassisBootupState# | uint16 | read | Boot up state of the chassis. This value comes from the Boot-up State member of the System Enclosure or Chassis structure in the SMBIOS information. Values (6)
Code | |||||||||||||||||||||||||||||||||||||||||||||
| ChassisSKUNumber# | string | read | The chassis or enclosure SKU number as a string. This value comes from the SKU Number member of the System Enclosure or Chassis structure in the SMBIOS information. Windows Server 2012 R2, Windows 8.1, Windows Server 2012, Windows 8, Windows Server 2008 R2, Windows 7, Windows Server 2008 and Windows Vista: This property is not supported before Windows 10 and Windows Server 2016. Code | |||||||||||||||||||||||||||||||||||||||||||||
| CreationClassName# key | string | read | Name of the first concrete class in the inheritance chain of an instance. You can use this property with other properties of the class to identify all instances of the class and its subclasses. Code | |||||||||||||||||||||||||||||||||||||||||||||
| CurrentTimeZone# | sint16 | read/write | Amount of time the unitary computer system is offset from Coordinated Universal Time (UTC). Unit: minutes CodeWarning. Changes the system: check with -WhatIf first. An elevated console is often required. | |||||||||||||||||||||||||||||||||||||||||||||
| DaylightInEffect# | boolean | read | If True, the daylight savings mode is ON. Code | |||||||||||||||||||||||||||||||||||||||||||||
| Description# | string | read | Description of the object. Code | |||||||||||||||||||||||||||||||||||||||||||||
| DNSHostName# | string | read | Name of local computer according to the domain name server (DNS). Code | |||||||||||||||||||||||||||||||||||||||||||||
| Domain# | string | read | Name of the domain to which a computer belongs. Note: If the computer is not part of a domain, then the name of the workgroup is returned. Code | |||||||||||||||||||||||||||||||||||||||||||||
| DomainRole# | uint16 | read | Role of a computer in an assigned domain workgroup. A domain workgroup is a collection of computers on the same network. For example, a DomainRole property may show that a computer is a member workstation. Values (6)
Code | |||||||||||||||||||||||||||||||||||||||||||||
| EnableDaylightSavingsTime# | boolean | read/write | Enables daylight savings time (DST) on a computer. A value of True indicates that the system time changes to an hour ahead or behind when DST starts or ends. A value of False indicates that the system time does not change to an hour ahead or behind when DST starts or ends. A value of NULL indicates that the DST status is unknown on a system. CodeWarning. Changes the system: check with -WhatIf first. An elevated console is often required. | |||||||||||||||||||||||||||||||||||||||||||||
| FrontPanelResetStatus# | uint16 | read | The following table lists the hardware security settings for the reset button on a computer. Values (4)
Code | |||||||||||||||||||||||||||||||||||||||||||||
| HypervisorPresent# | boolean | read | If True, a hypervisor is present. Windows Server 2008 R2, Windows 7, Windows Server 2008 and Windows Vista: This property is not supported before Windows 8 and Windows Server 2012. Code | |||||||||||||||||||||||||||||||||||||||||||||
| InfraredSupported# | boolean | read | If True, an infrared (IR) port exists on a computer system. Code | |||||||||||||||||||||||||||||||||||||||||||||
| InitialLoadInfo# | string[] | read | Data required to find the initial load device or boot service to request that the operating system start up. Windows Server 2008 R2: This property is available, but empty. Code | |||||||||||||||||||||||||||||||||||||||||||||
| InstallDate# | datetime | read | Object is installed. An object does not need a value to indicate that it is installed. Code | |||||||||||||||||||||||||||||||||||||||||||||
| KeyboardPasswordStatus# | uint16 | read | System hardware security settings for Keyboard Password Status. Values (4)
Code | |||||||||||||||||||||||||||||||||||||||||||||
| LastLoadInfo# | string | read | Array entry of the InitialLoadInfo property that contains the data to start the loaded operating system. Code | |||||||||||||||||||||||||||||||||||||||||||||
| Manufacturer# | string | read | Name of a computer manufacturer. Example: Adventure Works Code | |||||||||||||||||||||||||||||||||||||||||||||
| Model# | string | read | Product name that a manufacturer gives to a computer. This property must have a value. Code | |||||||||||||||||||||||||||||||||||||||||||||
| Name# key | string | read | Key of a CIM_System instance in an enterprise environment. Code | |||||||||||||||||||||||||||||||||||||||||||||
| NameFormat# | string | read | Computer system Name value that is generated automatically. The CIM_ComputerSystem object and its derivatives are top-level objects of the Common Information Model (CIM). They provide the scope for several components. Unique CIM_System keys are required, but you can define a heuristic to create the CIM_ComputerSystem name that generates the same name, and is independent from the discovery protocol. This prevents inventory and management problems when the same asset or entity is discovered multiple times, but cannot be resolved to one object. Using a heuristic is recommended, but not required. The heuristic is outlined in the CIM V2 Common Model specification, and assumes that the documented rules are used to determine and assign a name. The NameFormat values list defines the order to assign a computer system name. Several rules map to the same value. The CIM_ComputerSystem Name value that is calculated using the heuristic is the key value of the system. However, use aliases to assign a different name for CIM_ComputerSystem, which can be more unique to your company. Values include the following: Values (14)
Code | |||||||||||||||||||||||||||||||||||||||||||||
| NetworkServerModeEnabled# | boolean | read | If True, the network Server Mode is enabled. Code | |||||||||||||||||||||||||||||||||||||||||||||
| NumberOfLogicalProcessors# | uint32 | read | Number of logical processors available on the computer. You can use NumberOfLogicalProcessors and NumberOfProcessors to determine if the computer is hyperthreading. For more information, see Remarks. Code | |||||||||||||||||||||||||||||||||||||||||||||
| NumberOfProcessors# | uint32 | read | Number of physical processors currently available on a system. This is the number of enabled processors for a system, which does not include the disabled processors. If a computer system has two physical processors each containing two logical processors, then the value of NumberOfProcessors is 2 and NumberOfLogicalProcessors is 4. The processors may be multicore or they may be hyperthreading processors. For more information, see Remarks. Code | |||||||||||||||||||||||||||||||||||||||||||||
| OEMLogoBitmap# | uint8[] | read | List of data for a bitmap that the original equipment manufacturer (OEM) creates. Code | |||||||||||||||||||||||||||||||||||||||||||||
| OEMStringArray# | string[] | read | List of free-form strings that an OEM defines. For example, an OEM defines the part numbers for system reference documents, manufacturer contact information, and so on. Code | |||||||||||||||||||||||||||||||||||||||||||||
| PartOfDomain# | boolean | read | If True, the computer is part of a domain. If the value is NULL, the computer is not in a domain or the status is unknown. If you remove the computer from a domain, the value becomes false. Code | |||||||||||||||||||||||||||||||||||||||||||||
| PauseAfterReset# | sint64 | read | Time delay before a reboot is initiated in milliseconds. It is used after a system power cycle, local or remote system reset, and automatic system reset. A value of 1 (minus one) indicates that the pause value is unknown. Windows Vista: This property may return an unknown number. Unit: milliseconds Code | |||||||||||||||||||||||||||||||||||||||||||||
| PCSystemType# | uint16 | read | Type of the computer in use, such as laptop, desktop, or Tablet. Values (9)
Code | |||||||||||||||||||||||||||||||||||||||||||||
| PCSystemTypeEx# | uint16 | read | Type of the computer in use, such as laptop, desktop, or Tablet. Windows Server 2012, Windows 8, Windows Server 2008 R2, Windows 7, Windows Server 2008 and Windows Vista: This property is not supported before Windows 8.1 and Windows Server 2012 R2. Values (10)
Code | |||||||||||||||||||||||||||||||||||||||||||||
| PowerManagementCapabilities# | uint16[] | read | Array of the specific power-related capabilities of a logical device. Values (8)
Code | |||||||||||||||||||||||||||||||||||||||||||||
| PowerManagementSupported# | boolean | read | If True, device can be power-managed, for example, a device can be put into suspend mode, and so on. This property does not indicate that power management features are enabled currently, but it does indicate that the logical device is capable of power management. Code | |||||||||||||||||||||||||||||||||||||||||||||
| PowerOnPasswordStatus# | uint16 | read | System hardware security settings for Power-On Password Status. Values (4)
Code | |||||||||||||||||||||||||||||||||||||||||||||
| PowerState# | uint16 | read | Current power state of a computer and its associated operating system. The power saving states have the following values: Value 4 (Unknown) indicates that the system is known to be in a power save mode, but its exact status in this mode is unknown; 2 (Low Power Mode) indicates that the system is in a power save state, but still functioning and may exhibit degraded performance; 3 (Standby) indicates that the system is not functioning, but could be brought to full power quickly; and 7 (Warning) indicates that the computer system is in a warning state and a power save mode. Values (10)
Code | |||||||||||||||||||||||||||||||||||||||||||||
| PowerSupplyState# | uint16 | read | State of the power supply or supplies when last booted. This value comes from the Power Supply State member of the System Enclosure or Chassis structure in the SMBIOS information. The following list identifies the values for this property. Values (6)
Code | |||||||||||||||||||||||||||||||||||||||||||||
| PrimaryOwnerContact# | string | read | Contact information for the primary system owner, for example, phone number, email address, and so on. Code | |||||||||||||||||||||||||||||||||||||||||||||
| PrimaryOwnerName# | string | read | Name of the primary system owner. Code | |||||||||||||||||||||||||||||||||||||||||||||
| ResetCapability# | uint16 | read | If enabled, the value is 4 and the unitary computer system can be reset using the power and reset buttons. If disabled, the value is 3, and a reset is not allowed. Values (5)
Code | |||||||||||||||||||||||||||||||||||||||||||||
| ResetCount# | sint16 | read | Number of automatic resets since the last reset. A value of 1 (minus one) indicates that the count is unknown. Code | |||||||||||||||||||||||||||||||||||||||||||||
| ResetLimit# | sint16 | read | Number of consecutive times a system reset is attempted. A value of 1 (minus one) indicates that the limit is unknown. Code | |||||||||||||||||||||||||||||||||||||||||||||
| Roles# | string[] | read/write | List that specifies the roles of a system in the information technology environment. CodeWarning. Changes the system: check with -WhatIf first. An elevated console is often required. | |||||||||||||||||||||||||||||||||||||||||||||
| Status# | string | read | Current status of an object. For Win32_ComputerSystem, the Status is always “OK”. Code | |||||||||||||||||||||||||||||||||||||||||||||
| SupportContactDescription# | string[] | read | List of the support contact information for the Windows operating system. Code | |||||||||||||||||||||||||||||||||||||||||||||
| SystemFamily# | string | read | The family to which a particular computer belongs. A family refers to a set of computers that are similar but not identical from a hardware or software point of view. This value comes from the Family member of the System Information structure in the SMBIOS information. Windows Server 2012 R2, Windows 8.1, Windows Server 2012, Windows 8, Windows Server 2008 R2, Windows 7, Windows Server 2008 and Windows Vista: This property is not supported before Windows 10 and Windows Server 2016. Code | |||||||||||||||||||||||||||||||||||||||||||||
| SystemSKUNumber# | string | read | Identifies a particular computer configuration for sale. It is sometimes also called a product ID or purchase order number. This value comes from the SKU Number member of the System Information structure in the SMBIOS information. Windows Server 2012 R2, Windows 8.1, Windows Server 2012, Windows 8, Windows Server 2008 R2, Windows 7, Windows Server 2008 and Windows Vista: This property is not supported before Windows 10 and Windows Server 2016. Code | |||||||||||||||||||||||||||||||||||||||||||||
| SystemStartupDelay# | uint16 | read/write | SystemStartupDelay is no longer available for use because Boot.ini is not used to configure system startup. Instead, use the BCD classes supplied by the Boot Configuration Data (BCD) WMI provider or the Bcdedit command. Unit: seconds CodeWarning. Changes the system: check with -WhatIf first. An elevated console is often required. | |||||||||||||||||||||||||||||||||||||||||||||
| SystemStartupOptions# | string[] | read/write | SystemStartupOptions is no longer available for use because Boot.ini is not used to configure system startup. Instead, use the BCD classes supplied by the Boot Configuration Data (BCD) WMI provider or the Bcdedit command. CodeWarning. Changes the system: check with -WhatIf first. An elevated console is often required. | |||||||||||||||||||||||||||||||||||||||||||||
| SystemStartupSetting# | uint8 | read/write | SystemStartupSetting is no longer available for use because Boot.ini is not used to configure system startup. Instead, use the BCD classes supplied by the Boot Configuration Data (BCD) WMI provider or the Bcdedit command. CodeWarning. Changes the system: check with -WhatIf first. An elevated console is often required. | |||||||||||||||||||||||||||||||||||||||||||||
| SystemType# | string | read | System running on the Windows-based computer. This property must have a value. The following list identifies some of the possible values for this property. "x64-based PC" "X86-based PC" "MIPS-based PC" "Alpha-based PC" "Power PC" "SH-x PC" "StrongARM PC" "64-bit Intel PC" "64-bit Alpha PC" "Unknown" "X86-Nec98 PC" Values (10)
Code | |||||||||||||||||||||||||||||||||||||||||||||
| ThermalState# | uint16 | read | Thermal state of the system when last booted. This value comes from the Thermal State member of the System Enclosure or Chassis structure in the SMBIOS information. Values (6)
Code | |||||||||||||||||||||||||||||||||||||||||||||
| TotalPhysicalMemory# | uint64 | read | Total size of physical memory. Be aware that, under some circumstances, this property may not return an accurate value for the physical memory. For example, it is not accurate if the BIOS is using some of the physical memory. For an accurate value, use the Capacity property in Win32_PhysicalMemory instead. Example: 67108864 For more information about using uint64 values in scripts, see Scripting in WMI. Unit: bytes Code | |||||||||||||||||||||||||||||||||||||||||||||
| UserName# | string | read | Name of a user that is logged on currently. This property must have a value. In a terminal services session, UserName returns the name of the user that is logged on to the console not the user logged on during the terminal service session. Example: jeffsmith Code | |||||||||||||||||||||||||||||||||||||||||||||
| WakeUpType# | uint16 | read | Event that causes the system to power up. This value comes from the Wake-up Type member of the System Information structure in the SMBIOS information. Values (9)
Code | |||||||||||||||||||||||||||||||||||||||||||||
| Workgroup# | string | read/write | Name of the workgroup for this computer. If the value of the PartOfDomain property is False, then the name of the workgroup is returned. CodeWarning. Changes the system: check with -WhatIf first. An elevated console is often required. |
Methods
JoinDomainOrWorkgroup #
Adds a computer system to a domain or workgroup.
uint32 JoinDomainOrWorkgroup(
[in] string Name,
[in] string Password,
[in] string UserName,
[in] string AccountOU,
[in] uint32 FJoinOptions
);Parameters
| Parameter | Type | Direction | Description |
|---|---|---|---|
| Name | string | in | Specifies the domain or workgroup to join. Cannot be NULL. |
| Password | string | in | If the *UserName* parameter specifies an account name, the *Password* parameter must point to the password to use when connecting to the domain controller. Otherwise, this parameter must be NULL. |
| UserName | string | in | Pointer to a constant null-terminated character string that specifies the account name to use when connecting to the domain controller. Must specify a domain NetBIOS name and user account, for example, Domain\user. If this parameter is NULL, the caller information is used. You can also use the user principal name (UPPED) in the form user@domain. |
| AccountOU | string | in | Specifies the pointer to a constant null-terminated character string that contains the RFC 1779 format name of the organizational unit (OU) for the computer account. If you specify this parameter, the string must contain a full path, otherwise *Accent* must be NULL. Example: "OU=testOU; DC=domain; DC=Domain; DC=com" |
| FJoinOptions | uint32 | in | Set of bit flags that define the join options. (0) Default. No join options. |
Return values
| Value | Label | Description |
|---|---|---|
| 0 | Success | |
| 5 | Access is denied. | |
| 87 | The parameter is incorrect. | |
| 110 | The system cannot open the specified object. | |
| 1323 | Unable to update the password. | |
| 1326 | Logon failure: unknown username or bad password. | |
| 1355 | The specified domain either does not exist or could not be contacted. | |
| 2224 | The account already exists. | |
| 2691 | The machine is already joined to the domain. | |
| 2692 | The machine is not currently joined to a domain. | |
| 0x80041087 | WBEM_E_ENCRYPTED_CONNECTION_REQUIRED | *Password* and *UserName* are specified but the authentication level is not **RPC_C_AUTHN_LEVEL_PKT_PRIVACY**. For Visual Basic, **wbemErrEncryptedConnectionRequired** is returned. |
| 1..4294967295 | Other |
Call the JoinDomainOrWorkgroup 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_ComputerSystem
$methodParameters = @{
InputObject = $instance
MethodName = 'JoinDomainOrWorkgroup'
Arguments = @{
Name = 'Example'
Password = 'Example'
UserName = 'Example'
AccountOU = 'Example'
FJoinOptions = 1
}
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) {
$returnValueName = @{
0 = 'Success'
5 = 'Access is denied'
87 = 'The parameter is incorrect'
110 = 'The system cannot open the specified object'
1323 = 'Unable to update the password'
1326 = 'Logon failure: unknown username or bad password'
1355 = 'The specified domain either does not exist or could not be…'
2224 = 'The account already exists'
2691 = 'The machine is already joined to the domain'
2692 = 'The machine is not currently joined to a domain'
2147750023 = 'WBEM_E_ENCRYPTED_CONNECTION_REQUIRED'
}
$returnValueName[[int]$result.ReturnValue]
}This method can change the system. The -WhatIf parameter shows the operation without running it: remove it only after checking.
Rename #
Renames a local computer.
uint32 Rename(
[in] string Name,
[in] string Password,
[in] string UserName
);Parameters
| Parameter | Type | Direction | Description |
|---|---|---|---|
| Name | string | in | New computer name. The value of this parameter cannot include control characters, leading or trailing spaces, or any of the following characters: / \\ [ ]. |
| Password | string | in | Password to use when connecting to the domain controller if the *UserName* parameter specifies an account name. Otherwise, this parameter must be NULL. See the Remarks section of this topic for more information about *Password* and *UserName* parameters. |
| UserName | string | in | String that specifies the account name to use when connecting to the domain controller. The string must be null-terminated, and must specify a domain NetBIOS name and user account for example, "DOMAINNAME\username" or "someone@domainname.com", which is a user principal name (UPN). If the UserName parameter is NULL, WMI uses the context of the caller. See the Remarks section of this topic for more information about *Password* and *UserName* parameters. |
Return values
| Value | Label | Description |
|---|---|---|
| 0 | Success | |
| 1..4294967295 | Other |
Call the Rename 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_ComputerSystem
$methodParameters = @{
InputObject = $instance
MethodName = 'Rename'
Arguments = @{
Name = 'Example'
Password = 'Example'
UserName = '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.
UnjoinDomainOrWorkgroup #
Removes a computer system from a domain or workgroup.
uint32 UnjoinDomainOrWorkgroup(
[in] string Password,
[in] string UserName,
[in] uint32 FUnjoinOptions
);Parameters
| Parameter | Type | Direction | Description |
|---|---|---|---|
| Password | string | in | If the *UserName* parameter specifies an account name, the *Password* parameter must point to the password to use when connecting to the domain controller. Otherwise, this parameter must be NULL. Note: *Password* must use a high authentication level, not less than RPC_C_AUTHN_LEVEL_PKT_PRIVACY, when connecting to Winmgmt or CoSetProxyBlanket on the IWbemServices pointer. If local to Winmgmt, this is not a concern. |
| UserName | string | in | Pointer to a constant null-terminated character string that specifies the account name to use when connecting to the domain controller. Must specify a domain and user account, for example, "domain\user" or "user@domain". If this parameter is NULL, the caller context is used. Note: *UserName* must use a high authentication level, not less than RPC_C_AUTHN_LEVEL_PKT_PRIVACY, when connecting to Winmgmt or CoSetProxyBlanket on the IWbemServices pointer. If local to Winmgmt, this is not a concern. |
| FUnjoinOptions | uint32 | in | Set of bit flags defining the unjoin options. (0) Default. No options. |
Return values
| Value | Label | Description |
|---|---|---|
| 0 | Success | |
| 1..4294967295 | Other |
Call the UnjoinDomainOrWorkgroup 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_ComputerSystem
$methodParameters = @{
InputObject = $instance
MethodName = 'UnjoinDomainOrWorkgroup'
Arguments = @{
Password = 'Example'
UserName = 'Example'
FUnjoinOptions = 4
}
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.
Declared but not implemented methods: SetPowerState.
Remarks
To determine the total number of processor instances associated with a computer system object, use the Win32_ComputerSystemProcessor association class.
A Win32_ComputerSystem instance that has multiple physical processors has multiple Win32_Processor instances associated with it. If the value of NumberOfLogicalProcessors is greater than the value of NumberOfProcessors then the computer system is either a multicore system or has one or more processors enabled for hyperthreading. For more information, see the NumberOfLogicalProcessors and NumberOfCores properties and Remarks section in Win32_Processor.
The Win32_ComputerSystem class is derived from CIM_UnitaryComputerSystem.
Inheritance
Superclass chain
- CIM_ManagedSystemElement
- CIM_LogicalElement
- CIM_System
- CIM_ComputerSystem
- CIM_UnitaryComputerSystem
- Win32_ComputerSystem
Known subclasses
No known subclass.
Requirements
- Namespace
- root/cimv2
- Minimum client
- Windows Vista
- Minimum server
- Windows Server 2008
- Provider
- CIMWin32
- MOF file
- CIMWin32.mof
- DLL
- CIMWin32.dll
Class qualifiers
Dynamic Provider("CIMWin32") SupportsUpdate UUID("{8502C4B0-5FBB-11D2-AAC1-006008C78BC7}") AMENDMENT
Microsoft source
Descriptions, properties and methods come from the Microsoft documentation (MicrosoftDocs/win32 repository), published under the CC BY 4.0 licence. Formatting and translations are specific to this site; the PowerShell examples are written for it.