Methods
CIM_ManagedSystemElement has no methods.
Properties
CIM_ManagedSystemElement returns 5 properties:
'Caption','Description','InstallDate','Name','Status'
Unless explicitly marked as WRITEABLE, all properties are read-only.
Caption
A short textual description of the object.
# returning class instances:
Get-CimInstance -ClassName CIM_ManagedSystemElement -Filter "" | Select-Object -Property Caption
# reading property value:
Get-CimInstance -ClassName CIM_ManagedSystemElement -Filter "" | Select-Object -Property Caption | Foreach-Object {
$Caption = $_.Caption
$value = $_.Caption
"${Caption}: Caption = $value"
}
Description
A textual description of the object.
# returning class instances:
Get-CimInstance -ClassName CIM_ManagedSystemElement -Filter "" | Select-Object -Property Description
# reading property value:
Get-CimInstance -ClassName CIM_ManagedSystemElement -Filter "" | Select-Object -Property Description | Foreach-Object {
$Caption = $_.Caption
$value = $_.Description
"${Caption}: Description = $value"
}
InstallDate
Indicates when the object was installed.
This property may be empty.
# returning class instances:
Get-CimInstance -ClassName CIM_ManagedSystemElement -Filter "" | Select-Object -Property InstallDate
# reading property value:
Get-CimInstance -ClassName CIM_ManagedSystemElement -Filter "" | Select-Object -Property InstallDate | Foreach-Object {
$Caption = $_.Caption
$value = $_.InstallDate
"${Caption}: InstallDate = $value"
}
Name
Label by which the object is known.
# returning class instances:
Get-CimInstance -ClassName CIM_ManagedSystemElement -Filter "" | Select-Object -Property Name
# reading property value:
Get-CimInstance -ClassName CIM_ManagedSystemElement -Filter "" | Select-Object -Property Name | Foreach-Object {
$Caption = $_.Caption
$value = $_.Name
"${Caption}: Name = $value"
}
Status
Current status of an object. Various operational and nonoperational statuses can be defined.
Available values:
'Degraded','Error','Lost Comm','No Contact','NonRecover','OK','Pred Fail','Service','Starting','Stopping','Stressed','Unknown'
# returning class instances:
Get-CimInstance -ClassName CIM_ManagedSystemElement -Filter "" | Select-Object -Property Status
# reading property value:
Get-CimInstance -ClassName CIM_ManagedSystemElement -Filter "" | Select-Object -Property Status | Foreach-Object {
$Caption = $_.Caption
$value = $_.Status
"${Caption}: Status = $value"
}
CDXML Definition
You can turn this WMI class and its methods into PowerShell cmdlets by importing below CDXML file (Cmdlet Definition XML) as a module.
Create CIM_ManagedSystemElement.cdxml
$folder = "c:\wmi\CIM_ManagedSystemElement"
$cdxmlPath = Join-Path -Path $folder -ChildPath "CIM_ManagedSystemElement.cdxml"
# create folder if not present:
$exists = Test-Path -Path $folder
if (!$exists) { $null = New-Item -Path $folder -ItemType Directory }
# write file
$content = @'
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is licensed under 'Attribution 4.0 International' license (https://creativecommons.org/licenses/by/4.0/).
You can free of charge use this code in commercial and non-commercial code, and you can freely modify and adjust the code
as long as you give appropriate credit to the original author Dr. Tobias Weltner.
This material was published and is maintained here:
https://powershell.one/wmi/root/cimv2/cim_managedsystemelement#cdxml-definition
-->
<PowerShellMetadata xmlns="http://schemas.microsoft.com/cmdlets-over-objects/2009/11">
<!--referencing the WMI class this cdxml uses-->
<Class ClassName="Root/CIMV2\CIM_ManagedSystemElement" ClassVersion="2.0">
<Version>1.0</Version>
<!--default noun used by Get-cmdlets and when no other noun is specified. By convention, we use the prefix "WMI" and the base name of the WMI class involved. This way, you can easily identify the underlying WMI class.-->
<DefaultNoun>WmiManagedSystemElement</DefaultNoun>
<!--define the cmdlets that work with class instances.-->
<InstanceCmdlets>
<!--query parameters to select instances. This is typically empty for classes that provide only one instance-->
<GetCmdletParameters />
<GetCmdlet>
<CmdletMetadata Verb="Get" />
<GetCmdletParameters>
<QueryableProperties>
<Property PropertyName="Description">
<Type PSType="system.string" />
<RegularQuery AllowGlobbing="true">
<CmdletParameterMetadata IsMandatory="false" />
</RegularQuery>
</Property>
<Property PropertyName="InstallDate">
<Type PSType="system.datetime" />
<MinValueQuery>
<CmdletParameterMetadata PSName="BeforeInstallDate" />
</MinValueQuery>
<MaxValueQuery>
<CmdletParameterMetadata PSName="AfterInstallDate" />
</MaxValueQuery>
</Property>
<Property PropertyName="Name">
<Type PSType="system.string" />
<RegularQuery AllowGlobbing="true">
<CmdletParameterMetadata IsMandatory="false" />
</RegularQuery>
</Property>
<Property PropertyName="Status">
<Type PSType="system.string" />
<RegularQuery AllowGlobbing="true">
<CmdletParameterMetadata IsMandatory="false" />
</RegularQuery>
</Property>
</QueryableProperties>
</GetCmdletParameters>
</GetCmdlet>
<!--defining additional cmdlets that modifies instance properties-->
</InstanceCmdlets>
</Class>
</PowerShellMetadata>
'@ | Set-Content -LiteralPath $cdxmlPath -Encoding UTF8
# import module
Import-Module -Name $cdxmlPath -Force -Verbose
# list new cmdlets
Get-Command -Module "CIM_ManagedSystemElement"
See here for more information on CDXML and CDXML-based PowerShell modules.
Requirements
To use CIM_ManagedSystemElement, the following requirements apply:
PowerShell
Get-CimInstance
was introduced with PowerShell Version 3.0, which in turn was introduced on clients with Windows 8 and on servers with Windows Server 2012.
If necessary, update Windows PowerShell to Windows PowerShell 5.1, or install PowerShell 7 side-by-side.
Operating System
CIM_ManagedSystemElement was introduced on clients with Windows Vista and on servers with Windows Server 2008.
Namespace
CIM_ManagedSystemElement lives in the namespace root/cimv2. This is the default namespace. There is no need to use the -Namespace parameter in Get-CimInstance
.
Implementation
CIM_ManagedSystemElement is implemented in CIMWin32.dll and defined in CIMWin32.mof. Both files are located in the folder C:\Windows\system32\wbem
:
explorer $env:windir\system32\wbem
notepad $env:windir\system32\wbem\CIMWin32.mof