Difference between revisions of "Powershell to test connectivity"

From MyWiki
Jump to: navigation, search
Line 1: Line 1:
Perform action for a list of servers
+
Perform action for a list of servers:
 
<source lang="powershell">
 
<source lang="powershell">
  

Revision as of 09:04, 15 June 2016

Perform action for a list of servers:

$servers = “dc1″,”dc3″,”sql1″,”wds1″,”ex1″
 
Foreach($s in $servers)
 
{

If no connection do something:

if(!(Test-Connection -Cn $s -BufferSize 16 -Count 1 -ea 0 -quiet))
 
  {