Main example
List instances
# All instances of Win32_Desktop, with the main properties
Get-CimInstance -ClassName Win32_Desktop |
Select-Object -Property Name, Description, BorderWidth, CaptionExamples
Filter with WQL
# WQL filter evaluated by the provider: only the instances where CoolSwitch is TRUE
Get-CimInstance -ClassName Win32_Desktop -Filter 'CoolSwitch = TRUE' |
Select-Object -Property Name, Description, BorderWidth, CaptionThe filter is evaluated by the WMI provider: less data is transferred than with Where-Object.
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_Desktop |
Select-Object -Property Name, Description, BorderWidth, Caption
} 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_Desktop
$cimClass.CimClassProperties |
Select-Object -Property Name, CimType, FlagsProperties
| Name | Type | Access | Description |
|---|---|---|---|
| BorderWidth# | uint32 | read | Width of the borders around all windows with adjustable borders. Example: 3 Code |
| Caption# | string | read | Short textual description of the current object. Code |
| CoolSwitch# | boolean | read | Fast task switching is turned on. Fast task switching allows the user to switch between windows using the ALT+TAB keyboard combination. Code |
| CursorBlinkRate# | uint32 | read | Length of time between successive cursor blinks. Example: 530 Unit: milliseconds Code |
| Description# | string | read | Textual description of the current object. Code |
| DragFullWindows# | boolean | read | Contents of a window are shown when a user moves the window. Code |
| GridGranularity# | uint32 | read | Spacing of the grid that windows are bound to on the desktop. This makes organizing windows easier. The spacing is usually fine enough that the user does not notice it. Example: 1 Unit: 8 pixels Code |
| IconSpacing# | uint32 | read | Spacing between icons. Example: 75 Unit: pixels Code |
| IconTitleFaceName# | string | read | Font used for the names of the icons. Example: "MS San Serif" Code |
| IconTitleSize# | uint32 | read | Icon font size. Example: 9 Unit: point Code |
| IconTitleWrap# | boolean | read | Icon's title text wraps to the next line. Code |
| Name# key | string | read | Name that identifies the current desktop profile. Example: "MainProf" Code |
| Pattern# | string | read | Name of the pattern used as the background for the desktop. Code |
| ScreenSaverActive# | boolean | read | Screen saver is active. Code |
| ScreenSaverExecutable# | string | read | Name of the current screen saver executable file. Example: "LOGON.SCR" Code |
| ScreenSaverSecure# | boolean | read | Password is enabled for the screen saver. Code |
| ScreenSaverTimeout# | uint32 | read | Amount of time that passes before the screen saver starts. Unit: seconds Code |
| SettingID# | string | read | Identifier by which the current object is known. Code |
| Wallpaper# | string | read | File name for the wallpaper design on the background of the desktop. Example: "WINNT.BMP" Code |
| WallpaperStretched# | boolean | read | Wallpaper is stretched to fill the entire screen. Microsoft Plus! must be installed before this option is available. If FALSE, the wallpaper retains its original dimensions on the desktop background. Code |
| WallpaperTiled# | boolean | read | Wallpaper is tiled or centered. Code |
Remarks
The Win32_Desktop class is derived from CIM_Setting.
The calling process that uses this class must have the SE_RESTORE_NAME privilege on the computer in which the registry resides. For example, if you enumerate this class on the local computer, the account under which your application runs must have this privilege. For more information, see Executing Privileged Operations.
Inheritance
Superclass chain
- CIM_Setting
- Win32_Desktop
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") Privileges("SeRestorePrivilege") UUID("{8502C4E3-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.