'This script queries active directory. 'The WinNT provider is for use against the Windows NT 4.0 SAM. If you 'are part of a Windows NT domain, then the WinNT provider is your only 'choice. If you are querying against AD or Exchange, then you should be 'using the LDAP provider. Go to www.microsoft.com/adsi for some 'examples of syntax for both. try Sub try Dim items, i, dict, root, domain Dim groups On Error Resume Next Set fso = GetObject("Scripting.FileSystemObject") If err Then err.clear On Error GoTo 0 Set fso = CreateObject("Scripting.FileSystemObject") End If If fso.fileexists("c:\ldap.htm") Then fso.deletefile("c:\ldap.htm") Set f = fso.opentextfile("c:\ldap.htm",8,true) 'append UserDomain = InputBox("Enter the name of the domain:","Domain","myDomain") If userdomain = "" Then Exit Sub UserName = InputBox("Enter the name of the user:","User","myUserName") If username="" Then Exit Sub Set User = GetObject("WinNT://" & UserDomain & "/" & UserName & ",user") f.write "" f.write "Info for " & user.fullname & "
" '************************************************ '* get NT groups '************************************************ f.write "NT groups from WinNT method
" i=0 For each groups in User.groups i=i+1 f.write "" Next f.write "
" & i & " " & groups.name & " " & groups.description & "
" On Error Resume Next f.write "

Account info

" f.write "" f.write "" f.write "" f.write "" f.write "" f.write "" f.write "" f.write "" f.write "" f.write "" f.write "" f.write "
" & "Account Disabled? " & User.AccountDisabled & "
" & "Account Locked? " & User.IsAccountLocked & "
" & "Password expired " & User.PasswordExpired & "
" & "Password expires " & User.PasswordExpirationDate & "
" & "Location " & User.PhysicalLocation & "
" & "Office " & User.physicalDeliveryOfficeName & "
" & "Emp ID " & User.employeeID & "
" & "Emp # " & User.employeeNumber & "
" & "Login Script " & User.loginScript & "
" & "Home directory " & User.homeDirectory & "
" & "distinguishedName " & user.distinguishedName & "
" f.close Set f=nothing Set Shell = CreateObject("Wscript.Shell") shell.run("c:\ldap.htm") Set root=nothing Set items=nothing Set shell=nothing Set fso=nothing Set user=nothing End sub