Difference between revisions of "Powershell to test connectivity"
From MyWiki
| Line 14: | Line 14: | ||
{ | { | ||
| + | </source> | ||
| + | Combine the two above: | ||
| + | <source lang="powershell"> | ||
| + | |||
</source> | </source> | ||
Revision as of 09:16, 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)) {
Combine the two above: