I've tried finding the answer to this and it's hiding from me (I bet 15 people will respond with a link I overlooked!!)
I want to pull a user object from AD in vbscript by typing a login name in a box, or passing it as a parameter... but I'm having trouble finding a way to do this without either having to type the full DN or know what OU the user is in. It seems easy but I've spent way too much time on it...
Here's the code:
strUser = InputBox("Enter object name to search for","Search for object")
Set objUser = GetObject("LDAP://CN=" & strUser & ",DC=domain,DC=com")
WScript.Echo objUser.userPrincipalName
This works if I add CN=Users or OU=___ and the object is in that container, but otherwise it just says object not found on the server. (oh and WScript.Echo is not the goal here, just a test J)
Thanks -
Rich
-------APPLEBEE'S INTERNATIONAL, INC. CONFIDENTIALITY NOTICE------- PRIVILEGED / CONFIDENTIAL INFORMATION may be contained in this message or any attachments. This information is strictly confidential and may be subject to attorney-client privilege. This message is intended only for the use of the named addressee. If you are not the intended recipient of this message, unauthorized forwarding, printing, copying, distribution, or using such information is strictly prohibited and may be unlawful. If you have received this in error, you should kindly notify the sender by reply e-mail and immediately destroy this message. Unauthorized interception of this e-mail is a violation of federal criminal law. Applebee's International, Inc. reserves the right to monitor and review the content of all messages sent to and from this e-mail address. Messages sent to or from this e-mail address may be stored on the Applebee's International, Inc. e-mail system.
