I have this script I will enter below that is set to read from a .CSV file and delete all users within it. This was done because I am in an environment where the previous admin did not clean up AD.
When I move to delete them via the script a significant amount of users are kicking out an error referencing a leaf object as will be attached below.
Upon further research, it appears that there are "ExchangeActiveSyncDevices
" child objects attached to them and further complicating things, it would appear that some or most of these users were protected from accidental deletion! We have exchange 2010 in the environment with server 2008 R2 DC's.
The script below works very well but I am looking for a tweak that will delete the user and its objects regardless of being protected from accidental deletion or not. I have vetted the list of users in the CSV file carefully so I am aware of the issues surrounding this and also do know that the objects are merely the Exchange objects above and should cause no impact to exchange.