Jump to content

Querying Active Directory from AutoIT


Recommended Posts

I currently use an autoit program in a Windows 2000 Active Directory domain. In AutoIT, there is a macro reference for a username. I use this username in a log file I generate from Autoit. The username is typically an Active Directory (AD) username for my domain. I would like my autoit script to pull the Full Name property from Active Directory so that I can log this information as well.

Any ideas?

Link to comment
Share on other sites

I would like my autoit script to pull the Full Name property from Active Directory

use wmi

_fullname()
  
  Func _fullname()
      $objInfo = ObjCreate("ADSystemInfo")
      $objUser = ObjGet("LDAP://" & $objInfo.Username & "")
      if @error then
          return @UserName
      endif
  Return $objUser.fullname
  EndFunc

Yes I stole it, so what

Link to comment
Share on other sites

use wmi

_fullname()
  
  Func _fullname()
      $objInfo = ObjCreate("ADSystemInfo")
      $objUser = ObjGet("LDAP://" & $objInfo.Username & "")
      if @error then
          return @UserName
      endif
  Return $objUser.fullname
  EndFunc

Yes I stole it, so what

Awesome. Thanks.

Now, I know squat about LDAP queries, so if my AD domain is say "gorak.com", how would I format the query?

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...