Retrieve user details from Active Directory using SID
- by er4z0r
Hi,
How can I find a user in my AD when I have his/her SID.
I don't want to rely on other attributes, since I am trying to detect changes to these.
Example:
I get a message about a change to user record containing:
Message: User Account Changed:
Target Account Name: test12
Target Domain: DOMAIN
Target Account ID: %{S-1-5-21-3968247570-3627839482-368725868-1110}
Caller User Name: Administrator
Caller Domain: DOMAIN
Caller Logon ID: (0x0,0x62AB1)
Privileges: -
I want to notify the user about the change. So I need their account-information from AD.
When I try to retrieve the user's data from AD via VBScript like this:
Wscript.StdOut.writeLine "Found an Account ID: " & objMatch.value
Set objUser = GetObject("LDAP://GUID=1521396824757036278394823687258681110")
Wscript.StdOut.writeLine objUser
I receive an error stating
The handle is invalid
Code:80070006