Find Login in AD
Many times we require to know if particular login is a part of ad user group. Or sometimes we need to know a AD group and wanted to know who all logins are part of it.
There are many different ways to achieve this.
-
I follow this step to create a shortcut on my desktop where I can easily find the logins
Please follow the process as
START-> RUN -> rundll32 dsquery, OpenQueryWindow
You can find all the AD you are part of, using this.
-
Start->Settings->Control Panel -> Administrator Tools -> Active Directory User and Computers
Select the Domain you want to find login, right click that domain and choose “Find” option.

Hope this will help someone
Reference:
http://ist.uwaterloo.ca/security/howto/2006-12-13/
Here is a script for the same
On Error Resume Next
Set objSysInfo = CreateObject(“ADSystemInfo”) ‘Bind to AD
Set objNet = CreateObject(“WScript.Network”)
strCompDN = objSysInfo.ComputerName ‘DN for computer, e.g. “CN=VISTAWORKSTATION,OU=Child OU Name,OU=Parent OU Name,DC=domain,DC=com”
Set objComp = GetObject(“LDAP://” & strCompDN) ‘IADsComputer object
strUserDN = objSysInfo.UserName ‘DN for user, e.g. “CN=John Smith,OU=Child OU Name,OU=Parent OU Name,DC=domain,DC=com”
Set objUser = GetObject(“LDAP://” & strUserDN) ‘IADsUser object
strUsrLogin = LCase(objNet.UserName)
strNow = Now
strDateStamp = DatePart(“yyyy”,strNow) & _
Right(“0″ & DatePart(“m”,strNow), 2) & _
Right(“0″ & DatePart(“d”,strNow), 2) & _
“@” & _
Right(“0″ & DatePart(“h”,strNow), 2) & _
Right(“0″ & DatePart(“n”,strNow), 2)
‘RegExp object used to perform a simple match on IP address
Set objRE = New RegExp
objRE.IgnoreCase = True
‘Note this regexp pattern isn’t “correct” for matching an IPv4 address properly, but since WMI will return an
‘array of IP addresses, this is sufficient to distinguish IPv4 vs IPv6
objRE.Pattern = “^\d+\.\d+\.\d+\.\d+$”
strIP = “”
‘Connect to WMI and retreive all network adapters
Set objWMI = GetObject(“winmgmts:”)
Set colNICs = objWMI.ExecQuery(“SELECT * FROM Win32_NetworkAdapterConfiguration”)
‘Get the IP(s) assigned to whichever network adapter has our default gateway
If colNICs.Count > 0 Then
For Each objNIC in colNICs
If IsArray(objNIC.DefaultIPGateway) Then
arrIP = objNIC.IPAddress
For i = 0 To UBound(arrip)
If objRE.Test(arrIP(i)) Then strIP = strIP & ” ” & arrIP(i)
Next
strMAC = objNIC.MACAddress
End If
Next
End If
strIP = Trim(strIP)
objComp.Description = strDateStamp & ” ” & strUsrLogin & ” ” & strIP
objComp.Put “extensionAttribute1″, strUsrLogin
objComp.Put “extensionAttribute2″, strIP
objComp.Put “extensionAttribute3″, strMAC
objComp.SetInfo