Lookup on WMI retur...
 
Notifications
Clear all

Lookup on WMI return

3 Posts
2 Users
1 Reactions
299 Views
(@mickey)
New Member Registered
Joined: 4 months ago
Posts: 2
Topic starter  

Hi there. I have been playing around with trying to take a WMI return value and map it to a user-readable value for ping results. I tried to mimic what I saw in the manual but didn't have any luck. Here is what I have so far.

set:PING_0=Success
set:PING_11001=Buffer Too Small
set:PING_11002=Destination Net Unreachable
set:PING_11003=Destination Host Unreachable
set:PING_11004=Destination Protocol Unreachable
set:PING_11005=Destination Port Unreachable
set:PING_11006=No Resources
set:PING_11007=Bad Option
set:PING_11008=Hardware Error
set:PING_11009=Packet Too Big
set:PING_11010=Request Timed Out
set:PING_11011=Bad Request
set:PING_11012=Bad Route
set:PING_11013=TimeToLive Expired Transit
set:PING_11014=TimeToLive Expired Reassembly
set:PING_11015=Parameter Problem
set:PING_11016=Source Quench
set:PING_11017=Option Too Big
set:PING_11018=Bad Destination
set:PING_11032=Negotiating IPSEC
set:PING_11050=General Failure

WMI=active:1,interval:5,namespace:root\cimv2,query:Win32_PingStatus where address='<IPADDRESS>',display: PING_%StatusCode%


   
Quote
Glenn
(@glenn)
Member Admin
Joined: 6 years ago
Posts: 1300
 

the SET commands should be either equals sign or space but not the colon. Wrap the displayed PING variable in percent.  It is actually a variable embedded inside a variable.

 

set PING_0=Success
set PING_11001=Buffer Too Small
set PING_11002=Destination Net Unreachable
set PING_11003=Destination Host Unreachable
set PING_11004=Destination Protocol Unreachable
set PING_11005=Destination Port Unreachable
set PING_11006=No Resources
set PING_11007=Bad Option
set PING_11008=Hardware Error
set PING_11009=Packet Too Big
set PING_11010=Request Timed Out
set PING_11011=Bad Request
set PING_11012=Bad Route
set PING_11013=TimeToLive Expired Transit
set PING_11014=TimeToLive Expired Reassembly
set PING_11015=Parameter Problem
set PING_11016=Source Quench
set PING_11017=Option Too Big
set PING_11018=Bad Destination
set PING_11032=Negotiating IPSEC
set PING_11050=General Failure

WMI=interval:5,namespace:root\cimv2,query:Win32_PingStatus where address='8.8.8.8',display: %PING_%StatusCode%%


   
ReplyQuote
(@mickey)
New Member Registered
Joined: 4 months ago
Posts: 2
Topic starter  

so close 😀 thanks for your help! 


   
Glenn reacted
ReplyQuote
Glenn's Page