In windows 8.1 English OS/64-bit PC logged on with Microsoft Account When i execute the above command the User name format will be as follows //
In windows 8.1 Japanese OS/64-bit PC logged on with Microsoft Account When i execute the above command the User name format will be as follows /
Note: System Name: lenovo-PC DomainName: LENOVO-PC UserName: TestAccount
Why it is returning different format in the different environment PC?
My logic is failing to get the token for the current logged in User.
The Win32_ComputerSystem WMI class represents a computer system running Windows.
The following syntax is simplified from Managed Object Format (MOF) code and includes all of the inherited properties.
Syntax
Members
The Win32_ComputerSystem class has these types of members:
Methods
The Win32_ComputerSystem class has these methods.
| Method | Description |
|---|---|
| JoinDomainOrWorkgroup | Adds a computer system to a domain or workgroup. |
| Rename | Renames a local computer. |
| SetPowerState | Not implemented. For more information about how to implement this method, see the SetPowerState method in CIM_UnitaryComputerSystem. |
| UnjoinDomainOrWorkgroup | Removes a computer system from a domain or workgroup. |
Properties
The Win32_ComputerSystem class has these properties.
AdminPasswordStatus
Data type: uint16
Access type: Read-only
Qualifiers: MappingStrings («SMBIOS|Type 24|Hardware Security Settings|AdminPasswordStatus»)
System hardware security settings for administrator password status.
Disabled (0)
Enabled (1)
Not Implemented (2)
Unknown (3)
AutomaticManagedPagefile
Data type: boolean
Access type: Read/write
If True, the system manages the page file.
AutomaticResetBootOption
Data type: boolean
Access type: Read/write
If True, the automatic reset boot option is enabled.
AutomaticResetCapability
Data type: boolean
Access type: Read-only
If True, the automatic reset is enabled.
BootOptionOnLimit
Data type: uint16
Access type: Read-only
Qualifiers: MappingStrings («SMBIOS|Type 23|Capabilites|Boot Option on Limit»)
Boot option limit is ON. Identifies the system action when the ResetLimit value is reached.
Reserved (0)
Operating system (1)
System utilities (2)
Do not reboot (3)
BootOptionOnWatchDog
Data type: uint16
Access type: Read-only
Qualifiers: MappingStrings («SMBIOS|Type 23|Capabilities|Boot Option»)
Type of reboot action after the time on the watchdog timer is elapsed.
Reserved (0)
Operating system (1)
System utilities (2)
Do not reboot (3)
BootROMSupported
Data type: boolean
Access type: Read-only
If True, indicates whether a boot ROM is supported.
BootStatus
Data type: uint16 array
Access type: Read-only
Qualifiers: MappingStrings («SMBIOS|Type 32|System Boot Information|Boot Status»)
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.
BootupState
Data type: string
Access type: Read-only
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»
Normal boot («Normal boot»)
Fail-safe boot («Fail-safe boot»)
Fail-safe with network boot («Fail-safe with network boot»)
Caption
Data type: string
Access type: Read-only
Short description of the object a one-line string.
ChassisBootupState
Data type: uint16
Access type: Read-only
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.
Other (1)
Unknown (2)
Safe (3)
Warning (4)
Critical (5)
Non-recoverable (6)
ChassisSKUNumber
Data type: string
Access type: Read-only
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.
CreationClassName
Data type: string
Access type: Read-only
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.
This property is inherited from CIM_System.
CurrentTimeZone
Data type: sint16
Access type: Read/write
Amount of time the unitary computer system is offset from Coordinated Universal Time (UTC).
DaylightInEffect
Data type: boolean
Access type: Read-only
If True, the daylight savings mode is ON.
Description
Data type: string
Access type: Read-only
Description of the object.
DNSHostName
Data type: string
Access type: Read-only
Name of local computer according to the domain name server (DNS).
Domain
Data type: string
Access type: Read-only
Name of the domain to which a computer belongs.
If the computer is not part of a domain, then the name of the workgroup is returned.
DomainRole
Data type: uint16
Access type: Read-only
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.
Standalone Workstation (0)
Member Workstation (1)
Standalone Server (2)
Member Server (3)
Backup Domain Controller (4)
Primary Domain Controller (5)
EnableDaylightSavingsTime
Data type: boolean
Access type: 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.
FrontPanelResetStatus
Data type: uint16
Access type: Read-only
Qualifiers: MappingStrings («SMBIOS|Type 24|Hardware Security Settings|FrontPanelResetStatus»)
The following table lists the hardware security settings for the reset button on a computer.
Disabled (0)
Enabled (1)
Not Implemented (2)
Unknown (3)
HypervisorPresent
Data type: boolean
Access type: Read-only
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.
InfraredSupported
Data type: boolean
Access type: Read-only
If True, an infrared (IR) port exists on a computer system.
InitialLoadInfo
Data type: string array
Access type: Read-only
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.
InstallDate
Data type: datetime
Access type: Read-only
Object is installed. An object does not need a value to indicate that it is installed.
KeyboardPasswordStatus
Data type: uint16
Access type: Read-only
Qualifiers: MappingStrings («SMBIOS|Type 24|Hardware Security Settings|KeyboardPasswordStatus»)
System hardware security settings for Keyboard Password Status.
Disabled (0)
Enabled (1)
Not Implemented (2)
Unknown (3)
LastLoadInfo
Data type: string
Access type: Read-only
Array entry of the InitialLoadInfo property that contains the data to start the loaded operating system.
Manufacturer
Data type: string
Access type: Read-only
Qualifiers: MappingStrings («SMBIOS|Type 1|System Information|Manufacturer»)
Name of a computer manufacturer.
Example: Adventure Works
Model
Data type: string
Access type: Read-only
Qualifiers: MappingStrings («SMBIOS|Type 1|System Information|Product Name»)
Product name that a manufacturer gives to a computer. This property must have a value.
Name
Data type: string
Access type: Read-only
Key of a CIM_System instance in an enterprise environment.
NameFormat
Data type: string
Access type: Read-only
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.
This property is inherited from CIM_System.
Сетевые заметки системного администратора
Get-WmiObject — самый важный командлет для общих задач управления системой. Все ключевые настройки подсистемы доступны через службу WMI. Более того, служба WMI обрабатывает данные как объекты, сгруппированные в коллекции из одного или нескольких элементов. Поскольку оболочка Windows PowerShell также работает с объектами, в ней имеется конвейер, позволяющий одинаково обрабатывать отдельный объект или несколько объектов, общий доступ к службе WMI предоставляет возможность выполнять некоторые сложные задачи с небольшими затратами усилий.
В следующем примере показано, как собрать определенные сведения, применяя командлет Get-WmiObject к произвольному компьютеру. Значение параметра ComputerName задается точкой ., представляющей локальный компьютер. Здесь можно указать имя или IP-адрес, связанные с любым компьютером, к которому требуется получить доступ через службу WMI. Чтобы получить сведения о локальном компьютере, параметр -ComputerName. можно опустить.
Вывод настроек рабочего стола
Для начала рассмотрим команду, собирающую сведения о рабочих столах локального компьютера: