Guest User

Untitled

a guest
Dec 12th, 2017
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. $servers = "dc1","dc3","sql1","wds1","ex1"
  2.  
  3. Foreach($s in $servers)
  4.  
  5. {
  6.  
  7. if(!(Test-Connection -Cn $s -BufferSize 16 -Count 1 -ea 0 -quiet))
  8.  
  9. {
  10.  
  11. "Problem connecting to $s"
  12.  
  13. "Flushing DNS"
  14.  
  15. ipconfig /flushdns | out-null
  16.  
  17. "Registering DNS"
  18.  
  19. ipconfig /registerdns | out-null
  20.  
  21. "doing a NSLookup for $s"
  22.  
  23. nslookup $s
  24.  
  25. "Re-pinging $s"
  26.  
  27. if(!(Test-Connection -Cn $s -BufferSize 16 -Count 1 -ea 0 -quiet))
  28.  
  29. {"Problem still exists in connecting to $s"}
  30.  
  31. ELSE {"Resolved problem connecting to $s"} #end if
  32.  
  33. } # end if
  34.  
  35. } # end foreach
Add Comment
Please, Sign In to add comment