test-connection returns invalid query error


in many of scripts loop through array of computer names, use "test-connection" first make sure computer alive before moving on script.  sometimes, period of several minutes, test-connection cmdlet stops working try - whether run script or manually run ps command prompt.  example:

test-connection "servername"

"invalid query error"....

i tried using fqdn, , providing argument in command line of computername:

test-connection -computername "servername"

the after several minutes, randomly starts working again - dont close ps window or logout of server console - starts working again same ps command window session.  running on windows 2008 r2 sp1 standard, ps 2.0.

anyone else seen this?

nk

test-connection has knowen errors in powershell v2
http://blog.crayon.no/blogs/janegil/archive/2011/10/23/test_2d00_connection_2d00_error_2d00_handling_2d00_gotcha_2d00_in_2d00_powershell_2d00_2_2d00_0.aspx

and:http://jdhitsolutions.com/blog/2010/03/test-connection-troubles/

test-connection wrapper wmi win32_pingstatus class , such attempt resolve computernames.
can use wmi win32_pingstatus directly!
$ping = new-object system.net.networkinformation.ping

see: http://www.ilovepowershell.com/powershell-how-to-ping-computers/


please click “mark answer” if post answers question , click “vote helpful” if post helps you.
bitte markiere hilfreiche beiträge von mir als “als hilfreich bewerten” und beiträge die deine frage ganz oder teilweise beantwortet haben als “als antwort markieren”.
powershell blog http://www.admin-source.info
[string](0..21|%{[char][int]([int]("{0:d}" -f 0x28)+('755964655967-86965747271757624-8796158066061').substring(($_*2),2))})-replace' '
german ? come german powershell forum!



Windows Server  >  Windows PowerShell



Comments

Popular posts from this blog

2008 Windows Deployment Server Properties Error

Can no longer user MS Update - Files required to use Microsoft Update are no longer registered

How do a find data in one file, search for it in another file and if not found, write a custom message to another file