Set fso = CreateObject("Scripting.FileSystemObject")
Set filetxt = fso.CreateTextFile("d:\chk_dc\"+formatdatetime(date,2)+"AD检查.txt", True)
Set wshShell = WScript.CreateObject( "WScript.Shell" )
strComputerName = wshShell.ExpandEnvironmentStrings( "%COMPUTERNAME%" )
set WshShell = WScript.CreateObject("WScript.Shell")
filetxt.WriteLine "------PCADC01 AD端口通信测试------"
WshShell.Run "cmd"
WScript.Sleep 100
WshShell.AppActivate "C:\Windows\system32\cmd.exe"
WshShell.SendKeys "telnet PCADC01 135{ENTER}"
WshShell.SendKeys "exit{ENTER}"
WScript.Sleep 500
WshShell.SendKeys "{ENTER}"
WScript.Sleep 500
if err.number <> 0 then
filetxt.WriteLine "PCADC01 RPC(135) 通信失败"
else
filetxt.WriteLine "PCADC01 RPC(135) 通信成功"
end if
WshShell.Run "cmd"
WScript.Sleep 100
WshShell.AppActivate "C:\Windows\system32\cmd.exe"
WshShell.SendKeys "telnet PCADC01 389{ENTER}"
WshShell.SendKeys "exit{ENTER}"
WScript.Sleep 500
WshShell.SendKeys "{ENTER}"
WScript.Sleep 500
if err.number <> 0 then
filetxt.WriteLine "PCADC01 LDAP(389) 通信失败"
else
filetxt.WriteLine "PCADC01 LDAP(389) 通信成功"
end if
WshShell.Run "cmd"
WScript.Sleep 100
WshShell.AppActivate "C:\Windows\system32\cmd.exe"
WshShell.SendKeys "telnet PCADC01 636{ENTER}"
WshShell.SendKeys "exit{ENTER}"
WScript.Sleep 500
WshShell.SendKeys "{ENTER}"
WScript.Sleep 500
if err.number <> 0 then
filetxt.WriteLine "PCADC01 LDAP SSL(636) 通信失败"
else
filetxt.WriteLine "PCADC01 LDAP SSL(636) 通信成功"
end if
WshShell.Run "cmd"
WScript.Sleep 100
WshShell.AppActivate "C:\Windows\system32\cmd.exe"
WshShell.SendKeys "telnet PCADC01 3268{ENTER}"
WshShell.SendKeys "exit{ENTER}"
WScript.Sleep 500
WshShell.SendKeys "{ENTER}"
WScript.Sleep 500
if err.number <> 0 then
filetxt.WriteLine "PCADC01 LDAP GC(3268) 通信失败"
else
filetxt.WriteLine "PCADC01 LDAP GC(3268) 通信成功"
end if
WshShell.Run "cmd"
WScript.Sleep 100
WshShell.AppActivate "C:\Windows\system32\cmd.exe"
WshShell.SendKeys "telnet PCADC01 3269{ENTER}"
WshShell.SendKeys "exit{ENTER}"
WScript.Sleep 500
WshShell.SendKeys "{ENTER}"
WScript.Sleep 500
if err.number <> 0 then
filetxt.WriteLine "PCADC01 LDAP GC SSL(3269) 通信失败"
else
filetxt.WriteLine "PCADC01 LDAP GC SSL(3269) 通信成功"
end if
WshShell.Run "cmd"
WScript.Sleep 100
WshShell.AppActivate "C:\Windows\system32\cmd.exe"
WshShell.SendKeys "telnet PCADC01 53{ENTER}"
WshShell.SendKeys "exit{ENTER}"
WScript.Sleep 500
WshShell.SendKeys "{ENTER}"
WScript.Sleep 500
if err.number <> 0 then
filetxt.WriteLine "PCADC01 DNS(53) 通信失败"
else
filetxt.WriteLine "PCADC01 DNS(53) 通信成功"
end if
WshShell.Run "cmd"
WScript.Sleep 100
WshShell.AppActivate "C:\Windows\system32\cmd.exe"
WshShell.SendKeys "telnet PCADC01 88{ENTER}"
WshShell.SendKeys "exit{ENTER}"
WScript.Sleep 500
WshShell.SendKeys "{ENTER}"
WScript.Sleep 500
if err.number <> 0 then
filetxt.WriteLine "PCADC01 Kerberos(88) 通信失败"
else
filetxt.WriteLine "PCADC01 Kerberos(88) 通信成功"
end if
WshShell.Run "cmd"
WScript.Sleep 100
WshShell.AppActivate "C:\Windows\system32\cmd.exe"
WshShell.SendKeys "telnet PCADC01 445{ENTER}"
WshShell.SendKeys "exit{ENTER}"
WScript.Sleep 500
WshShell.SendKeys "{ENTER}"
WScript.Sleep 500
if err.number <> 0 then
filetxt.WriteLine "PCADC01 SMB(445) 通信失败"
else
filetxt.WriteLine "PCADC01 SMB(445) 通信成功"
end if
filetxt.WriteLine "--------------------------------------------"
filetxt.WriteLine "--------------------------------------------"
filetxt.WriteLine " "
filetxt.WriteLine "-----pcadc02 AD端口通信测试------"
WshShell.Run "cmd"
WScript.Sleep 100
WshShell.AppActivate "C:\Windows\system32\cmd.exe"
WshShell.SendKeys "telnet pcadc02 135{ENTER}"
WshShell.SendKeys "exit{ENTER}"
WScript.Sleep 500
WshShell.SendKeys "{ENTER}"
WScript.Sleep 500
if err.number <> 0 then
filetxt.WriteLine "pcadc02 RPC(135) 通信失败"
else
filetxt.WriteLine "pcadc02 RPC(135) 通信成功"
end if
WshShell.Run "cmd"
WScript.Sleep 100
WshShell.AppActivate "C:\Windows\system32\cmd.exe"
WshShell.SendKeys "telnet pcadc02 389{ENTER}"
WshShell.SendKeys "exit{ENTER}"
WScript.Sleep 500
WshShell.SendKeys "{ENTER}"
WScript.Sleep 500
if err.number <> 0 then
filetxt.WriteLine "pcadc02 LDAP(389) 通信失败"
else
filetxt.WriteLine "pcadc02 LDAP(389) 通信成功"
end if
WshShell.Run "cmd"
WScript.Sleep 100
WshShell.AppActivate "C:\Windows\system32\cmd.exe"
WshShell.SendKeys "telnet pcadc02 636{ENTER}"
WshShell.SendKeys "exit{ENTER}"
WScript.Sleep 500
WshShell.SendKeys "{ENTER}"
WScript.Sleep 500
if err.number <> 0 then
filetxt.WriteLine "pcadc02 LDAP SSL(636) 通信失败"
else
filetxt.WriteLine "pcadc02 LDAP SSL(636) 通信成功"
end if
WshShell.Run "cmd"
WScript.Sleep 100
WshShell.AppActivate "C:\Windows\system32\cmd.exe"
WshShell.SendKeys "telnet pcadc02 3268{ENTER}"
WshShell.SendKeys "exit{ENTER}"
WScript.Sleep 500
WshShell.SendKeys "{ENTER}"
WScript.Sleep 500
if err.number <> 0 then
filetxt.WriteLine "pcadc02 LDAP GC(3268) 通信失败"
else
filetxt.WriteLine "pcadc02 LDAP GC(3268) 通信成功"
end if
WshShell.Run "cmd"
WScript.Sleep 100
WshShell.AppActivate "C:\Windows\system32\cmd.exe"
WshShell.SendKeys "telnet pcadc02 3269{ENTER}"
WshShell.SendKeys "exit{ENTER}"
WScript.Sleep 500
WshShell.SendKeys "{ENTER}"
WScript.Sleep 500
if err.number <> 0 then
filetxt.WriteLine "pcadc02 LDAP GC SSL(3269) 通信失败"
else
filetxt.WriteLine "pcadc02 LDAP GC SSL(3269) 通信成功"
end if
WshShell.Run "cmd"
WScript.Sleep 100
WshShell.AppActivate "C:\Windows\system32\cmd.exe"
WshShell.SendKeys "telnet pcadc02 53{ENTER}"
WshShell.SendKeys "exit{ENTER}"
WScript.Sleep 500
WshShell.SendKeys "{ENTER}"
WScript.Sleep 500
if err.number <> 0 then
filetxt.WriteLine "pcadc02 DNS(53) 通信失败"
else
filetxt.WriteLine "pcadc02 DNS(53) 通信成功"
end if
WshShell.Run "cmd"
WScript.Sleep 100
WshShell.AppActivate "C:\Windows\system32\cmd.exe"
WshShell.SendKeys "telnet pcadc02 88{ENTER}"
WshShell.SendKeys "exit{ENTER}"
WScript.Sleep 500
WshShell.SendKeys "{ENTER}"
WScript.Sleep 500
if err.number <> 0 then
filetxt.WriteLine "pcadc02 Kerberos(88) 通信失败"
else
filetxt.WriteLine "pcadc02 Kerberos(88) 通信成功"
end if
WshShell.Run "cmd"
WScript.Sleep 100
WshShell.AppActivate "C:\Windows\system32\cmd.exe"
WshShell.SendKeys "telnet pcadc02 445{ENTER}"
WshShell.SendKeys "exit{ENTER}"
WScript.Sleep 500
WshShell.SendKeys "{ENTER}"
WScript.Sleep 500
if err.number <> 0 then
filetxt.WriteLine "pcadc02 SMB(445) 通信失败"
else
filetxt.WriteLine "pcadc02 SMB(445) 通信成功"
end if
filetxt.WriteLine "--------------------------------------------"
filetxt.WriteLine "--------------------------------------------"
filetxt.WriteLine " "
filetxt.WriteLine "-----shwpdc01 AD端口通信测试-----"
WshShell.Run "cmd"
WScript.Sleep 100
WshShell.AppActivate "C:\Windows\system32\cmd.exe"
WshShell.SendKeys "telnet shwpdc01 135{ENTER}"
WshShell.SendKeys "exit{ENTER}"
WScript.Sleep 500
WshShell.SendKeys "{ENTER}"
WScript.Sleep 500
if err.number <> 0 then
filetxt.WriteLine "shwpdc01 RPC(135) 通信失败"
else
filetxt.WriteLine "shwpdc01 RPC(135) 通信成功"
end if
WshShell.Run "cmd"
WScript.Sleep 100
WshShell.AppActivate "C:\Windows\system32\cmd.exe"
WshShell.SendKeys "telnet shwpdc01 389{ENTER}"
WshShell.SendKeys "exit{ENTER}"
WScript.Sleep 500
WshShell.SendKeys "{ENTER}"
WScript.Sleep 500
if err.number <> 0 then
filetxt.WriteLine "shwpdc01 LDAP(389) 通信失败"
else
filetxt.WriteLine "shwpdc01 LDAP(389) 通信成功"
end if
WshShell.Run "cmd"
WScript.Sleep 100
WshShell.AppActivate "C:\Windows\system32\cmd.exe"
WshShell.SendKeys "telnet shwpdc01 636{ENTER}"
WshShell.SendKeys "exit{ENTER}"
WScript.Sleep 500
WshShell.SendKeys "{ENTER}"
WScript.Sleep 500
if err.number <> 0 then
filetxt.WriteLine "shwpdc01 LDAP SSL(636) 通信失败"
else
filetxt.WriteLine "shwpdc01 LDAP SSL(636) 通信成功"
end if
WshShell.Run "cmd"
WScript.Sleep 100
WshShell.AppActivate "C:\Windows\system32\cmd.exe"
WshShell.SendKeys "telnet shwpdc01 3268{ENTER}"
WshShell.SendKeys "exit{ENTER}"
WScript.Sleep 500
WshShell.SendKeys "{ENTER}"
WScript.Sleep 500
if err.number <> 0 then
filetxt.WriteLine "shwpdc01 LDAP GC(3268) 通信失败"
else
filetxt.WriteLine "shwpdc01 LDAP GC(3268) 通信成功"
end if
WshShell.Run "cmd"
WScript.Sleep 100
WshShell.AppActivate "C:\Windows\system32\cmd.exe"
WshShell.SendKeys "telnet shwpdc01 3269{ENTER}"
WshShell.SendKeys "exit{ENTER}"
WScript.Sleep 500
WshShell.SendKeys "{ENTER}"
WScript.Sleep 500
if err.number <> 0 then
filetxt.WriteLine "shwpdc01 LDAP GC SSL(3269) 通信失败"
else
filetxt.WriteLine "shwpdc01 LDAP GC SSL(3269) 通信成功"
end if
WshShell.Run "cmd"
WScript.Sleep 100
WshShell.AppActivate "C:\Windows\system32\cmd.exe"
WshShell.SendKeys "telnet shwpdc01 53{ENTER}"
WshShell.SendKeys "exit{ENTER}"
WScript.Sleep 500
WshShell.SendKeys "{ENTER}"
WScript.Sleep 500
if err.number <> 0 then
filetxt.WriteLine "shwpdc01 DNS(53) 通信失败"
else
filetxt.WriteLine "shwpdc01 DNS(53) 通信成功"
end if
WshShell.Run "cmd"
WScript.Sleep 100
WshShell.AppActivate "C:\Windows\system32\cmd.exe"
WshShell.SendKeys "telnet shwpdc01 88{ENTER}"
WshShell.SendKeys "exit{ENTER}"
WScript.Sleep 500
WshShell.SendKeys "{ENTER}"
WScript.Sleep 500
if err.number <> 0 then
filetxt.WriteLine "shwpdc01 Kerberos(88) 通信失败"
else
filetxt.WriteLine "shwpdc01 Kerberos(88) 通信成功"
end if
WshShell.Run "cmd"
WScript.Sleep 100
WshShell.AppActivate "C:\Windows\system32\cmd.exe"
WshShell.SendKeys "telnet shwpdc01 445{ENTER}"
WshShell.SendKeys "exit{ENTER}"
WScript.Sleep 500
WshShell.SendKeys "{ENTER}"
WScript.Sleep 500
if err.number <> 0 then
filetxt.WriteLine "shwpdc01 SMB(445) 通信失败"
else
filetxt.WriteLine "shwpdc01 SMB(445) 通信成功"
end if
filetxt.WriteLine "--------------------------------------------"
filetxt.WriteLine "--------------------------------------------"
filetxt.WriteLine " "
filetxt.WriteLine "-----shwpdc02 AD端口通信测试-----"
WshShell.Run "cmd"
WScript.Sleep 100
WshShell.AppActivate "C:\Windows\system32\cmd.exe"
WshShell.SendKeys "telnet shwpdc02 135{ENTER}"
WshShell.SendKeys "exit{ENTER}"
WScript.Sleep 500
WshShell.SendKeys "{ENTER}"
WScript.Sleep 500
if err.number <> 0 then
filetxt.WriteLine "shwpdc02 RPC(135) 通信失败"
else
filetxt.WriteLine "shwpdc02 RPC(135) 通信成功"
end if
WshShell.Run "cmd"
WScript.Sleep 100
WshShell.AppActivate "C:\Windows\system32\cmd.exe"
WshShell.SendKeys "telnet shwpdc02 389{ENTER}"
WshShell.SendKeys "exit{ENTER}"
WScript.Sleep 500
WshShell.SendKeys "{ENTER}"
WScript.Sleep 500
if err.number <> 0 then
filetxt.WriteLine "shwpdc02 LDAP(389) 通信失败"
else
filetxt.WriteLine "shwpdc02 LDAP(389) 通信成功"
end if
WshShell.Run "cmd"
WScript.Sleep 100
WshShell.AppActivate "C:\Windows\system32\cmd.exe"
WshShell.SendKeys "telnet shwpdc02 636{ENTER}"
WshShell.SendKeys "exit{ENTER}"
WScript.Sleep 500
WshShell.SendKeys "{ENTER}"
WScript.Sleep 500
if err.number <> 0 then
filetxt.WriteLine "shwpdc02 LDAP SSL(636) 通信失败"
else
filetxt.WriteLine "shwpdc02 LDAP SSL(636) 通信成功"
end if
WshShell.Run "cmd"
WScript.Sleep 100
WshShell.AppActivate "C:\Windows\system32\cmd.exe"
WshShell.SendKeys "telnet shwpdc02 3268{ENTER}"
WshShell.SendKeys "exit{ENTER}"
WScript.Sleep 500
WshShell.SendKeys "{ENTER}"
WScript.Sleep 500
if err.number <> 0 then
filetxt.WriteLine "shwpdc02 LDAP GC(3268) 通信失败"
else
filetxt.WriteLine "shwpdc02 LDAP GC(3268) 通信成功"
end if
WshShell.Run "cmd"
WScript.Sleep 100
WshShell.AppActivate "C:\Windows\system32\cmd.exe"
WshShell.SendKeys "telnet shwpdc02 3269{ENTER}"
WshShell.SendKeys "exit{ENTER}"
WScript.Sleep 500
WshShell.SendKeys "{ENTER}"
WScript.Sleep 500
if err.number <> 0 then
filetxt.WriteLine "shwpdc02 LDAP GC SSL(3269) 通信失败"
else
filetxt.WriteLine "shwpdc02 LDAP GC SSL(3269) 通信成功"
end if
WshShell.Run "cmd"
WScript.Sleep 100
WshShell.AppActivate "C:\Windows\system32\cmd.exe"
WshShell.SendKeys "telnet shwpdc02 53{ENTER}"
WshShell.SendKeys "exit{ENTER}"
WScript.Sleep 500
WshShell.SendKeys "{ENTER}"
WScript.Sleep 500
if err.number <> 0 then
filetxt.WriteLine "shwpdc02 DNS(53) 通信失败"
else
filetxt.WriteLine "shwpdc02 DNS(53) 通信成功"
end if
WshShell.Run "cmd"
WScript.Sleep 100
WshShell.AppActivate "C:\Windows\system32\cmd.exe"
WshShell.SendKeys "telnet shwpdc02 88{ENTER}"
WshShell.SendKeys "exit{ENTER}"
WScript.Sleep 500
WshShell.SendKeys "{ENTER}"
WScript.Sleep 500
if err.number <> 0 then
filetxt.WriteLine "shwpdc02 Kerberos(88) 通信失败"
else
filetxt.WriteLine "shwpdc02 Kerberos(88) 通信成功"
end if
WshShell.Run "cmd"
WScript.Sleep 100
WshShell.AppActivate "C:\Windows\system32\cmd.exe"
WshShell.SendKeys "telnet shwpdc02 445{ENTER}"
WshShell.SendKeys "exit{ENTER}"
WScript.Sleep 500
WshShell.SendKeys "{ENTER}"
WScript.Sleep 500
if err.number <> 0 then
filetxt.WriteLine "shwpdc02 SMB(445) 通信失败"
else
filetxt.WriteLine "shwpdc02 SMB(445) 通信成功"
end if
filetxt.WriteLine "--------------------------------------------"
filetxt.WriteLine "--------------------------------------------"
filetxt.WriteLine " "
filetxt.WriteLine "-----shwpdc03 AD端口通信测试-----"
WshShell.Run "cmd"
WScript.Sleep 100
WshShell.AppActivate "C:\Windows\system32\cmd.exe"
WshShell.SendKeys "telnet shwpdc03 135{ENTER}"
WshShell.SendKeys "exit{ENTER}"
WScript.Sleep 500
WshShell.SendKeys "{ENTER}"
WScript.Sleep 500
if err.number <> 0 then
filetxt.WriteLine "shwpdc03 RPC(135) 通信失败"
else
filetxt.WriteLine "shwpdc03 RPC(135) 通信成功"
end if
WshShell.Run "cmd"
WScript.Sleep 100
WshShell.AppActivate "C:\Windows\system32\cmd.exe"
WshShell.SendKeys "telnet shwpdc03 389{ENTER}"
WshShell.SendKeys "exit{ENTER}"
WScript.Sleep 500
WshShell.SendKeys "{ENTER}"
WScript.Sleep 500
if err.number <> 0 then
filetxt.WriteLine "shwpdc03 LDAP(389) 通信失败"
else
filetxt.WriteLine "shwpdc03 LDAP(389) 通信成功"
end if
WshShell.Run "cmd"
WScript.Sleep 100
WshShell.AppActivate "C:\Windows\system32\cmd.exe"
WshShell.SendKeys "telnet shwpdc03 636{ENTER}"
WshShell.SendKeys "exit{ENTER}"
WScript.Sleep 500
WshShell.SendKeys "{ENTER}"
WScript.Sleep 500
if err.number <> 0 then
filetxt.WriteLine "shwpdc03 LDAP SSL(636) 通信失败"
else
filetxt.WriteLine "shwpdc03 LDAP SSL(636) 通信成功"
end if
WshShell.Run "cmd"
WScript.Sleep 100
WshShell.AppActivate "C:\Windows\system32\cmd.exe"
WshShell.SendKeys "telnet shwpdc03 3268{ENTER}"
WshShell.SendKeys "exit{ENTER}"
WScript.Sleep 500
WshShell.SendKeys "{ENTER}"
WScript.Sleep 500
if err.number <> 0 then
filetxt.WriteLine "shwpdc03 LDAP GC(3268) 通信失败"
else
filetxt.WriteLine "shwpdc03 LDAP GC(3268) 通信成功"
end if
WshShell.Run "cmd"
WScript.Sleep 100
WshShell.AppActivate "C:\Windows\system32\cmd.exe"
WshShell.SendKeys "telnet shwpdc03 3269{ENTER}"
WshShell.SendKeys "exit{ENTER}"
WScript.Sleep 500
WshShell.SendKeys "{ENTER}"
WScript.Sleep 500
if err.number <> 0 then
filetxt.WriteLine "shwpdc03 LDAP GC SSL(3269) 通信失败"
else
filetxt.WriteLine "shwpdc03 LDAP GC SSL(3269) 通信成功"
end if
WshShell.Run "cmd"
WScript.Sleep 100
WshShell.AppActivate "C:\Windows\system32\cmd.exe"
WshShell.SendKeys "telnet shwpdc03 53{ENTER}"
WshShell.SendKeys "exit{ENTER}"
WScript.Sleep 500
WshShell.SendKeys "{ENTER}"
WScript.Sleep 500
if err.number <> 0 then
filetxt.WriteLine "shwpdc03 DNS(53) 通信失败"
else
filetxt.WriteLine "shwpdc03 DNS(53) 通信成功"
end if
WshShell.Run "cmd"
WScript.Sleep 100
WshShell.AppActivate "C:\Windows\system32\cmd.exe"
WshShell.SendKeys "telnet shwpdc03 88{ENTER}"
WshShell.SendKeys "exit{ENTER}"
WScript.Sleep 500
WshShell.SendKeys "{ENTER}"
WScript.Sleep 500
if err.number <> 0 then
filetxt.WriteLine "shwpdc03 Kerberos(88) 通信失败"
else
filetxt.WriteLine "shwpdc03 Kerberos(88) 通信成功"
end if
WshShell.Run "cmd"
WScript.Sleep 100
WshShell.AppActivate "C:\Windows\system32\cmd.exe"
WshShell.SendKeys "telnet shwpdc03 445{ENTER}"
WshShell.SendKeys "exit{ENTER}"
WScript.Sleep 500
WshShell.SendKeys "{ENTER}"
WScript.Sleep 500
if err.number <> 0 then
filetxt.WriteLine "shwpdc03 SMB(445) 通信失败"
else
filetxt.WriteLine "shwpdc03 SMB(445) 通信成功"
end if
filetxt.WriteLine "--------------------------------------------"
filetxt.WriteLine "--------------------------------------------"
filetxt.WriteLine " "
filetxt.WriteLine "-----szwpdc06 AD端口通信测试-----"
WshShell.Run "cmd"
WScript.Sleep 100
WshShell.AppActivate "C:\Windows\system32\cmd.exe"
WshShell.SendKeys "telnet szwpdc06 135{ENTER}"
WshShell.SendKeys "exit{ENTER}"
WScript.Sleep 500
WshShell.SendKeys "{ENTER}"
WScript.Sleep 500
if err.number <> 0 then
filetxt.WriteLine "szwpdc06 RPC(135) 通信失败"
else
filetxt.WriteLine "szwpdc06 RPC(135) 通信成功"
end if
WshShell.Run "cmd"
WScript.Sleep 100
WshShell.AppActivate "C:\Windows\system32\cmd.exe"
WshShell.SendKeys "telnet szwpdc06 389{ENTER}"
WshShell.SendKeys "exit{ENTER}"
WScript.Sleep 500
WshShell.SendKeys "{ENTER}"
WScript.Sleep 500
if err.number <> 0 then
filetxt.WriteLine "szwpdc06 LDAP(389) 通信失败"
else
filetxt.WriteLine "szwpdc06 LDAP(389) 通信成功"
end if
WshShell.Run "cmd"
WScript.Sleep 100
WshShell.AppActivate "C:\Windows\system32\cmd.exe"
WshShell.SendKeys "telnet szwpdc06 636{ENTER}"
WshShell.SendKeys "exit{ENTER}"
WScript.Sleep 500
WshShell.SendKeys "{ENTER}"
WScript.Sleep 500
if err.number <> 0 then
filetxt.WriteLine "szwpdc06 LDAP SSL(636) 通信失败"
else
filetxt.WriteLine "szwpdc06 LDAP SSL(636) 通信成功"
end if
WshShell.Run "cmd"
WScript.Sleep 100
WshShell.AppActivate "C:\Windows\system32\cmd.exe"
WshShell.SendKeys "telnet szwpdc06 3268{ENTER}"
WshShell.SendKeys "exit{ENTER}"
WScript.Sleep 500
WshShell.SendKeys "{ENTER}"
WScript.Sleep 500
if err.number <> 0 then
filetxt.WriteLine "szwpdc06 LDAP GC(3268) 通信失败"
else
filetxt.WriteLine "szwpdc06 LDAP GC(3268) 通信成功"
end if
WshShell.Run "cmd"
WScript.Sleep 100
WshShell.AppActivate "C:\Windows\system32\cmd.exe"
WshShell.SendKeys "telnet szwpdc06 3269{ENTER}"
WshShell.SendKeys "exit{ENTER}"
WScript.Sleep 500
WshShell.SendKeys "{ENTER}"
WScript.Sleep 500
if err.number <> 0 then
filetxt.WriteLine "szwpdc06 LDAP GC SSL(3269) 通信失败"
else
filetxt.WriteLine "szwpdc06 LDAP GC SSL(3269) 通信成功"
end if
WshShell.Run "cmd"
WScript.Sleep 100
WshShell.AppActivate "C:\Windows\system32\cmd.exe"
WshShell.SendKeys "telnet szwpdc06 53{ENTER}"
WshShell.SendKeys "exit{ENTER}"
WScript.Sleep 500
WshShell.SendKeys "{ENTER}"
WScript.Sleep 500
if err.number <> 0 then
filetxt.WriteLine "szwpdc06 DNS(53) 通信失败"
else
filetxt.WriteLine "szwpdc06 DNS(53) 通信成功"
end if
WshShell.Run "cmd"
WScript.Sleep 100
WshShell.AppActivate "C:\Windows\system32\cmd.exe"
WshShell.SendKeys "telnet szwpdc06 88{ENTER}"
WshShell.SendKeys "exit{ENTER}"
WScript.Sleep 500
WshShell.SendKeys "{ENTER}"
WScript.Sleep 500
if err.number <> 0 then
filetxt.WriteLine "szwpdc06 Kerberos(88) 通信失败"
else
filetxt.WriteLine "szwpdc06 Kerberos(88) 通信成功"
end if
WshShell.Run "cmd"
WScript.Sleep 100
WshShell.AppActivate "C:\Windows\system32\cmd.exe"
WshShell.SendKeys "telnet szwpdc06 445{ENTER}"
WshShell.SendKeys "exit{ENTER}"
WScript.Sleep 500
WshShell.SendKeys "{ENTER}"
WScript.Sleep 500
if err.number <> 0 then
filetxt.WriteLine "szwpdc06 SMB(445) 通信失败"
else
filetxt.WriteLine "szwpdc06 SMB(445) 通信成功"
end if
filetxt.WriteLine "--------------------------------------------"
filetxt.WriteLine "--------------------------------------------"
filetxt.WriteLine " "
filetxt.WriteLine "-----DRSSHWPDC03 AD端口通信测试-----"
WshShell.Run "cmd"
WScript.Sleep 100
WshShell.AppActivate "C:\Windows\system32\cmd.exe"
WshShell.SendKeys "telnet DRSSHWPDC03 135{ENTER}"
WshShell.SendKeys "exit{ENTER}"
WScript.Sleep 500
WshShell.SendKeys "{ENTER}"
WScript.Sleep 500
if err.number <> 0 then
filetxt.WriteLine "DRSSHWPDC03 RPC(135) 通信失败"
else
filetxt.WriteLine "DRSSHWPDC03 RPC(135) 通信成功"
end if
WshShell.Run "cmd"
WScript.Sleep 100
WshShell.AppActivate "C:\Windows\system32\cmd.exe"
WshShell.SendKeys "telnet DRSSHWPDC03 389{ENTER}"
WshShell.SendKeys "exit{ENTER}"
WScript.Sleep 500
WshShell.SendKeys "{ENTER}"
WScript.Sleep 500
if err.number <> 0 then
filetxt.WriteLine "DRSSHWPDC03 LDAP(389) 通信失败"
else
filetxt.WriteLine "DRSSHWPDC03 LDAP(389) 通信成功"
end if
WshShell.Run "cmd"
WScript.Sleep 100
WshShell.AppActivate "C:\Windows\system32\cmd.exe"
WshShell.SendKeys "telnet DRSSHWPDC03 636{ENTER}"
WshShell.SendKeys "exit{ENTER}"
WScript.Sleep 500
WshShell.SendKeys "{ENTER}"
WScript.Sleep 500
if err.number <> 0 then
filetxt.WriteLine "DRSSHWPDC03 LDAP SSL(636) 通信失败"
else
filetxt.WriteLine "DRSSHWPDC03 LDAP SSL(636) 通信成功"
end if
WshShell.Run "cmd"
WScript.Sleep 100
WshShell.AppActivate "C:\Windows\system32\cmd.exe"
WshShell.SendKeys "telnet DRSSHWPDC03 3268{ENTER}"
WshShell.SendKeys "exit{ENTER}"
WScript.Sleep 500
WshShell.SendKeys "{ENTER}"
WScript.Sleep 500
if err.number <> 0 then
filetxt.WriteLine "DRSSHWPDC03 LDAP GC(3268) 通信失败"
else
filetxt.WriteLine "DRSSHWPDC03 LDAP GC(3268) 通信成功"
end if
WshShell.Run "cmd"
WScript.Sleep 100
WshShell.AppActivate "C:\Windows\system32\cmd.exe"
WshShell.SendKeys "telnet DRSSHWPDC03 3269{ENTER}"
WshShell.SendKeys "exit{ENTER}"
WScript.Sleep 500
WshShell.SendKeys "{ENTER}"
WScript.Sleep 500
if err.number <> 0 then
filetxt.WriteLine "DRSSHWPDC03 LDAP GC SSL(3269) 通信失败"
else
filetxt.WriteLine "DRSSHWPDC03 LDAP GC SSL(3269) 通信成功"
end if
WshShell.Run "cmd"
WScript.Sleep 100
WshShell.AppActivate "C:\Windows\system32\cmd.exe"
WshShell.SendKeys "telnet DRSSHWPDC03 53{ENTER}"
WshShell.SendKeys "exit{ENTER}"
WScript.Sleep 500
WshShell.SendKeys "{ENTER}"
WScript.Sleep 500
if err.number <> 0 then
filetxt.WriteLine "DRSSHWPDC03 DNS(53) 通信失败"
else
filetxt.WriteLine "DRSSHWPDC03 DNS(53) 通信成功"
end if
WshShell.Run "cmd"
WScript.Sleep 100
WshShell.AppActivate "C:\Windows\system32\cmd.exe"
WshShell.SendKeys "telnet DRSSHWPDC03 88{ENTER}"
WshShell.SendKeys "exit{ENTER}"
WScript.Sleep 500
WshShell.SendKeys "{ENTER}"
WScript.Sleep 500
if err.number <> 0 then
filetxt.WriteLine "DRSSHWPDC03 Kerberos(88) 通信失败"
else
filetxt.WriteLine "DRSSHWPDC03 Kerberos(88) 通信成功"
end if
WshShell.Run "cmd"
WScript.Sleep 100
WshShell.AppActivate "C:\Windows\system32\cmd.exe"
WshShell.SendKeys "telnet DRSSHWPDC03 445{ENTER}"
WshShell.SendKeys "exit{ENTER}"
WScript.Sleep 500
WshShell.SendKeys "{ENTER}"
WScript.Sleep 500
if err.number <> 0 then
filetxt.WriteLine "DRSSHWPDC03 SMB(445) 通信失败"
else
filetxt.WriteLine "DRSSHWPDC03 SMB(445) 通信成功"
end if
filetxt.WriteLine "--------------------------------------------"
filetxt.WriteLine "--------------------------------------------"
filetxt.WriteLine " "
filetxt.WriteLine "-----DRSSHWPDC04 AD端口通信测试-----"
WshShell.Run "cmd"
WScript.Sleep 100
WshShell.AppActivate "C:\Windows\system32\cmd.exe"
WshShell.SendKeys "telnet DRSSHWPDC04 135{ENTER}"
WshShell.SendKeys "exit{ENTER}"
WScript.Sleep 500
WshShell.SendKeys "{ENTER}"
WScript.Sleep 500
if err.number <> 0 then
filetxt.WriteLine "DRSSHWPDC04 RPC(135) 通信失败"
else
filetxt.WriteLine "DRSSHWPDC04 RPC(135) 通信成功"
end if
WshShell.Run "cmd"
WScript.Sleep 100
WshShell.AppActivate "C:\Windows\system32\cmd.exe"
WshShell.SendKeys "telnet DRSSHWPDC04 389{ENTER}"
WshShell.SendKeys "exit{ENTER}"
WScript.Sleep 500
WshShell.SendKeys "{ENTER}"
WScript.Sleep 500
if err.number <> 0 then
filetxt.WriteLine "DRSSHWPDC04 LDAP(389) 通信失败"
else
filetxt.WriteLine "DRSSHWPDC04 LDAP(389) 通信成功"
end if
WshShell.Run "cmd"
WScript.Sleep 100
WshShell.AppActivate "C:\Windows\system32\cmd.exe"
WshShell.SendKeys "telnet DRSSHWPDC04 636{ENTER}"
WshShell.SendKeys "exit{ENTER}"
WScript.Sleep 500
WshShell.SendKeys "{ENTER}"
WScript.Sleep 500
if err.number <> 0 then
filetxt.WriteLine "DRSSHWPDC04 LDAP SSL(636) 通信失败"
else
filetxt.WriteLine "DRSSHWPDC04 LDAP SSL(636) 通信成功"
end if
WshShell.Run "cmd"
WScript.Sleep 100
WshShell.AppActivate "C:\Windows\system32\cmd.exe"
WshShell.SendKeys "telnet DRSSHWPDC04 3268{ENTER}"
WshShell.SendKeys "exit{ENTER}"
WScript.Sleep 500
WshShell.SendKeys "{ENTER}"
WScript.Sleep 500
if err.number <> 0 then
filetxt.WriteLine "DRSSHWPDC04 LDAP GC(3268) 通信失败"
else
filetxt.WriteLine "DRSSHWPDC04 LDAP GC(3268) 通信成功"
end if
WshShell.Run "cmd"
WScript.Sleep 100
WshShell.AppActivate "C:\Windows\system32\cmd.exe"
WshShell.SendKeys "telnet DRSSHWPDC04 3269{ENTER}"
WshShell.SendKeys "exit{ENTER}"
WScript.Sleep 500
WshShell.SendKeys "{ENTER}"
WScript.Sleep 500
if err.number <> 0 then
filetxt.WriteLine "DRSSHWPDC04 LDAP GC SSL(3269) 通信失败"
else
filetxt.WriteLine "DRSSHWPDC04 LDAP GC SSL(3269) 通信成功"
end if
WshShell.Run "cmd"
WScript.Sleep 100
WshShell.AppActivate "C:\Windows\system32\cmd.exe"
WshShell.SendKeys "telnet DRSSHWPDC04 53{ENTER}"
WshShell.SendKeys "exit{ENTER}"
WScript.Sleep 500
WshShell.SendKeys "{ENTER}"
WScript.Sleep 500
if err.number <> 0 then
filetxt.WriteLine "DRSSHWPDC04 DNS(53) 通信失败"
else
filetxt.WriteLine "DRSSHWPDC04 DNS(53) 通信成功"
end if
WshShell.Run "cmd"
WScript.Sleep 100
WshShell.AppActivate "C:\Windows\system32\cmd.exe"
WshShell.SendKeys "telnet DRSSHWPDC04 88{ENTER}"
WshShell.SendKeys "exit{ENTER}"
WScript.Sleep 500
WshShell.SendKeys "{ENTER}"
WScript.Sleep 500
if err.number <> 0 then
filetxt.WriteLine "DRSSHWPDC04 Kerberos(88) 通信失败"
else
filetxt.WriteLine "DRSSHWPDC04 Kerberos(88) 通信成功"
end if
WshShell.Run "cmd"
WScript.Sleep 100
WshShell.AppActivate "C:\Windows\system32\cmd.exe"
WshShell.SendKeys "telnet DRSSHWPDC04 445{ENTER}"
WshShell.SendKeys "exit{ENTER}"
WScript.Sleep 500
WshShell.SendKeys "{ENTER}"
WScript.Sleep 500
if err.number <> 0 then
filetxt.WriteLine "DRSSHWPDC04 SMB(445) 通信失败"
else
filetxt.WriteLine "DRSSHWPDC04 SMB(445) 通信成功"
end if
WScript.Sleep 100
filetxt.WriteLine "--------------------------------------------"
filetxt.WriteLine "--------------------------------------------"
filetxt.WriteLine " "
filetxt.WriteLine "-----AD 角色分布-----"
Set objRootDSE = GetObject("LDAP://rootDSE")
Dim text
' Schema Master
Set objSchema = GetObject("LDAP://" & objRootDSE.Get("schemaNamingContext"))
strSchemaMaster = objSchema.Get("fSMORoleOwner")
Set objNtds = GetObject("LDAP://" & strSchemaMaster)
Set objComputer = GetObject(objNtds.Parent)
text="Forest-wide Schema Master FSMO: " & objComputer.Name & vbCrLf
Set objNtds = Nothing
Set objComputer = Nothing
' Domain Naming Master
Set objPartitions = GetObject("LDAP://CN=Partitions," & _
objRootDSE.Get("configurationNamingContext"))
strDomainNamingMaster = objPartitions.Get("fSMORoleOwner")
Set objNtds = GetObject("LDAP://" & strDomainNamingMaster)
Set objComputer = GetObject(objNtds.Parent)
text=text&"Forest-wide Domain Naming Master FSMO: " & objComputer.Name & vbCrLf
Set objNtds = Nothing
Set objComputer = Nothing
' PDC Emulator
Set objDomain = GetObject("LDAP://" & objRootDSE.Get("defaultNamingContext"))
strPdcEmulator = objDomain.Get("fSMORoleOwner")
Set objNtds = GetObject("LDAP://" & strPdcEmulator)
Set objComputer = GetObject(objNtds.Parent)
text=text&"Domain's PDC Emulator FSMO: " & objComputer.Name & vbCrLf
Set objNtds = Nothing
Set objComputer = Nothing
' RID Master
Set objRidManager = GetObject("LDAP://CN=RID Manager$,CN=System," & _
objRootDSE.Get("defaultNamingContext"))
strRidMaster = objRidManager.Get("fSMORoleOwner")
Set objNtds = GetObject("LDAP://" & strRidMaster)
Set objComputer = GetObject(objNtds.Parent)
text=text&"Domain's RID Master FSMO: " & objComputer.Name & vbCrLf
Set objNtds = Nothing
Set objComputer = Nothing
' Infrastructure Master
Set objInfrastructure = GetObject("LDAP://CN=Infrastructure," & _
objRootDSE.Get("defaultNamingContext"))
strInfrastructureMaster = objInfrastructure.Get("fSMORoleOwner")
Set objNtds = GetObject("LDAP://" & strInfrastructureMaster)
Set objComputer = GetObject(objNtds.Parent)
text=text&"Domain's Infrastructure Master FSMO: " & objComputer.Name & vbCrLf
WScript.Sleep 200
filetxt.WriteLine text
filetxt.WriteLine "--------------------------------------------"
filetxt.WriteLine "--------------------------------------------"
filetxt.WriteLine " "
filetxt.WriteLine "------检查组策略共享SYSVOL的状态'1'为正常值------"
v=wshShell.regread("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Netlogon\Parameters\SysvolReady")
filetxt.WriteLine v
filetxt.WriteLine "--------------------------------------------"
filetxt.WriteLine "--------------------------------------------"
filetxt.WriteLine " "
WScript.Sleep 100
filetxt.WriteLine "------检查GC的状态'1'为正常值------"
WScript.Sleep 100
s=wshShell.regread("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\NTDS\Parameters\Global Catalog Promotion Complete")
WScript.Sleep 200
filetxt.WriteLine s
filetxt.WriteLine "--------------------------------------------"
filetxt.WriteLine "--------------------------------------------"
filetxt.WriteLine "------检查域控制器之间的复制------"
filetxt.WriteLine "在164.25上运行replmon检查复制"
filetxt.WriteLine "--------------------------------------------"
filetxt.WriteLine "--------------------------------------------"
filetxt.WriteLine "-----DCDIAG log-----"
filetxt.WriteLine "--------------------------------------------"
filetxt.WriteLine "--------------------------------------------"
filetxt.WriteLine "-----repadmin log-----"
filetxt.WriteLine "--------------------------------------------"
filetxt.WriteLine "--------------------------------------------"
filetxt.WriteLine "-----NetDiag log-----"
filetxt.WriteLine "--------------------------------------------"
filetxt.WriteLine "--------------------------------------------"
filetxt.WriteLine "-----DHCP SERVER ----"
----SEND MAIL----
@echo off
:::::::::::::: 参数设置::::::::::::::
set [email protected]
set user="[email protected]"
set pass=XXX
for /f "delims=" %%a in (suj.txt) do call set "subj=%%subj%%%%a "
set [email protected]
set [email protected]
set attach="*.rar"
set server=128.236.160.12
echo
set mail=body.txt
set debug=-debug -log blat.log -timestamp
::::::::::::::::: 运行blat :::::::::::::::::
blat %mail% -to %to% -cc %cc% -base64 -charset Gb2312 -subject %subj% -attach %attach% -server %server% -f %from% -u %user% -pw %pass% %debug%