Set oArgs = WScript.Arguments
Set objDomain = GetObject("WinNT://domainname")
objDomain.Filter = Array("User")
str2Find = oArgs(0)
For Each aUser In objDomain
If LCase(str2Find) = LCase(aUser.FullName) Then
Wscript.Echo str2Find & "=" & aUser.Name
strUser = aUser.Name
End If
Next
Set objDomain = Nothing
Now you can search a username by running: cscript username.vbs "Full Username"
No comments:
Post a Comment