NSM Development <storagemanager@novell.com> wrote in

> Well I would like to invite the NSM community to join in on the
> discussion.

I saw that several people have requested an option in NSM to delete
orphaned home directories. I put together a script that we use in the
school district where I work and figured it might be of use to someone
here. It checks a directory and renames it if there are no individual
rights assigned.

--------- CHECK.CMD -------
@echo off
rem %%1 == Server name
rem %%2 == Volume
rem %%3 == Base home directory path
rem %%4 == Individual home directory

if "%4" == "old" goto END

echo Checking \\%1\%2\%3\%4
rem echo Checking \\%1\%2\%3\%4 >> .\logs\%1.txt

if exist rights.txt del rights.txt
trstlist /d \\%1\%2\%3\%4 > rights.txt
txtrepl /Q rights.txt "0 trustees"

if errorlevel 1 goto END

ren \\%1\%2\%3\%4 old.%4


This script uses two other utilities: TRSTLIST and TXTREPL. TRSTLIST
output the trustee assignments for a given file / directory, and TXTREPL
searches a file for a given text string. I'm sure there are other
utilities which can perform these same functions. I go under the
assumption that if there are no trustee assignments to a home directory the
original user has been deleted and does not exist anymore.

To get this script to check all home directories on a server I call it
using the FOR command, as such:

for /D %%I in (\\server\vol1\home\staff\*.*) do call check.cmd SERVER VOL1

(all on one line of course). If running this from a command prompt (as
opposed to a batch file) change the two "%%" to a "%".

As I have it written the CHECK.CMD script just renames the directory, but
it could easily be changed to move or delete the directory.

Hope this helps someone.

Timothy M. Musa
Community Consolidated School District 93
Carol Stream, IL