1

Closed

Auto-convert numeric values to enumerations whenever possible.

description

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.
 
http://msdn.microsoft.com/en-us/library/windows/desktop/aa394350%28v=vs.85%29.aspx
 
 
11002
Destination Net Unreachable
 

 
11003
Destination Host Unreachable
 

 
11004
Destination Protocol Unreachable

 
Unfortunately I did not find a possibility to do this
 
PS C:\Windows\system32> $c.StatusCode
11010
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
}
 
 
 
regards
 

 
Andreas
Closed Jul 26, 2012 at 3:08 AM by poshoholic

comments

wrote Jul 26, 2012 at 3:08 AM

Resolved with changeset 16624.

wrote Feb 13, 2013 at 6:33 PM

wrote May 15, 2013 at 1:05 AM