Here is a script to make a hidden share for each user found in the "Users" directory.To make the script work:
- You have to have RmtShare.exe from the NT Server Ressource Kit in your path.
- The directory containing user directories may not contain any other directories
- Directory names must be spelled exactly the same way as the user name
- You must be logged in as administrator
After running this script on the server, you can map the drives for each user as:
USE U: "\\Server\@UserID$"(The script can be run on the server, another server in the domain or a NT workstation in the domain)
code:
Break On
$Server = "\\Server" ; Change to point to your server
$MasterShare = "\\Server\Share" ; Change to point to your user directory share
$MasterPath = "D:\Users" ; Change to point to the location of user directory share on the server; Open Error log
Del "%TEMP%\Error.log"
$Err = Open(9, "%TEMP%\Error.log", 5)
; Create list of subdirs
Shell '%COMSPEC% /C Dir $MasterShare /AD /B > %TEMP%\DirList.lst'
$Err = Open(1, "%TEMP%\DirList.lst")
$UsrDir = ReadLine(1)
While @Error = 0
$NewShare = "$Server\$UsrDir" + "$"
$Cmd = '%COMSPEC% /C RmtShare $NewShare > %TEMP%\Share.lst'
Shell '$Cmd'
$Err = Open(2, "%TEMP%\Share.lst")
$Ressource = ReadLine(2)
If InStr("$Ressource","Share name")
$Ressource = ReadLine(2)
If InStr("$Ressource","$MasterPath\$UsrDir") = 0 ; share exists pointing to another location
$Line = "Error: Share " + $UsrDir + " connected to " + $Ressource
$Err = WriteLine(9, "$Line")
;Else
; Share already exists and is ok
EndIf
Else
$Cmd = '%COMSPEC% /C RmtShare $NewShare=$MasterPath\$UsrDir /grant $UsrDir:full /grant Administrator:full > Nul'
Shell '$Cmd'
EndIf
$Err = Close(2)
$UsrDir = ReadLine(1)
Loop
$Err = Close(1)
$Err = Close(9)
Return
Check the file: "%TEMP%\Error.log" for errors after running the script, if the file is empty, no
errors was found.I had to write this script to prove it can be done. I have seen something similar somewhere on the net, but this
should do the tiresome job of creating a share for each user.
Erik
ps.
You might not want to use the same parameters for RmtShare.exe as i have used. To see the syntaks of RmtShare.exe
just type RmtShare without parameterts.
DrillSergeant, I just couldn't ressist the assosiation to your name 
[This message has been edited by kholm (edited 06 December 2000).]