Can I get class property *descriptions* in a powershell script

Copper Contributor

I want to query: 

The MSFT_MpComputerStatus to get the description of AMEngineVersion

- The AM Engine version (major, minor, build, revision)

or equivalent

 

I want to get the description of the property in my script.

Here is the list of properties: https://learn.microsoft.com/en-us/previous-versions/windows/desktop/defender/msft-mpcomputerstatus#p...

 

 

 

3 Replies

hHi @nilanjenator 


Get-CimInstance -ClassName MSFT_MpComputerStatus -Namespace root/microsoft/windows/defender -Property *

 

AndresBohren_0-1713390597093.png

 

 

Kind Regards

Andres 

Hi Andres,
That doesn't show the description. What I am trying to do is I don't want to copy each description on the web page.
Thanks

@nilanjenator 

 

Hi, Nilan-jan.

 

For the benefit of others and to set the context correctly, by class, we're talking about WMI "classes" here, not .NET classes - which is what PowerShell frequently refers to. There are no descriptions for .NET classes or their members, in case you were wondering.

 

With that out of the way, the description qualifier - be that from the class or the class' members - is far more miss than hit as it's rarely defined. This holds true for MSFT_MpComputerStatus, where the Description qualifier is not defined (on the class or the members).

 

So, the short answer to your question is: you cannot pull the description for each class member of the MSFT_MpComputerStatus class as no descriptions exist.

 

Still, we can look at the "how" by looking at this class as well as another that does feature descriptions, as that might help you in the future should you find yourself working with a provider that has populated the description qualifier.

 

Class description

First, let's look at an example where the Description qualifier has been populated on the class definition.

 

LainRobertson_0-1713414746147.png

 

And now let's compare that to MSFT_MpComputerStatus, where we can see we get a $null back when we try asking for the Description  qualifier:

 

LainRobertson_1-1713414940613.png

 

Class member description

The approach is the same for members - we're just stepping down one level.

 

Here, we can see that a Description qualifier has been set on the WorkOffline property:

 

LainRobertson_2-1713415255731.png

 

While for the MSFT_MpComputerStatus class, we can see (I've trimmed the screenshot to show just the first property) that Description has not been defined (only a qualifier named "read" has been defined):

 

LainRobertson_3-1713415429545.png

 

So, if we ask for it, we'll only get back a $null value:

 

LainRobertson_4-1713415575168.png

 

Hopefully that helps you navigate WMI classes more broadly, despite the inability to achieve what you're after with MSFT_MpComputerStatus.

 

Cheers,

Lain