I have a code to retrieve user information from AD, such as email address, phone number, etc. etc. The codes I'm currently using are:
Set objSysInfo = CreateObject("ADSystemInfo")
strUser = objSysInfo.UserName
msgbox(strUser)
Set objUser = GetObject("LDAP://" & strUser)
It receives current user information. But now I need to analyze the username and get information based on this.
I tried changing objSysinfo.UserName to username and it was empty.
Set objSysInfo = CreateObject("ADSystemInfo")
strUser = "SomeUserName"
msgbox(strUser)
Set objUser = GetObject("LDAP://" & strUser)
How can I get information from AD based on the provided username?
source
share