J
JV
Hello all,
I am attempting to utilize win32_pingstatus. I have used scriptomatic to
exposed the properties of win32_pingstatus but I am running into errors with
following portions of the code:
strRouteRecord = Join(objItem.RouteRecord, ",")
strRouteRecordResolved = Join(objItem.RouteRecordResolved, ",")
strTimeStampRecord = Join(objItem.TimeStampRecord, ",")
strTimeStampRecordAddress = Join(objItem.TimeStampRecordAddress, ",")
strTimeStampRecordAddressResolved =
Join(objItem.TimeStampRecordAddressResolved, ",")
These appear to be arrays which are null and errors are returned. I am able
to run the script if I create If statements to bypass the lines if they are
null but I would like find out if the problem lies with the syntax of the
joins or maybe a problem with these properties in Win32_pingstatus: maybe
they are not fully functional.
Any ideas would be appreciated. Thx in advance.
Here is the full code generated by scriptomatic:
Const wbemFlagReturnImmediately = &h10
Const wbemFlagForwardOnly = &h20
arrComputers = Array("PDDCL11041")
For Each strComputer In arrComputers
WScript.Echo
WScript.Echo "=========================================="
WScript.Echo "Computer: " & strComputer
WScript.Echo "=========================================="
Set objWMIService = GetObject("winmgmts:\\" & strComputer &
"\root\CIMV2")
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_PingStatus
where Address ='computername'", "WQL", _
wbemFlagReturnImmediately +
wbemFlagForwardOnly)
For Each objItem In colItems
WScript.Echo "Address: " & objItem.Address
WScript.Echo "BufferSize: " & objItem.BufferSize
WScript.Echo "NoFragmentation: " & objItem.NoFragmentation
WScript.Echo "PrimaryAddressResolutionStatus: " &
objItem.PrimaryAddressResolutionStatus
WScript.Echo "ProtocolAddress: " & objItem.ProtocolAddress
WScript.Echo "ProtocolAddressResolved: " &
objItem.ProtocolAddressResolved
WScript.Echo "RecordRoute: " & objItem.RecordRoute
WScript.Echo "ReplyInconsistency: " & objItem.ReplyInconsistency
WScript.Echo "ReplySize: " & objItem.ReplySize
WScript.Echo "ResolveAddressNames: " & objItem.ResolveAddressNames
WScript.Echo "ResponseTime: " & objItem.ResponseTime
WScript.Echo "ResponseTimeToLive: " & objItem.ResponseTimeToLive
strRouteRecord = Join(objItem.RouteRecord, ",")
WScript.Echo "RouteRecord: " & strRouteRecord
strRouteRecordResolved = Join(objItem.RouteRecordResolved, ",")
WScript.Echo "RouteRecordResolved: " & strRouteRecordResolved
WScript.Echo "SourceRoute: " & objItem.SourceRoute
WScript.Echo "SourceRouteType: " & objItem.SourceRouteType
WScript.Echo "StatusCode: " & objItem.StatusCode
WScript.Echo "Timeout: " & objItem.Timeout
strTimeStampRecord = Join(objItem.TimeStampRecord, ",")
WScript.Echo "TimeStampRecord: " & strTimeStampRecord
strTimeStampRecordAddress = Join(objItem.TimeStampRecordAddress, ",")
WScript.Echo "TimeStampRecordAddress: " & strTimeStampRecordAddress
strTimeStampRecordAddressResolved =
Join(objItem.TimeStampRecordAddressResolved, ",")
WScript.Echo "TimeStampRecordAddressResolved: " &
strTimeStampRecordAddressResolved
WScript.Echo "TimestampRoute: " & objItem.TimestampRoute
WScript.Echo "TimeToLive: " & objItem.TimeToLive
WScript.Echo "TypeofService: " & objItem.TypeofService
WScript.Echo
Next
Next
I am attempting to utilize win32_pingstatus. I have used scriptomatic to
exposed the properties of win32_pingstatus but I am running into errors with
following portions of the code:
strRouteRecord = Join(objItem.RouteRecord, ",")
strRouteRecordResolved = Join(objItem.RouteRecordResolved, ",")
strTimeStampRecord = Join(objItem.TimeStampRecord, ",")
strTimeStampRecordAddress = Join(objItem.TimeStampRecordAddress, ",")
strTimeStampRecordAddressResolved =
Join(objItem.TimeStampRecordAddressResolved, ",")
These appear to be arrays which are null and errors are returned. I am able
to run the script if I create If statements to bypass the lines if they are
null but I would like find out if the problem lies with the syntax of the
joins or maybe a problem with these properties in Win32_pingstatus: maybe
they are not fully functional.
Any ideas would be appreciated. Thx in advance.
Here is the full code generated by scriptomatic:
Const wbemFlagReturnImmediately = &h10
Const wbemFlagForwardOnly = &h20
arrComputers = Array("PDDCL11041")
For Each strComputer In arrComputers
WScript.Echo
WScript.Echo "=========================================="
WScript.Echo "Computer: " & strComputer
WScript.Echo "=========================================="
Set objWMIService = GetObject("winmgmts:\\" & strComputer &
"\root\CIMV2")
Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_PingStatus
where Address ='computername'", "WQL", _
wbemFlagReturnImmediately +
wbemFlagForwardOnly)
For Each objItem In colItems
WScript.Echo "Address: " & objItem.Address
WScript.Echo "BufferSize: " & objItem.BufferSize
WScript.Echo "NoFragmentation: " & objItem.NoFragmentation
WScript.Echo "PrimaryAddressResolutionStatus: " &
objItem.PrimaryAddressResolutionStatus
WScript.Echo "ProtocolAddress: " & objItem.ProtocolAddress
WScript.Echo "ProtocolAddressResolved: " &
objItem.ProtocolAddressResolved
WScript.Echo "RecordRoute: " & objItem.RecordRoute
WScript.Echo "ReplyInconsistency: " & objItem.ReplyInconsistency
WScript.Echo "ReplySize: " & objItem.ReplySize
WScript.Echo "ResolveAddressNames: " & objItem.ResolveAddressNames
WScript.Echo "ResponseTime: " & objItem.ResponseTime
WScript.Echo "ResponseTimeToLive: " & objItem.ResponseTimeToLive
strRouteRecord = Join(objItem.RouteRecord, ",")
WScript.Echo "RouteRecord: " & strRouteRecord
strRouteRecordResolved = Join(objItem.RouteRecordResolved, ",")
WScript.Echo "RouteRecordResolved: " & strRouteRecordResolved
WScript.Echo "SourceRoute: " & objItem.SourceRoute
WScript.Echo "SourceRouteType: " & objItem.SourceRouteType
WScript.Echo "StatusCode: " & objItem.StatusCode
WScript.Echo "Timeout: " & objItem.Timeout
strTimeStampRecord = Join(objItem.TimeStampRecord, ",")
WScript.Echo "TimeStampRecord: " & strTimeStampRecord
strTimeStampRecordAddress = Join(objItem.TimeStampRecordAddress, ",")
WScript.Echo "TimeStampRecordAddress: " & strTimeStampRecordAddress
strTimeStampRecordAddressResolved =
Join(objItem.TimeStampRecordAddressResolved, ",")
WScript.Echo "TimeStampRecordAddressResolved: " &
strTimeStampRecordAddressResolved
WScript.Echo "TimestampRoute: " & objItem.TimestampRoute
WScript.Echo "TimeToLive: " & objItem.TimeToLive
WScript.Echo "TypeofService: " & objItem.TypeofService
WScript.Echo
Next
Next