Finding Orphaned Home Directories
Novell Cool Solutions: Tip
By Charles Hucks
Digg This -
Posted: 8 Sep 2005
In many cases, a user account is deleted from the network without the user's home directory being removed. Over time, this can lead to a lot of wasted space on the server, which can be difficult to track down.
Using a combination of a simple script and the Novell ActiveX controls, you can track down these orphaned home directories and move them to an archive directory where they can be manually inspected. With a little modification, this script should work in any environment.
The script (ArchiveHomeDirs.vbs) accepts two arguments: the edirectory context and the path where the home directories reside. The GetArguments function stores these as argCon and argPath. For example, to use the script for users in the context employees.ny.company and a home directory path of \\server\vol1\users you would use this:
cscript //NoLogo ArchiveHomeDirs.vbs employees.ny.company \\server\vol1\users
After loading the parameters, the script populates a recordset (rsNDS) with all the users in the specified container. The GetNdsUsers function takes care of this task, and it's where the Novell ActiveX controls are used.
If there is at least one user in the recordset, the ArchiveOldHomeDirs function is called. This function enumerates all subdirectories of the home directory path and checks to see if a corresponding user exists in the rsNDS recordset. If no match is found, the home directory is moved into the "Archive" subdirectory. Some basic error checking is used to check if a duplicate directory already exists in the archive.
All activity is logged to ArchiveHomeDirs.log.
Note: This script assumes that all users in a given context have their home directories in the same location. It also archives to a subdirectory named "Archive" in the same location as the home directories.
The script can be downloaded from:
The Novell ActiveX Controls Readme can be downloaded from:
Novell Cool Solutions (corporate web communities) are produced by WebWise Solutions. www.webwiseone.com