troubleshooting Question

Serverless binding

Avatar of Bianchi928
Bianchi928 asked on
VB Script
10 Comments1 Solution461 ViewsLast Modified:
When I run the following script with a domain account, it work fine. When I run it under administrator it comes with "No Users found". I need to run it under administrator and I need help to modify the script to NOT use serverless binding. The server is ????.com.au.

'Check the Lan id on the Active Directory

Dim strComputer, strUsername, objWMI, colUsers, objUser, filesys, filetxt
on error resume next
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Set filesys = CreateObject("Scripting.FileSystemObject")
Set filetxt = filesys.openTextFile("c:\tempwindows7\user.txt", ForWriting)

strComputer = "."
Set objWMI = GetObject("winmgmts:\\" & strComputer & "\root\directory\LDAP")

While x <> 6

strUsername = InputBox("Please type the user Lan Id")

Set colUsers = objWMI.ExecQuery("SELECT * FROM ds_user where ds_sAMAccountName = '" & strUsername & "'")
If colUsers.Count > 0 Then
   For Each objUser in colUsers
       UserFullName = objUser.ds_givenName & " " & objUser.ds_sn
       x=MsgBox(ucase(strusername) & ":" & userfullname & chr(13) & chr(13) & "Is this Correct ?",4,"User Information")
   Next
Else
   WScript.Echo "No users found!"
End if

Wend

filetxt.WriteLine(strusername)
filetxt.close
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 10 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 10 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros