PowerTip: Easily Find WMI Class Schema Information with PowerShell

PowerTip: Easily Find WMI Class Schema Information with PowerShell

  • Comments 4
  • Likes

Summary: Use a one-line command to obtain WMI class schema (MOF) information.

Hey, Scripting Guy! Question How can I use Windows PowerShell to display the MOF of a WMI class?

Hey, Scripting Guy! Answer Use the WMIClass type accelerator, and then call the static GetText method whilst supplying the word MOF:

            ([wmiclass]"Win32_Pingstatus").gettext("MOF")

Your comment has been posted.   Close
Thank you, your comment requires moderation so it may take a while to appear.   Close
Leave a Comment
  • @ed  - good tip for investigating class structures

    Don't forget that we can turn the MOF into an Object so it is easier to create reports or other objects.

    #WMI format

    [xml]$wmidtd=(([wmiclass]"Win32_Pingstatus").gettext('WMIDtd20'))

    $wmidtd.Class

    #Cim fromat

    [xml]$Cimdtd=(([wmiclass]"Win32_Pingstatus").gettext('CimDtd20'))

    $cimdtd.Class

  • @JRV this is a really cool tip and it makes it easy to work with as well. Very nice!

  • @Ed - I thought you might like it.  It dovetails with your other XML articles.

  • @JRV indeed it does, like I said, "way cool"