Pinging a Server from a Server you are not logged in to
Posted by: Andy Schneider in PowershellI recently had a unique situation in which I needed to see if 4 different servers could ping a specific IP Address. Very often, we use win32_pingstatus to see if a remote machine is responding or not. But in this case, I needed to know if a remote machine could ping another remote machine. Routing was actually set up so that I could not ping the second remote machine from my laptop.
What’s cool is that you can use the –computername parameter in get-wmiobject when you look at win32_pingstatus.
I did change the name in a text editor to remote1 just for the sake of demo and public screen shots.
So if you wanted server remote1 to ping server remote3 you could do something like this:
Get-WmiObject Win32_pingstatus –filter “Address =’remote3’” –computername remote1.
Entries (RSS)
CTP3 has Test-connection cmdlet that has a source parameter that does exactly this as well as many other useful parameters. The cmdlet uses WMI as well.
http://technet.microsoft.com/en-us/library/dd315259.aspx
Have a look et Test-Connection (CTP3 ping)
PS > Test-Connection -Destination remote3 -Source remote1
Hi,
When i execute that above command i got an error:
Invalid query
At :line:1 char:13
+ Get-WmiObject <<<< Win32_pingstatus –filter “Address =’WSUS’” –computername MyDev01
here’s the scenario:
logon server with PowerGUI: Server B
I want to test: MyDev01
ping target from above server: WSUS
any idea ?
thanks.