Jump to content

lonswe01

Members
  • Posts

    6
  • Joined

  • Last visited

lonswe01's Achievements

Seeker

Seeker (1/7)

0

Reputation

  1. Thanks alot. This information is very helpful.
  2. Thanks a lot. This informations is verry helpfull.
  3. Thanks for the quick reply. I am trying to create a script that will auto fill a form and register it using the current users first name, last name and username. I have been able to query the username localy using $usrname=@username, Now i need to query active directory to recieve the GivenName (firstname) and Sn (lastname). I have found alot of scripts on here but I am new and learning. From this point which will conect to my AD. How do i tell ad to give me the GivenName and SN output based on the logged in user by the $username. Local $objCommand = ObjCreate("ADODB.Command") Local $objConnection = ObjCreate("ADODB.Connection") $objConnection.Provider = "ADsDSOObject" $objConnection.Open ("Active Directory Provider") $objCommand.ActiveConnection = $objConnection Local $strBase = "<LDAP://dc=,dc=,dc=,dc=>" Local $strFilter = "(&(objectCategory=person)(objectClass=user)(sAMAccountName=*))" Local $strAttributes = "cn,sAMAccountName,displayName,sn,distinguishedName" Local $strQuery = $strBase & ";" & $strFilter & ";" & $strAttributes & ";subtree" $objCommand.CommandText = $strQuery $objCommand.Properties ("Page Size") = 100 $objCommand.Properties ("Timeout") = 30 $objCommand.Properties ("Cache Results") = False $ADS_SCOPE_SUBTREE = 2 $objCommand.Properties ("searchscope") = $ADS_SCOPE_SUBTREE Local $objRecordSet = $objCommand.Execute Thanks
  4. Does anyone have a script that will query AD based on the logged on users $username. Thanks
×
×
  • Create New...