| Some my feel that apart from it being a nifty | | | | For Each objPingStatus In colPingStatus |
| trick, there isn't any real practical use for sending | | | | If IsNull(objPingStatus.StatusCode) or |
| E-Mail from a script but lets imagine the following | | | | objPingStatus.StatusCode 0 Then |
| scenario: | | | | Set objMessage = |
| You have a business critical server called | | | | CreateObject("CDO.Message")objMessage.From = |
| "ImpServ01" that must be available at all costs. | | | | strComputer & |
| The following script can be setup to run every | | | | "@YourDomain.com"objMessage.To = |
| five minutes to check the availability of the | | | | ""objMessage.Subject = strComputer & " is |
| server and email you if the server becomes | | | | unavailable"objMessage.Textbody = strComputer |
| unavailable. This example uses a SMTP server | | | | & " is no longer accessible over the |
| called "SMTP.YourDomain.com" and sends mail | | | | network."objMessage.Configuration.Fields.Item(" = |
| from "" to "". | | | | 2objMessage.Configuration.Fields.Item(" = |
| Option Explicit | | | | elds.Item(" = |
| Dim strComputer | | | | .Send |
| Dim colPingStatus | | | | End If |
| Dim objPingStatus | | | | Next |
| Dim objMessagestrComputer = "ImpSrv01" | | | | Set colPingStatus = Nothing |
| Set colPingStatus = | | | | Set objMessage = Nothing |
| nate}").ExecQuery("SELECT * FROM | | | | To attach a file to the E-Mail add the following |
| Win32_PingStatus WHERE address = '" & | | | | line:objMessage.AddAttachment "SomeDocument. |
| strComputer & "'") | | | | |