I was tasked to write a script that would read in a list of servers, connect to each one in turn, find the admin account, reset the password and then echo the results out to text files. One for failures and one for success.
This I did but I found a small problem. The routine that discovers the admin account checks the SID. As we all know the local admin account SID always ends in 500. But if one of the servers is a DC then it finds the domain account and resets that. Not what we wanted.
So what I'm working on is a small routine to check to see if the server being checked is a DC or not. If it is a DC then to skip to the next server in the list.
I'm running into walls and could do with a little help please!
This I did but I found a small problem. The routine that discovers the admin account checks the SID. As we all know the local admin account SID always ends in 500. But if one of the servers is a DC then it finds the domain account and resets that. Not what we wanted.
So what I'm working on is a small routine to check to see if the server being checked is a DC or not. If it is a DC then to skip to the next server in the list.
I'm running into walls and could do with a little help please!