Ask the Expert

Checking for a specific user in a domain

Is there a way I can check for the existence of a specific user account in the domain?

Requires Free Membership to View

You can use the following VB Script to verify that an individual already has an account in the domain. Replace the text in bold with your specific information.
Dim oUser, oDomain
Set oDomain = GetObject("WinNT://"&sDomainName)
oDomain.Filter = Array("user")

For Each oUser In oDomain
If LCase(oUser.Name) = LCase(sUserName) Then
WScript.Echo oUser.Name & " already has an account."
End If

This was first published in June 2004

There are Comments. Add yours.

TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: