Hello Guy's

I need help on developing a query script to search for specific employee ID. Currently I'm having to disable about 50 user accounts per day and need a script to help me program this. I've developed some code already that read's a value from a file and then it queries AD but is not finding anything when I search for the value of the "Employee ID" value.

When I change to code to query for a specific user's job title it does fine accounts.

Here is the code that I have put together already but it's coming up empty when I look for specific employee id's.
Code:
Dim sCSVFile, objFSO, objTextFile
Dim qQuery, objConnection, objCommand, objRecordSet
Dim objUser

Dim sempid	'usage to capture the user's employee ID
Dim suserid	'usage to capture the user's sAMAccountname
Dim supn	'usage to capture the user's usersprincipalname
Dim suname 	'usage to capture the user's full name
Dim susn		'usage to capture the user's surname
Dim sugn	'usage to capture the user's givenname

Const ForReading = 1

sCSVFile = "C:\repository\test\refemployid.csv"

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile(sCSVFile,ForReading)

Do Until objTextFile.AtEndOfStream
	TxtIn = objTextFile.ReadLine

	qQuery = "<LDAP://dc=yisd,dc=net>;" & _
		"(&(objectCategory=user)(employee ID=TxtIn));" &_
        		"sAMAccountName,adspath;subtree"
        
	Set objConnection = CreateObject("ADODB.Connection")
	Set objCommand = CreateObject("ADODB.Command")
	Set objRecordSet = CreateObject("ADODB.Recordset")

	objConnection.Open "Provider=ADsDSOObject;"
	objCommand.ActiveConnection = objConnection
	objCommand.Properties("page size")= 100
	objCommand.CommandText = qQuery
	Set objRecordSet = objCommand.Execute

	While Not objRecordSet.EOF
	Set objUser = GetObject(objRecordSet("adspath"))
		RDData 					'Read attributes into variables
		VWData
		'WDData 					'Write data to file
		objRecordSet.MoveNext
	 Wend
		'WScript.Echo objuser.employeeID
		'WScript.Echo objuser.userPrincipalName
		'WScript.Echo objuser.name
		'WScript.Echo objuser.sn

'objcsv.close
objConnection.Close

Loop

	Sub RDData
		sempid = objuser.employeeID
		suserid	= objuser.sAMAccountName
		supn = objuser.userPrincipalName
		suname = objuser.name
		susn = objuser.sn 
 		sugn = objuser.givenName
	End Sub
	
	Sub VWData
		WScript.Echo sempid
		WScript.Echo sserid
		WScript.Echo supn
		WScript.Echo suname
		WScript.Echo suserid
		WScript.Echo sugn
	End Sub
	
WScript.Echo "Finished - All Done"
Any assistance would be greatly appreciated, Thanks.

Last edited by shabbir; 23Jul2008 at 09:10.. Reason: Code block