Jump to content

Script that can remove a local user from a local user group?


Recommended Posts

Posted

I have a laptop that is used by a member of staff at home, it's not on the network. Only ever brings it in when there is a problem with it. She's brought a printer for home and wants me to install the driver as UAC blocks her running it at home, however I can't install it without the printer connected so I was wondering if anyone had a script that could remove a local user from the local administrators group if I was to add her in and then tell her that the script had got to be run after the printer installation. This would then remove her from the local admin group.

 

So I was hoping if I add her in to local admins, she runs the printers installation tool, when that's completed tell her to run a script that's on her desktop that then removes her from the local admins groups, removing her local admin access.

 

Is this achievable?

 

Thanks

Posted (edited)

It is possible from the command line. This example would remove joebloggs from the administrators group - poor Joe, he always gets picked on.

 

net localgroup administrators joebloggs /delete

 

By the way, you'd need to run this in an elevated command prompt - perhaps detail that in the instructions your provide to the member of staff.

I'm certain there is a more elegant/proper way of doing what you want but this should work.

Edited by mrwoberts
  • Thanks 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...