Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Why does get-wmiobject win32_pingstatus return not supported?

Status
Not open for further replies.

bmgonavy

Technical User
Apr 9, 2008
4
US
I am on an XP box. Other classes come up fine.
 
There is no instance of the Win32_PingStatus class until you actually do a ping. Use this:

gwmi -Query "SELECT * FROM Win32_PingStatus WHERE Address='127.0.0.1'"

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
The select query works fine, but I still get "Not Supported" with Get-WmiObject Win32_PingStatus
 
That is because like I said, there is no instance of the class until you do a query to cause a ping to happen.

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
I can ping other devices until I am blue in the face and it still returns not supported
 
You mean that you can ping them via the ping command at the command prompt?

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
Ping.exe has no bearing on the Win32_PingStatus WMI class. Ping existed long before WMI was even a glimmer in some engineer's eye. Even if the two were related, here is what would happen (and does happen when you do an explicit query):

Start
-- No instances of Win32_PingStatus exist
Send a ping request to the remote machine
-- An instance of the Win32_PingStatus class poofs into existence
The ping finishes pinging the remote machine
-- The instance of Win32_PingStatus poofs back out of existence

So you see that no matter how many times you do a ping either via ping.exe or via WMI, no permanent instance of the class is ever created.

When you do the explicit query what you are saying to WMI is "PIng this machine and give me back a copy of the instance that gets created."

You can easily test that what you get back is a static copy of the instance by doing this:

1) $foo = gwmi -Query "SELECT * FROM Win32_PingStatus WHERE Address='xx.xxx.xx.xxx'" where you use the ip address of a machine on the network
2)Write-Host $foo.statuscode -- You will see that the machine is on the network
3) Disconnect the machine from the network
4)Write-Host $foo.statuscode -- You will see that the machine is on the network even though it really isn't. This is the first proof that the object stored in $foo is static and in no way represents some sort of dynamic ping object that is constantly updated with the current ping status of the remote machine.
4) If you want further proof, run this command again:
$foo = gwmi -Query "SELECT * FROM Win32_PingStatus WHERE Address='xx.xxx.xx.xxx'"
5)Write-Host $foo.statuscode -- You will see that the machine is not on the network
6) Now hook the machine back up
7) Write-Host $foo.statuscode --You will see that the machine is not on the network even though it is

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top