Get-Pingstatus Expandproperty Statuscode

Jul 23, 2012 at 12:25 PM
Edited Jul 23, 2012 at 1:30 PM

Hi Kirk,

with Get-Pingstatus I receive the statuscode.

I want to ask if it is possible to "expand" the property (in this case it is a codeproperty) statuscode to receive the human readable meaning of the value.


Destination Net Unreachable


Destination Host Unreachable


Destination Protocol Unreachable

Unfortunately I did not find a possibility to do this

PS C:\Windows\system32> $c.StatusCode
PS C:\Windows\system32> $c.StatusCode | Get-Member

TypeName: System.UInt32

Name        MemberType Definition
----        ---------- ----------
CompareTo   Method     int CompareTo(System.Object value), int CompareTo(System.UInt32 value)
Equals      Method     bool Equals(System.Object obj), bool Equals(System.UInt32 obj)
GetHashCode Method     int GetHashCode()
GetType     Method     type GetType()
GetTypeCode Method     System.TypeCode GetTypeCode()
ToString    Method     string ToString(), string ToString(System.IFormatProvider provider), string ToString(string format), string ToString(string format, System.IFormatProvider provider)


PS C:\Windows\system32> $c| Format-Custom -Depth 2

class ManagementObject#ROOT\cimv2\Win32_PingStatus
  Address =myip
  BufferSize = 32
  NoFragmentation = False
  PrimaryAddressResolutionStatus = 0
  ProtocolAddress =
  ProtocolAddressResolved =
  RecordRoute = 0
  ReplyInconsistency =
  ReplySize =
  ResolveAddressNames = False
  ResponseTime =
  ResponseTimeToLive =
  RouteRecord =
  RouteRecordResolved =
  SourceRoute =
  SourceRouteType = 0
  StatusCode = 11010
  Timeout = 4000
  TimeStampRecord =
  TimeStampRecordAddress =
  TimeStampRecordAddressResolved =
  TimestampRoute = 0
  TimeToLive = 128
  TypeofService = 0




Jul 24, 2012 at 7:34 PM

Hi Andreas,

Yes, this is possible, and thanks for asking because I had meant to do this but forgot about it.  I've just started investigating it to see how quickly I can put it in because I think it's really important, and I'll post back once I've figured out when I'll get this done.

Kirk out.

Jul 24, 2012 at 7:35 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Jul 26, 2012 at 3:11 AM

FYI, I implemented this today so that you get meaningful enumeration values in cases like this for all of the WMI functions/objects that are generated with wmix.  This change will be in the next release I post.

Jul 26, 2012 at 10:42 AM

Thanks for improving this feature.