How to delete a windows user?

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
bluegnu
Newbie
Posts: 11
Joined: Wed Jun 28, 2006 9:09 am

How to delete a windows user?

Post by bluegnu » Fri Dec 22, 2006 11:50 am

Is it possible to create a macro to delete a specific windows user? The problem as I see it is that I can open computer manager and get to the Users, but deleting the correct user doesn't seem possible.

Any ideas?

User avatar
pgriffin
Automation Wizard
Posts: 460
Joined: Wed Apr 06, 2005 5:56 pm
Location: US and Europe

Post by pgriffin » Fri Dec 22, 2006 3:33 pm

There probably is some inventive way to go through the Windows interface to get this done, but my first attempt would be to visit a VBScript forum and look for code to delete a user. You might sign up at http://www.visualbasicscript.com and post the question there.

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Fri Dec 22, 2006 4:30 pm

What version of Windows Operating System are you usiing?

I believe that you can use NET command with XP/2K and higher.
Untested syntax is something like this:
NET USER username /DELETE /DOMAIN

You will need to have the correct permissions to delete a user.
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

User avatar
JRL
Automation Wizard
Posts: 3532
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Fri Dec 22, 2006 4:46 pm

Another possibility:
If you're deleting users from a 2003 server you might be able to use the command line tool dsrm.

From microsoft:
Dsrm

Deletes an object of a specific type or any general object from the directory.
Syntax

dsrm ObjectDN ... [-subtree [-exclude]] [-noprompt] [{-s Server | -d Domain}] [-u UserName] [-p {Password | *}][-c][-q][{-uc | -uco | -uci}]

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts