Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Is it possible to delete a user account from the command line? 1

Status
Not open for further replies.

bluegnu

Technical User
Sep 12, 2001
131
GB
I was wondering if the is a command to delete an individual user account through cmd.exe rather than going to Computer Management?

thanks
 
dsrm (part of dsmod utility in the Win2k3 admin pack) lets you delete AD objects inc. users
 
Thanks, I have tried using dsrm but I cannot get it to work, it just seems to freeze with no error and the deletion does not occur.

If I was to delete a user called DAVE, what would the dsrm command that I would need to use?
 
I don't use it personally but the dsrm /? help gives some examples. Not sure why it wouldn't work as long as you have the correct full DN for the user and also the domain controller/admin user details...
 
What if the server isn't on a domain?
 
Try
Code:
net user usernametodelete /delete
Replace usernametodelete with the actual username of course
 
To add a user do the following:

Net user <Username> <Password> /add

There must be a way to specify user as a member of groups but havn't figured it out yet...
 
If you want local machine groups, then:

net localgroup

will work, but domain groups must be handled with vbscript, with the ds-tools, or something else.

The net group command used to work in NT, but I am not positive if it works or if I would trust it in AD.
 
Actually you can do domain groups from the command line. To add a domain user to a domain group:
Code:
net group domaingroupname domainusername /add /domain

You can delete users with /delete. I use this often when I need to quickly change membership of a security group and don't want to dig through our AD structure. Type NET HELP GROUP for additional information.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top