General discussion

Locked

Deleting Contents of Home Directories

By jkosman ·
Is there a way to delete the contents of multiple home directories quickly? We are in an educational setting where the student/user directories need to be deleted each year in additon to adding and deleting users.

This conversation is currently closed to new comments.

4 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

Deleting Contents of Home Directories

by d0c_h0l1day In reply to Deleting Contents of Home ...

I do something similar, but its in a novell environment. I don't know why it wouldn't work for NT. I use a simple batch file that I run from my laptop connected to the server that holds the home directories. In the batch file I delete the old andcopy up a default user home directory so when they log in they start from scratch.
The following is an example of what I use:
@ECHO ON

IF "%1"=="" GOTO ERROR

REM Substitute ServerName for the name of your server

MAP ROOT P:=ServerName/VOL1:USERS
MAP ROOT S:=ServerName/vol1:USERS\dfaultgm.nt4

:LOOP
DELTREE /y P:\%1\*.* /s
NCOPY S:\*.* /s P:\%1

DELTREE /y P:\%1\*.* /s

SHIFT
IF "%1" == "" GOTO DONE
MAP DEL P:
MAP DEL S:
GOTO LOOP

:ERROR
ECHO No user specified!

:DONE

Collapse -

Deleting Contents of Home Directories

by jkosman In reply to Deleting Contents of Home ...
Collapse -

Deleting Contents of Home Directories

by choonhian In reply to Deleting Contents of Home ...

You can actually "automate" the account/home directory creation process as well as account/home directory deletion process.
Use the following tools from NT ResourceKit in your script.

Account/Home Directory Creation Script:
NTUSER.EXE -s DOMAIN_SRV_NAME ADD NTACCOUNT -full_name "FULL NAME" -password NTPASSWORD
XCOPY c:\defaults\home \\homeserver\share\NTACCOUNT /S /E /I

Account/Home Directory Deletion Script:
NTUSER.EXE -s DOMAIN_SRV_NAME DELETE NTACCOUNT
RD /S /Q \\homeserver\share\NTACCOUNT

Above are just exmaples, you may change them to variables that can be entered as command line parameters.

Collapse -

Deleting Contents of Home Directories

by jkosman In reply to Deleting Contents of Home ...
Back to Windows Forum
4 total posts (Page 1 of 1)  

Operating Systems Forums