I have a code to retrieve the details of a user from the AD such as email address, phone number etc, etc. The codes I am currently using is:
Set objSysInfo = CreateObject("ADSystemInfo")
strUser = objSysInfo.UserName
msgbox(strUser)
Set objUser = GetObject("LDAP://" & strUser)
It gets the currently logged in user's details. But what I need to do now is to parse in the user's username and retrieve the details based on that.
I have tried to change objSysinfo.UserName to the username and it returned blank.
Set objSysInfo = CreateObject("ADSystemInfo")
strUser = "SomeUserName"
msgbox(strUser)
Set objUser = GetObject("LDAP://" & strUser)
How should I go about retrieving the details from the AD based on a user name provided?