Create home directories, shares and set permissions on a remote machine without DOSR (use administrative share)

Top  Previous  Next


Required
rmtshare.exe

·If you don't want to use the "DOSR" command (the remote admin service) or if the service won't run on the remote machine (Alpha platform), it is also possible to manage home directories through a default hidden administrative share (c$, d$ etc.).  
·The "md", "rd" and "cacls" commands can be used through a share (as long the machine that is used to manage the remote machine belongs to the same domain or else the "cacls" command will fail with the message "No mapping between account names and security IDs was done.").  
·The "net share" command can not be used through a share but the solution is simple; use "rmtshare" instead.  

Example -

[Settings_Begin]
BatchSettings.Delimiter=TAB
Account.FullName.col=1
SET AccountName=%col4%    // %AccountName% instead of %col4% below = easier to change column
Account.Password.col=5
Account.Description.Col=6
BatchSettings.MarkerCol=7
Account.Disabled=No
Account.Password.MustChange=No
Account.Password.NeverExpires=Yes

SET HomeRoot=c:\users
SET HomeRootThroughShare=%ServerName%\c$\users
SET HomePermissions=%AccountName%:F administrators:F System:F
SET HomeDirName=%AccountName%
SET ShareName=%HomeDirName%$

SET IDGroup=Teachers
SET MemberGroups=Domain Users,%IDGroup%
[Settings_End]

[Machines_Begin]
\\EDU8      NT PDC    Ok-AllDone
[Machines_End]

[Batch_Begin]
Group.Global.Create %IDGroup%   
Data.Loop   
Account.Create %AccountName%   
Account.Set.Group.Global %AccountName%,%MemberGroups%   
DOS md %HomeRootThroughShare%\%HomeDirName%   
DOS rmtshare %ServerName%\%ShareName%=%HomeRoot%\%HomeDirName%   
DOS echo y| cacls %HomeRootThroughShare%\%HomeDirName% /G %HomePermissions%   
Data.Endloop   
[Batch_End]

[Undo_Batch_Begin]
Data.Loop   
Account.Delete %AccountName%   
DOS rmtshare %servername%\%ShareName% /delete   
DOS echo y| rd %HomeRootThroughShare%\%HomeDirName%\ /s   
// The /s switch causes rd to remove all directories and files in the specified directory   
Data.Endloop   
[Undo_Batch_End]

[Data_Begin]
Steve Smith         s.smith   xkop-34aD32      
Susan Jones         s.jones   a01op*cieD   
[Data_End]