I've been having massive problems with random errors since I started using Windows 7 (Powershell v2), and was intending to install a Virtual Machine running an older version just so I could continue using the scripts I wrote to use on a regular basis.
But, that got me thinking, maybe I should write in error detection into the scripts instead. Just because the scripts run flawlessly on one computer, it doesn't mean they won't have problems when moving to another computer (as I found out).
So, I have a few different functions that seem to error out regularly:
----------------------------- New-QADUser: Throws a nasty looking error if the user already exists (which is strange, considering this is a new account). The account is not created, so why would it tell me it already exists? ----------------------------- Set-QADUser & Add-QADGroupMember: Frequently get the message "Cannot resolve DN for the given identity:" These messages typically come immediately after I get the above error message saying the user already exists, so I suspect this is because the user doesn't actually exist. ----------------------------- SetOwner, a member function of the Set-ACL cmdlet: This is the one that is causing me the most grief, it cannot resolve a user, either by username or SID, and kills the entire permission setting process. -----------------------------
The first couple of errors might actually be a coding issue, so I think I can resolve them, while the last one appears to be a system bug. However, I need to figure out a way to handle the script when these errors occur, hopefully without having to restart the entire script (takes hours to run).
I'm thinking that it might be along the lines where it keeps running a portion of the script over and over again until the username can be resolved (which seems to be the majority of my errors).
|