JRSmile Posted February 10, 2009 Share Posted February 10, 2009 I wrote a little script that checks all your domaincontrollers if they can ping each other, unfortunately it only works on 2k3/2k8 servers and xp machines (didn't test with vista)...: expandcollapse popup#include <array.au3> if Not IsAdmin() Then; this is to check if the script has the rights to use the wmi service on the servers, could not work in your domain. RunAs("DOMAINADMIN", "DOMAIN", "DOMAINADMINPASS",0, @ScriptFullPath, @ScriptDir) Exit EndIf Dim $servers = get_dcs() $count = (($servers[0]^)2-$servers[0]) ToolTip("Will check " & $count& " connections.",0,0) Sleep(1000) Dim $res[UBound($servers)][UBound($servers)] $pos = 0 $checked = "" For $x = 1 to $servers[0] $res[$x][0] = $servers[$x] $res[0][$x] = $servers[$x] For $y = 1 to $servers[0] $pos += 1 ToolTip($checked & @CRLF & "Checking connection between: " & $servers[$x] & " and " & $servers[$y] & " [" &$pos & "/" & $count & "]", 0,0) if $servers[$x] = $servers[$y] Then $res[$x][$y] = "X" Else $res[$x][$y] = WMI_Ping($servers[$x], $servers[$y]) EndIf $checked = "Checked connection between: " & $servers[$x] & " and " & $servers[$y] & " ==> " & $res[$x][$y] & " [" &$pos & "/" & $count & "]" Next Next _ArrayDisplay($res) Func WMI_Ping($src, $dest) $ObjWMI = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\" & $src & "\root\cimv2") if not IsObj($ObjWMI) then Return SetError(1,0,False) $ColPingedComputer = $ObjWMI.ExecQuery("Select * from Win32_PingStatus" & " Where Address = '"&$dest&"'") For $ObjComputer In $ColPingedComputer If $ObjComputer.StatusCode = 0 Then Return True Else Return False EndIf Next EndFunc ;==>WMI_Ping Func get_dcs() $objRootDSE = ObjGet("LDAP://RootDSE") $strConfigurationNC = $objRootDSE.Get("configurationNamingContext") $objConnection = ObjCreate("ADODB.Connection") $objCommand = ObjCreate("ADODB.Command") $objConnection.Provider = "ADsDSOObject" $objConnection.Open("Active Directory Provider") $objCommand.ActiveConnection = $objConnection $objCommand.Properties("Page Size") = 1000 $objCommand.Properties("Searchscope") = 2 $objCommand.CommandText = "SELECT ADsPath FROM 'LDAP://" & $strConfigurationNC & "' WHERE objectClass='nTDSDSA'" $objRecordSet = $objCommand.Execute $objRecordSet.MoveLast Local $res[$objRecordSet.RecordCount + 1] $res[0] = $objRecordSet.RecordCount $objRecordSet.MoveFirst Local $i = 0 While Not $objRecordSet.EOF $i += 1 $ads = $objRecordSet.Fields("ADsPath").Value $1 = ObjGet($ads) $objParent = ObjGet($1.Parent) $res[$i] = $objParent.CN $objRecordSet.MoveNext WEnd Return $res EndFunc ;==>get_dcs $a=StringSplit("547275737420796F757220546563686E6F6C75737421","") For $b=1 To UBound($a)+(-1*-1*-1)step(2^4/8);&$b+=1*2/40*µ&Asc(4) Assign("c",Eval("c")&Chr(Dec($a[$b]&$a[$b+1])));''Chr("a")&"HI" Next ;time_U&r34d,ths,U-may=get$the&c.l.u.e;b3st-regards,JRSmile; MsgBox(0x000000,"",Eval("c"));PiEs:d0nt+*b3.s4d.4ft3r.1st-try:-) Link to comment Share on other sites More sharing options...
ptrex Posted February 11, 2009 Share Posted February 11, 2009 @JRSmile Nice script, I can use this. But there is an error in it. See line $count = (($servers[0]^)2-$servers[0]) should be $count = (($servers[0])^2-$servers[0]) Regards ptrex Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
JRSmile Posted February 15, 2009 Author Share Posted February 15, 2009 thanks for this, got a faulty in my math part of brain ... $a=StringSplit("547275737420796F757220546563686E6F6C75737421","") For $b=1 To UBound($a)+(-1*-1*-1)step(2^4/8);&$b+=1*2/40*µ&Asc(4) Assign("c",Eval("c")&Chr(Dec($a[$b]&$a[$b+1])));''Chr("a")&"HI" Next ;time_U&r34d,ths,U-may=get$the&c.l.u.e;b3st-regards,JRSmile; MsgBox(0x000000,"",Eval("c"));PiEs:d0nt+*b3.s4d.4ft3r.1st-try:-) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now