retrieving wmi class mof information

this powershell powertip is SO cool i just had to repeat it.

using the wmiclass type accelerator, you can use a method called gettext to pull down the mof. so using their example, the following command is issued:

([wmiclass]"win32_pingstatus").GetText("MOF")

 

from that, we receive the following information:

[dynamic: ToInstance, provider("WMIPingProvider"): ToInstance]
class Win32_PingStatus
{
    [read: ToSubClass, key] String Address;
    [read: ToSubClass, key] uint32 TimeToLive = 80;
    [read: ToSubClass, key] uint32 Timeout = 4000;
    [read: ToSubClass, key] uint32 BufferSize = 32;
    [read: ToSubClass, key] boolean NoFragmentation = FALSE;
    [read: ToSubClass, key] uint32 TypeofService = 0;
    [read: ToSubClass, key] uint32 RecordRoute = 0;
    [read: ToSubClass, key] uint32 TimestampRoute = 0;
    [read: ToSubClass, key, ValueMap{"0", "1", "2"}: ToSubClass] uint32 SourceRouteType = 0;
    [read: ToSubClass, key] String SourceRoute = "";
    [read: ToSubClass, key] boolean ResolveAddressNames = FALSE;
    [read: ToSubClass, ValueMap{"0", "11001", "11002", "11003", "11004", "11005", "11006", "11007", "11008", "11009", "11010", "11011", "11012"
, "11013", "11014", "11015", "11016", "11017", "11018", "11032", "11050"}: ToSubClass] uint32 StatusCode;
    [read: ToSubClass] uint32 ResponseTime;
    [read: ToSubClass] uint32 ResponseTimeToLive;
    [read: ToSubClass] boolean ReplyInconsistency;
    [read: ToSubClass] uint32 ReplySize;
    [read: ToSubClass] String RouteRecord[];
    [read: ToSubClass] String RouteRecordResolved[];
    [read: ToSubClass] uint32 TimeStampRecord[];
    [read: ToSubClass] string TimeStampRecordAddress[];
    [read: ToSubClass] string TimeStampRecordAddressResolved[];
    [read: ToSubClass, MaxLen(4096): ToSubClass] String ProtocolAddress = "";
    [read: ToSubClass, MaxLen(4096): ToSubClass] String ProtocolAddressResolved = "";
    [read: ToSubClass, ValueMap{"0", ".."}: ToSubClass] uint32 PrimaryAddressResolutionStatus;
};

 

how cool is that?! thanks scripting guy (ed)! btw, here’s his article.

Comments