Deluser for Win NT/2000/XP

Version 1.11
Copyright 2002 University of Wisconsin - Madison, CAE Center

 

Overview

Deluser is a console based utility for deleting local users in Win NT/2000/XP. It is able to handle both inclusion and exclusion of specific users as well as groups.

 

System Requirements

 

Installation

Deluser will work from any directory accessible on the local machine. If you wish run it on a Win NT 4 workstation, psapi.dll must be installed (see notes).

 

Using Deluser

Deluser usage and options are as follows...

Usage:
DELUSER  [/P]  [/Q]  [/L]  [ [ ! ] Accounts ]  [ [ ! ] G:Groups ]

Deluser flags:
/P Prompts for confirmation before deleting each account
/Q Quiet Mode, suppress messages
/L List local user accounts only
[Accounts] The accounts to be deleted. You may specify an account directly or use wildcards to match the name. You may also prepend a ! to the beginning of an account name to exclude it from being deleted.
G:[Groups] The groups whos members are to be deleted. You may specify a group directly or use wildcards to match the name. As with accounts, you may prepend a ! to the beginning of a group name to exclude its members from being deleted.
/INFO Display version information about Deluser
/? Display help screen/usage syntax

To delete a local user account, run Deluser followed by the name of the account you wish to remove. You may also specify a group using the G: option in which case all users of the group will be deleted. You may include wildcards in both the account and group names; ? for matching a specific letter and * for matching a string. For names that are multiple words, enclose them within quotes.

If you wish to exclude a certain user or group, prepend a ! in front and they will not be deleted, even if they are specified elsewhere. Exclusion takes precedence over inclusion for being deleted. Also if you only specify a user or group to be excluded, Deluser assumes that you wish to delete EVERY account but the ones excluded. The two accounts "Administrator" and "Guest" are never deleted as are accounts who currently have active processes on the machine.

Examples:

Delete the account Bgates
DELUSER bgates

Delete the accounts Anonymous User and all accounts condor-XXX
DELUSER "Anonymous User" condor-*

Delete ALL accounts (except administrator, guest and current users)
DELUSER *

Delete all accounts except members of administrators and joebob
DELUSER !G:Administrators !joebob

 

Notes

The accounts "Administrator" and "Guest" are NEVER deleted.

Currently, using both types of wild-cards in matching users or groups is not supported (ie: deluser ???-* will NOT function correctly).

Deluser functions correctly by itself under both Windows 2000 and Windows XP. It also works under Windows NT 4, but requires the presence of psapi.dll in your %WIN%\System32 directory.

In order for Deluser to function correctly, the user running it should have "Administrator" privileges. It is possible to gain some functionality when running it from an account with "Account Operator" privileges however, deluser will be unable to take ownership of profile directories and enumerate all active processes. Use at your own risk!

 

Version History

Version 1.1.1

Version 1.1.0

Version 1.0.0


Deluser was written by Jeremy Parker for the Computer Aided Engineering Center at the University of Wisconsin-Madison. You may contact him at jeremyp@cae.wisc.edu.