Avatar of manav08
manav08Flag for Australia

asked on 

Batch script to delete all users from domain admin group but administrators

Hi Guys,

What I wanna achieve is same as mentioned here - http://blogs.technet.com/b/heyscriptingguy/archive/2005/12/12/how-can-i-delete-everyone-except-the-administrator-and-the-domain-admins-group-from-the-local-administrators-group.aspx but how do I do it from a batch script.

I know the command to add administrators is
net localgroup administrators /add "domain\user", but I want a script that will delete all users from administrators group, even ones that are unknown and we dont want to use Group Policy for this.
Windows Server 2008Windows Server 2012Scripting Languages

Avatar of undefined
Last Comment
manav08
ASKER CERTIFIED SOLUTION
Avatar of NVIT
NVIT
Flag of United States of America image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of NVIT
NVIT
Flag of United States of America image

Hi manav08,
Did the solution help you? If so, I'd appreciate you closing the question appropriately.
Avatar of manav08
manav08
Flag of Australia image

ASKER

Apologies for my laziness in closing this question.
I havent tested but believe this is solution we were after
Windows Server 2008
Windows Server 2008

Windows Server 2008 and Windows Server 2008 R2, based on the Microsoft Vista codebase, is the last 32-bit server operating system released by Microsoft. It has a number of versions, including including Foundation, Standard, Enterprise, Datacenter, Web, HPC Server, Itanium and Storage; new features included server core installation and Hyper-V.

86K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo