Delete local user account using scripts
50 pts.
0
Q:
Delete local user account using scripts
Someone prior me added a account called Admin and added this user into Local PC administrator group. All the PC's are in domain. But the company IT security department wants me to delete the user account Admin from the local computer. I know i can delete it by loging localy into each individual computer.

Can anyone give a complete script which i can run with logon script which will delete the user Admin from each local computer.

That would be really appreciated. Thanks



Software/Hardware used:
Windows Vista
ASKED: Aug 28 2009  6:28 AM GMT
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
0
50 pts.
0
A:
 RATE THIS ANSWER
0
Click to Vote:
  •   0
  •  0
  • AddThis Social Bookmark Button
First you need to determine if this is a user account (domain or local) or a security group. Usually, I find this to be a domain security group where a domain admin will add users so they can have administrator rights to their local computer to run programs that do not play nice – requiring local admin rights to run.

If it is a security group you can create a logon script some thing like net localgroupGroupName/delete

Write back and give more details if you need additional help

------------------------------------------------------------------------------------

You can delete with the NET command from a script or use something like WMI remotely. There are some utilities available that can be run remotely for managing accounts / groups.

In a script, you could set the command to run as a scheduled task or use PSEXEC if that is allowed in your environment.

The login script is probably not the place unless all users are admins on their system.

You can create a script that takes a list of your computers, run it under an account that has administrative access to your systems and let it schedule removal of the account.

schtasks /create /tn DelAdmin /tr "cmd /c net user admin /delete" /sc once /st HH:MM [/sd MM/DD/YYYY] /ru "NT AUTHORITY\SYSTEM" /s ComputerName /F

Or

at \\ComputerName "cmd /c net user admin /delete"

Script with for loop to prcess list of system names left for the administrator.

------------------------------------------------------------------------------------

Thanks mate.
They are not domain account. Admin Account is local computer account for which someone used to configure the PC for joining into the domain. I have about 200 computer in the network.

I have never done scripting. Can you please give me the whole script which i can run on my PC or from my Server i can schedule it and that will delete the user. That will be really appreciated. Thanks
Last Answered: Sep 1 2009  0:33 AM GMT by Open123   50 pts.
Latest Contributors: Pjb0222   1110 pts., Dwiebesick   1760 pts.
0
0
Discuss This Answer:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _



_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

R vishaal   355 pts.  |   Aug 31 2009  3:34PM GMT

hey
mate try using Group policy to denied : “Deny Logon Locally” ….

 

Delete local user account using scripts « Domain Namez   0 pts.  |   Sep 3 2009  3:51PM GMT

[...] unknown wrote an interesting post today onDelete local user account using scriptsHere’s a quick excerpt [...]

 
0