I need to query some Active Directory information based on a username being entered.
I used this which works great for the currently logged in user:
Set ADSysInfo = CreateObject("ADSystemInfo")
Set CurrentUser = GetObject("LDAP://" & ADSysInfo.UserName)
I tried this but it came back with "no such object". Not sure what I'm supposed to be passing in place userInitials.
userInitials = InputBox("Enter User's Initials")
Set CurrentUser = GetObject("LDAP://CN=" & userInitials & ",OU=Current Users,DC=domain,DC=com")
How do I substitute ADSysInfo.UserName for the prompted userInitials?