-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Description
Every time we query a CIM Instance we get Datafileds which are Numeric.
With this Numeric Values the datafields are not Human friendly and therefore needles in many cases. (eg. Asset Inventory databases)
A Human has to translate a Status Information by Hand every time.
These Numeric Values can be automatically translated into a Human friendly Text with the help of the amended (verbose) informations in a CimClass for each Property and the Qualifiers ValueMap to Values and BitMap To BitValues.
For that purpose Get-WmiObject had the -Amended Parameter.
Get-CimClass is lacking this parameter and therefore we can not get Amended Informations (on windows Systems that are not installed in en-US environment).
I followed the #PStip on PowerShellMagazin and this did not worked for me because there is simply no amended Data in a CimClass on my System with German de-DE setup. Does this works on Systems with en-US Setup?
Only if I call CimSession.GetClass() with the CimOperationOptions Flag LocalizedQualifiers
I get a CimClass with amended Data in en-US language or de-DE. Depending on my choice.
Currently I pull amended CimClasses with Get-WmiObject or with the help of a CimSession like so:
Function Get-CimClassAmended {
[CmdletBinding()]
param(
[String[]]$Classname,
[String]$NameSpace = 'root\cimv2',
[System.Globalization.CultureInfo]$Culture = [System.Globalization.CultureInfo]'en-US'
)
begin {
$AmendedDcomCIMSessionOption = New-CimSessionOption -Protocol 'Dcom' -UICulture $Culture -Culture $Culture
$AmendedDcomCIMSessionOption.Impersonation = [Microsoft.Management.Infrastructure.Options.ImpersonationType]::Impersonate
$AmendedDcomCimSession = New-CimSession -SessionOption $AmendedDcomCIMSessionOption
$AmendedDcomCimOperationSessionOptions = New-Object -TypeName 'Microsoft.Management.Infrastructure.Options.CimOperationOptions'
$AmendedDcomCimOperationSessionOptions.Flags = [Microsoft.Management.Infrastructure.Options.CimOperationFlags]::LocalizedQualifiers
}
process {
ForEach ($ClassN in $Classname) {
Try {
# return the CIM class with amended (verbose) informations
Write-Output $AmendedDcomCimSession.GetClass($Namespace, $ClassN, $AmendedDcomCimOperationSessionOptions)
}
Catch {
Write-Error -ErrorRecord $_
}
}
}
}I only have skills with PowerShell and I am not a .NET developer.
So please Add -Amended Parameter to Get-CimClass
seems very easy.....