strEmailTo= " [email protected] "
strEmailFrom= do " monitor DNS "
strDomain= " yourdomain.com "
strDNSServer= " 4.2.2.2 "
strSMTPServer= " yoursmtpserver "
iSMTPPort=25
Fazem
Ajustar o objShell = o CreateObject (“WScript.Shell”)
Ajustar o objNSLookup = o objShell.Exec (“nslookup - &strDomain&” “o &strDNSServer do q=MX “)
Ajustar o objStdOut = o objNSLookup.StdOut
strOutput = objStdOut.ReadAll
bChanged=False
Se bChanged=True =0 de Instr (strOutput, strDomain&vbTab& do " preferência MX = 8, cambista de correio = “&strDomain&” .s5b2.pts.com”) então
Se bChanged=True =0 de Instr (strOutput, strDomain&vbTab& do " preferência MX = 2, cambista de correio = “&strDomain&” .s5a1.pts.com”) então
Se bChanged=True =0 de Instr (strOutput, strDomain&vbTab& do " preferência MX = 4, cambista de correio = “&strDomain&” .s5a2.pts.com”) então
Se bChanged=True =0 de Instr (strOutput, strDomain&vbTab& do " preferência MX = 6, cambista de correio = “&strDomain&” .s5b1.pts.com”) então
Se bChanged=True então
Ajustar o objEmail = o CreateObject (“CDO.Message”)
objEmail.From = strEmailFrom
objEmail.To = strEmailTo
objEmail.Subject = “DNS mudou”
objEmail.Textbody = strOutput
_ de objEmail.Configuration.Fields.Item
(“http://schemas.microsoft.com/cdo/configuration/sendusing ") = 2
_ de objEmail.Configuration.Fields.Item
(“http://schemas.microsoft.com/cdo/configuration/smtpserver ") = strSMTPServer
_ de objEmail.Configuration.Fields.Item
(“http://schemas.microsoft.com/cdo/configuration/smtpserverport ") = iSMTPPort
objEmail.Configuration.Fields.Update
objEmail.Send
wscript.quit
Terminar se
wscript.sleep 60000
Laço
|