Hints to help you troubleshoot your programs
Use an "Option Explicit" statement in your program. This makes it much easier to find errors. With this statement, every variable must be declared (usually with a "Dim" statement). Any variable that is not declared raises an error, which makes misspellings immediately apparent.
Don't use "On Error Resume Next" while troubleshooting, unless you anticipate specific errors and handle them. Although trapping errors is a useful feature, it can mask problems. You want to know which statement first raises an error.
If you are having a problem, try to isolate it. Reduce the code to the minimum needed to duplicate the problem. This is also useful when you post code in a newsgroup or forum seeking help to fix a problem.
Especially if a program is long, temporarily add output statements, like Wscript.Echo or MsgBox, to indicate progress in your program. Output the values of variables to verify they are what you expect.
If the problem seems to be in a loop, it can help to add an output statement in the loop to reveal variable values on each iteration. Often, the loop executes as expected most of the time, but raises an error when a variable becomes out of range or has an unexpected value.
Test programs in a test environment, with test users and groups. Logon scripts especially should be tested under all expected conditions, on all client operating systems.
Many scripts that deal with Active Directory raise an error when the "SetInfo" method of an object is invoked. This could be caused by any property values set since the last "SetInfo". Nothing is saved to Active Directory until you invoke SetInfo. Before this all changes are made in local memory. Often a syntax or formatting error is the problem. To isolate the problem, you may need to temporarily code more "SetInfo" statements.
ADO search routines often raise an error when the query statement is executed (the Execute method is invoked). Any syntax error in the query statement could cause this.