• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 745
  • Last Modified:

Script to remove account from Local Admin group and that removes its profile

Hello ,

I am looking for a script that removes an account from the Windows server local Administators group and that also removes its profile. This is a domain. The script should be able to provide a log of onto which servers it failed.
I am aware that could be done through GP in AD but we would prefer to have it done quickly, without waiting servers to reboot.
Many thanks!!
0
Brention
Asked:
Brention
  • 3
  • 3
1 Solution
 
kevinhsiehCommented:
If you use the restricted groups function of group policy to define the local administrators group, that change happens when the gpo gets applied or refreshed, so you don't need to wait for a reboot. The GPO won't delete the profile, but it will keep working to enforce the group membership, unlike a script.
0
 
kevinhsiehCommented:
If you want to force a gpupdate , I recommend using the gpupdate lite tool from Special Operations Software. It works great!
0
 
BrentionAuthor Commented:
Found a solution myself..  I'm using psexec that runs as follows:

psexec @IP.txt net user UserName /del >log.txt

unfortunately the AD guy doesn't want to use GP's for this...  don't ask me why..  !!
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
BrentionAuthor Commented:
I've requested that this question be closed as follows:

Accepted answer: 0 points for Brention's comment #a38349406

for the following reason:

it a solution provided by myself and it works quite well. I think others can benefit from this. It's simple and efficient.
0
 
kevinhsiehCommented:
Your script won't remove the profile. I think that Microsoft has a utility called delprof that can delete the profile.
0
 
BrentionAuthor Commented:
I gave 500 even if that was half of the solution and the other half mine..  as I don't need scores..  I use this service rarely..
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now