rikho Posted June 18, 2009 Share Posted June 18, 2009 Hello, I want to connect an active directory with this comande line $Userobj = ObjGet("LDAP://" & $strDomain & "/" & $strComputer) ;& " ,user") in this script. expandcollapse popup$File = FileOpen($srv_list, 0) While 1 $strDomain = FileReadLine($File) If @error = -1 Then ExitLoop $tt = $tt + 1 $p1 = ($tt * 100) / ($total) GUICtrlSetData($Progress1, $p1) GUICtrlSetData($info, 'Analyse on ' & $strDomain) $Userobj = ObjGet("winnt://" & $strDomain & "/" & $strComputer);& " ,user") If Not IsObj($Userobj) Then $error = 1 ExitLoop Else $error = 0 If $Userobj.IsAccountLocked = 0 Then GUICtrlSetData($state, "Not locked") GUICtrlSetFont($state, 10, 800, 0, "Arial") Else $srv_found = @ScriptDir & '\srv_found.txt' $fop_srv_found = FileOpen($srv_found, 1) FileWriteLine($fop_srv_found, '->> ' & $strDomain & @CRLF) FileClose($fop_srv_found) GUICtrlSetData($state, "Locked") GUICtrlSetFont($state, 10, 800, 0, "Arial") $locked = $locked + 1 EndIf EndIf If $error = 0 Then $1 = $Userobj.description GUICtrlSetData($description, $1) $2 = $Userobj.Name GUICtrlSetData($fullname, $2) $3 = $Userobj.Profile GUICtrlSetData($profile, $3) EndIf WEnd Unfortunatly, this is works only on a computer that is IN the domain and not in an other Can u help me to connect an AD via LDAP command from a computer that is not in the domain but in an other ?? Thx a lot to my savers Link to comment Share on other sites More sharing options...
rikho Posted June 18, 2009 Author Share Posted June 18, 2009 Need Guru help plz Link to comment Share on other sites More sharing options...
water Posted June 18, 2009 Share Posted June 18, 2009 I would first check if you can access the other domain using a tool like ADExplorer. It's free and it doesn't need an installation. Just run it and check if you have the correct rights to access the other domain. If you can access this domain then the adfunctions.udf can help you access the needed information. My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
rikho Posted June 18, 2009 Author Share Posted June 18, 2009 (edited) I would first check if you can access the other domain using a tool like ADExplorer. It's free and it doesn't need an installation. Just run it and check if you have the correct rights to access the other domain. If you can access this domain then the adfunctions.udf can help you access the needed information.The connexion is successfully on the domain with ADExplorer on a computer that is not on the same domaini got adfunction.au3 UDF, i don't use it anymore in my previous script.Anyway thx for ure responding. Edited June 18, 2009 by rikho Link to comment Share on other sites More sharing options...
PsaltyDS Posted June 18, 2009 Share Posted June 18, 2009 I can't test this right now, but it should get a connection to LDAP using alternative credentials. It's just AutoIt conversion of some VBScript examples floating around on MSDN via Google: Global Const $ADS_SECURE_AUTHENTICATION = 0x1 Global Const $ADS_SERVER_BIND = 0x200 Global $sLDAPServer = "MyServerName" Global $sLDAPPath = "LDAP://" & $sLDAPServer & "/DC=MySubDomain,DC=MyDomain,DC=com" Global $sUserName = "MyUser" Global $sPassword = "MyPa$$word" Global $iFlags = $ADS_SECURE_AUTHENTICATION + $ADS_SERVER_BIND Global $oDSO = ObjGet("LDAP:") Global $oLDAP = $oDSO.OpenDSObject($sLDAPPath, $sUserName, $sPassword, $iFlags) Post the results if you get to try it. JiBe 1 Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
water Posted June 19, 2009 Share Posted June 19, 2009 You can use adfunctions.au3 to connect to a different AD. Adfunctions by default uses the current AD domain your computer is connected to. If you change the following lines in adfunctions.au3 (comment out the first three lines, uncomment the last three lines and change the values of $strDNSDomain, $strHostServer and $strConfigruation) all functions in the udf should access the new AD domain. Global $strDNSDomain = $objRootDSE.Get("defaultNamingContext"); Retrieve the current AD domain name Global $strHostServer = $objRootDSE.Get("dnsHostName"); Retrieve the name of the connected DC Global $strConfiguration = $objRootDSE.Get("ConfigurationNamingContext"); Retrieve the Configuration naming context ; Or use comment out above 3 lines and uncomment below to specify settings: ;Global $strDNSDomain = "DC=subdomain,DC=example,DC=com" ;Global $strHostServer = "servername.subdomain.example.com" ;Global $strConfiguration = "CN=Configuration,DC=subdomain,DC=example,DC=com" My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
rikho Posted June 22, 2009 Author Share Posted June 22, 2009 I can't test this right now, but it should get a connection to LDAP using alternative credentials. It's just AutoIt conversion of some VBScript examples floating around on MSDN via Google: Global Const $ADS_SECURE_AUTHENTICATION = 0x1 Global Const $ADS_SERVER_BIND = 0x200 Global $sLDAPServer = "MyServerName" Global $sLDAPPath = "LDAP://" & $sLDAPServer & "/DC=MySubDomain,DC=MyDomain,DC=com" Global $sUserName = "MyUser" Global $sPassword = "MyPa$$word" Global $iFlags = $ADS_SECURE_AUTHENTICATION + $ADS_SERVER_BIND Global $oDSO = ObjGet("LDAP:") Global $oLDAP = $oDSO.OpenDSObject($sLDAPPath, $sUserName, $sPassword, $iFlags) Post the results if you get to try it. i try this asap ! Thx alot to all ! JiBe 1 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