Networking Slideshow

  1. #+-------------------------------------------------------------------+   
  2. #| = : = : = : = : = : = : = : = : = : = : = : = : = : = : = : = : = |   
  3. #|{>/-------------------------------------------------------------\<}|            
  4. #|: | Author:  Aman Dhally                                        | :|            
  5. #| :| Email:   amandhally@gmail.com 
  6. #|: | Purpose: Ping Multiple Servers / Computers      
  7. #|: |                    Date: 15-Nov-2011         
  8. #| :|     /^(o.o)^\         Version: 1                                  |: |  
  9. #|{>\-------------------------------------------------------------/<}| 
  10. #| = : = : = : = : = : = : = : = : = : = : = : = : = : = : = : = : = | 
  11. #+-------------------------------------------------------------------+ 
  12.  
  13. #blog: http://newdelhipowershellusergroup.blogspot.in/2011/11/hi-today-i-was-looking-for-little.html  
  14.  
  15. #### Provide the computer name in $computername variable 
  16.  
  17. $ServerName = "localhost","Dc-XX" 
  18.  
  19.  
  20.  
  21. $smtp = "ExchChange" 
  22. $to = "amandhally@gmail.com" 
  23. $from = "newdelhi@gmail.com" 
  24. $sub = " Server Status" 
  25. $body = @" 
  26. "
  27.  
  28.  
  29. ##### Script Starts Here ######  
  30.  
  31.  
  32.  
  33. foreach ($Server in $ServerName) { 
  34.                     if (test-Connection -ComputerName $Server -Count 2 -Quiet ) {  
  35.                         $body += write-output "$Server is alive and Pinging `n"  
  36.  
  37.                             } else { $body += Write-output "$Server seems dead not pinging `n"  
  38.  
  39.                             }     
  40.          
  41.  
  42.  
  43. $body 
  44.  
  45. send-MailMessage -SmtpServer $smtp -To $to -Subject $sub -Body $body  -From $from   
  46.  
  47.  
  48. ########## end of script ####################### 
 
Loading...
Concentrated Tech NSoftware Dell Compellent Sponsored by Idera and Concentrated Tech and NSoftware and Dell Compellent
Copyright 2011 PowerShell.com. All rights reserved.