I am looking to remove user accounts that have been added in to server local admin group using a script. I have written logic which removes any groups starting with tem* and any locally added admin user accounts starting with admin*. Now I am stuck at implemeneting a logic in which I can remove locally added user accounts. In our company the user accounts are like (hsgd1234,awdf8762,kuuy5223 etc etc).
I am using the below code to retrieve the admin group membership