I have a list of usernames in a CSV file that I need to retrieve LDAP properties for. I'm using the following code. If the object doesn't exist, how can I handle the error to truncate the loop and move onto the next user in the CSV file?
Set objDataFile = objFSO.OpenTextFile(strInputFile,ForReading)
Do until objDataFile.AtEndofStream
arrStr = Split(objDataFile.ReadLine,",")
strSAMAcctName = arrStr(2)
Set User = GetObject ("LDAP://CN=" & strSAMAcctName & StaffOU)
OutFile1.WriteLine User.sAMAccountName & "," & User.carLicense & User.displayName & "," & User.FirstName & "," & User.LastName