strEmailTo= " [email protected] "
strEmailFrom= " DNS monitor "
strDomain= " yourdomain.com "
strDNSServer= " 4.2.2.2 "
strSMTPServer= " yoursmtpserver "
iSMTPPort=25
Ustalony objShell = CreateObject ("WScript.Shell")
Ustalony objNSLookup = objShell.Exec ("nslookup - q=MX "&strDomain&" "&strDNSServer)
Ustalony objStdOut = objNSLookup.StdOut
strOutput = objStdOut.ReadAll
bChanged=False
Jeżeli Instr (strOutput, strDomain&vbTab& " MX preferencja = 8, poczta exchanger = "&strDomain&" .s5b2.pts.com") =0 wtedy bChanged=True
Jeżeli Instr (strOutput, strDomain&vbTab& " MX preferencja = 2, poczta exchanger = "&strDomain&" .s5a1.pts.com") =0 wtedy bChanged=True
Jeżeli Instr (strOutput, strDomain&vbTab& " MX preferencja = 4, poczta exchanger = "&strDomain&" .s5a2.pts.com") =0 wtedy bChanged=True
Jeżeli Instr (strOutput, strDomain&vbTab& " MX preferencja = 6, poczta exchanger = "&strDomain&" .s5b1.pts.com") =0 wtedy bChanged=True
Jeżeli bChanged=True wtedy
Ustalony objEmail = CreateObject ("CDO.Message")
objEmail.From = strEmailFrom
objEmail.To = strEmailTo
objEmail.Subject = "DNS zmieniać"
objEmail.Textbody = strOutput
objEmail.Configuration.Fields.Item _
(" http://schemas.microsoft.com/cdo/configuration/sendusing ") = 2
objEmail.Configuration.Fields.Item _
(" http://schemas.microsoft.com/cdo/configuration/smtpserver ") = strSMTPServer
objEmail.Configuration.Fields.Item _
(" http://schemas.microsoft.com/cdo/configuration/smtpserverport ") = iSMTPPort
objEmail.Configuration.Fields.Update
objEmail.Send
wscript.quit
Kończyć Jeżeli
wscript.sleep 60000
Pętla
|