Contact Info

Crumbtrail

ActiveXperts.com » Administration » Scripts » Adsi

Verify Whether an Account Exists in a Windows NT 4.0 Domain in Windows

You can use any of the VBScript programs below in ActiveXperts Network Monitor. Click here for an explanation about how to include scripts in ActiveXperts Network Monitor.

Verify Whether an Account Exists in a Windows NT 4.0 Domain in Windows using VBScript, WMI and LDAP

Example(s)

strUserName = "kenmyer"
Set objDomain = GetObject("WinNT://fabrikam")
objDomain.Filter = Array("user")
intFound = 0

For Each User In objDomain
    If lcase(User.Name) = lcase(strUserName) Then
        intFound = 1   
    End If    
Next

If intFound = 1 Then
    WScript.Echo "The " & strUserName & " account already exists."
Else
    WScript.Echo "The " & strUserName & " account does not exist in the domain."
End If