📄 sol12-11.vbs
字号:
'Script: ISAlive.VBS
'Description
'Checks if machines are unavailable and E-maile-mails a specified user
'if can't reach machines (machines might be down)
Dim objPing, strResult, objMail
Set objPing = CreateObject("SScripting.IPNetwork")
strResult = ""
Ping "Mars", strResult
Ping "Jupiter", strResult
Ping "Thor", strResult
'check if the return result is not empty - if not empty, then unable to ping
'one or more machines
If strResult <> "" Then
sResult = "Unable to contact following machines:" & vbCrLf & sResult
Set objMail = CreateObject("CDO.Send")
objMail.Profile = "SCB"
objMail.Logon
objMail.NewMessage
objMail.AddRecipient "SMTP:administrator@c3i.com"
objMail.Message = "Machine(s) Not Available "
objMail.Subject = strResult
objMail.Send
objMail.Logoff
End If
Sub Ping(strHost, ByRef strMsg)
If Not objPing.Ping(strHost) = 0 Then strMsg = strMsg & strHost & vbCrLf
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -