Just realised that I haven’t had any posts about ADSi errors that you may encounter.
Here is a link to the common errors : Link
Most of the time, you will run up against these errors when you are querying users or groups and they don’t exist or an attribute / property does not exist.
The script will tell you which line you’ve went wrong on, but rarely ever gives you an idea on how to solve the issue. That page will give you a quick idea on how to resolve it.