jerem488 Posted November 4, 2008 Share Posted November 4, 2008 Hello, I wanted to know how I can tell the group to which a user is in active directory? thanks in advance Qui ose gagneWho Dares Win[left]CyberExploit[/left] Link to comment Share on other sites More sharing options...
PsaltyDS Posted November 4, 2008 Share Posted November 4, 2008 Hello, I wanted to know how I can tell the group to which a user is in active directory? thanks in advance Using LDAP interface: #include <array.au3> Global $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc") Global $sServer = "myserver.mydomain.com" Global $sUserPath = "cn=User Name, ou=Users, ou=Users and Computers, dc=mydomain, dc=com" Global $oUser, $avGroups ; Get user object Local $oUser = ObjGet("LDAP://" & $sServer & "/" & $sUserPath) If IsObj($oUser) Then $avGroups = $oUser.GetEx("memberof") If IsArray($avGroups) Then _ArrayDisplay($avGroups, "$avGroups") Else MsgBox(16, "Error", "$avGroups is not an array.") EndIf Else MsgBox(16, "Error", "$oUser is not an object.") EndIf Func MyErrFunc() $HexNumber = Hex($oMyError.number, 8) MsgBox(0, "", "We intercepted a COM Error !" & @CRLF & _ "Number is: " & $HexNumber & @CRLF & _ "Windescription is: " & $oMyError.windescription) $g_eventerror = 1; something to check for when this function returns EndFunc ;==>MyErrFunc Note that you can get varied results based on the server that you query (specified by $sServer). If it is a member server, DC, or has the GC you can different results for each. So do some research on the results. 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...
jerem488 Posted November 4, 2008 Author Share Posted November 4, 2008 I can't test this code this evening. I could tomorrow. But if this code works, you are an engineering ! Because I have long searched....... And no response. thank you Qui ose gagneWho Dares Win[left]CyberExploit[/left] Link to comment Share on other sites More sharing options...
jerem488 Posted November 5, 2008 Author Share Posted November 5, 2008 (edited) I have an error when I execute this code,But I have only a small question...When you put :Global $sUserPath = "cn=User Name, ou=Users, ou=Users and Computers, dc=mydomain, dc=com"I have informed all except "ou=Users and Computers", I don't see wht I must inform here, so I deleted this field.cn=user name ==>> the user name it's simply !ou = users, I have put the organization unit name...ou=Users and Computers = not filleddc= my domain (it's clear)and dc = frand when I execute this code I have an error messagethanks Edited November 5, 2008 by jerem488 Qui ose gagneWho Dares Win[left]CyberExploit[/left] Link to comment Share on other sites More sharing options...
jerem488 Posted November 5, 2008 Author Share Posted November 5, 2008 I tested while putting Global $sUserPath = "cn=User1, ou=My Organisation Unit, ou=User1, dc=mydomain, dc=fr" We intercepted a COM Error! Number is: 80072030. Qui ose gagneWho Dares Win[left]CyberExploit[/left] Link to comment Share on other sites More sharing options...
PsaltyDS Posted November 5, 2008 Share Posted November 5, 2008 I tested while putting Global $sUserPath = "cn=User1, ou=My Organisation Unit, ou=User1, dc=mydomain, dc=fr" We intercepted a COM Error! Number is: 80072030. Go into Active Directory Users and Computers tool on the mydomain.fr domain. When you drill down to User1, what OU's do you drill down through? The path you describe above would be: ; mydomain.fr ; User1 <--- Is this really an OU? ; My Oranisation Unit ; User1 <--- actual user container object Is that really what it looks like? Also use the Display Name of the user, not for example login ID. You might have login ID of User1 but Display Name of "User One". 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...
jerem488 Posted November 6, 2008 Author Share Posted November 6, 2008 In Active Directory I have like in the picture : Qui ose gagneWho Dares Win[left]CyberExploit[/left] Link to comment Share on other sites More sharing options...
PsaltyDS Posted November 6, 2008 Share Posted November 6, 2008 In Active Directory I have like in the picture : So, it would be more like: Global $sUserPath = "cn=utilisateur1, ou=PPC, dc=ppc, dc=freyssinet, dc=com" It looks like your convention if for the display name and login to be the same, and the users you show are all in the PPC OU. 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...
jerem488 Posted November 7, 2008 Author Share Posted November 7, 2008 I might try it next Monday I hope it works well thank you. Qui ose gagneWho Dares Win[left]CyberExploit[/left] Link to comment Share on other sites More sharing options...
jerem488 Posted November 10, 2008 Author Share Posted November 10, 2008 Hello, Oh sorry... But I tried to reproduce the "Active directory" of my business but in fact it is not just that. It's rather this picture : Qui ose gagneWho Dares Win[left]CyberExploit[/left] Link to comment Share on other sites More sharing options...
PsaltyDS Posted November 10, 2008 Share Posted November 10, 2008 Hello,Oh sorry... But I tried to reproduce the "Active directory" of my business but in fact it is not just that.It's rather this picture :So... does it work after you correct the LDAP path string? 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...
jerem488 Posted November 11, 2008 Author Share Posted November 11, 2008 (edited) No.... not yet I put this code : Global $sUserPath = "cn=COMBCT, ou=PPC, dc=dppc dc=fr" Edited November 11, 2008 by jerem488 Qui ose gagneWho Dares Win[left]CyberExploit[/left] Link to comment Share on other sites More sharing options...
PsaltyDS Posted November 12, 2008 Share Posted November 12, 2008 No.... not yet I put this code : Global $sUserPath = "cn=COMBCT, ou=PPC, dc=dppc dc=fr" And what happens? Do you get a COM error, an error MsgBox, or what? 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...
jerem488 Posted November 17, 2008 Author Share Posted November 17, 2008 (edited) Yes I have an error messagead_error.bmp Edited November 17, 2008 by jerem488 Qui ose gagneWho Dares Win[left]CyberExploit[/left] Link to comment Share on other sites More sharing options...
PsaltyDS Posted November 17, 2008 Share Posted November 17, 2008 Yes I have an error messageIs this typo still in your path string? Global $sUserPath = "cn=COMBCT, ou=PPC, dc=dppc, dc=fr" 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...
jerem488 Posted November 18, 2008 Author Share Posted November 18, 2008 (edited) pfffff I'm really stupid ! ! so the program works, thnak you... But I would like to have the name of the service found in the windows Active Directory Edited November 18, 2008 by jerem488 Qui ose gagneWho Dares Win[left]CyberExploit[/left] Link to comment Share on other sites More sharing options...
PsaltyDS Posted November 18, 2008 Share Posted November 18, 2008 so the program works, thnak you...But I would like to have the name of the service found in the windows Active DirectoryService? What kind of service? I don't have that column available in my AD Users and Computers, so I don't know what you are looking for. 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...
jerem488 Posted November 18, 2008 Author Share Posted November 18, 2008 (edited) hello, we cand find this colum is in the properties of the users. In the part "organization". Edited November 18, 2008 by jerem488 Qui ose gagneWho Dares Win[left]CyberExploit[/left] Link to comment Share on other sites More sharing options...
PsaltyDS Posted November 18, 2008 Share Posted November 18, 2008 hello,we cand find this colum is in the properties of the users. In the part "organization".I only have Title/Company/Department/Manager on that tab. But the schema is extensible, maybe "Service" was added to the schema for your particular domain. 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...
jerem488 Posted November 18, 2008 Author Share Posted November 18, 2008 No, not on the principal window of Active directory but if you make a mouse click on a user and choose properties, in the new window of the selected user, you have a part "organization". Qui ose gagneWho Dares Win[left]CyberExploit[/left] 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