XP / 2000 clients - net use to share above directory
Top  Previous  Next


Task

·Create accounts, set basic properties that must be set in order to use an account  
·Display name - used to display full name in explorer / properties / permissions.  
·Logon name "User logon name (pre-Windows 2000)"  
·Creates home directories  
·Use a logon script with "net use" to map home directories to a directory below a shared directory - only one share needed. Notice that this method only works for XP/2000 clients, read more here About home directories for different Windows clients.  

1) Create the home directory root on the server and share it

·Use explorer to create and share "%HomeRoot%", in this case "e:\users". Important: the file system on the drive you choose MUST be NTFS.  

2) Create the logon script. The logon script connects the users to their home directory when they log on.

·Locate the netlogon folder on your server (Example: C:\WINNT\SYSVOL\sysvol\D28\scripts)  
·Right click in the folder and choose new text document in the pop-up menu, name it "teachers.bat".  
·Right click "teachers.bat", choose edit.  
·Insert this line:  

@NET USE w: \\x5012b\users\%username%

·Save "teachers.bat".  

3) Use this script

[Settings_Begin]
BatchSettings.Delimiter=TAB
SET AccountName=%col4%    // %AccountName% instead of %col2% below = easier to change column
SET FullName=%col1%
SET Password=%col5%
BatchSettings.MarkerCol=7
BatchSettings.AddToValidCharSet=äöåÄÖÅéÉü_ // Allow Swedish characters in user and group names

SET ADDomainPath=dc=com/dc=acme/dc=D2
SET ADOU=Teachers
SET ADOUPath=%ADDomainPath%/ou=%ADOU%

SET ScriptName=teachers.bat    // net use w: \\x5012b\users\%username%
SET HomeDirectory=w:\      // drive mapped in the logon script above

SET HomeRoot=e:\users
SET HomePermissions=%AccountName%:F administrators:F System:F
SET IDGroup=Teachers
SET IDGroupDesc=Teachers
[Settings_End]

[Machines_Begin]
\\EDU8
[Machines_End]

[Batch_Begin]
AD.OU.Create %ADDomainPath%,%ADOU%   
$i AD.Group.Create Global,%ADOUPath%,%IDGroup%,%IDGroupDesc%   
Data.Loop   
 AD.Account.Create %ADOUPath%,%AccountName%,%AccountName%,%Password%   
 AD.Account.SetProperty %ADOUPath%/cn=%AccountName%,FullName,%FullName%   
 AD.Account.SetProperty %ADOUPath%/cn=%AccountName%,AccountDisabled,No   
 AD.Account.SetProperty %ADOUPath%/cn=%AccountName%,PWMustChange,No   
 AD.Account.SetProperty %ADOUPath%/cn=%AccountName%,PWNeverExpires,Yes   
 AD.Account.SetProperty %ADOUPath%/cn=%AccountName%,LoginScript,%ScriptName%   
 AD.Account.SetProperty %ADOUPath%/cn=%AccountName%,HomeDirectory,%HomeDirectory%   
 AD.Group.AddObject %ADOUPath%/cn=%IDGroup%,%ADOUPath%/cn=%AccountName%   
 DOS md %HomeRoot%\%AccountName%   
 DOS echo y| cacls %HomeRoot%\%AccountName% /G %HomePermissions%   
Data.Endloop   
[Batch_End]

[Undo_Batch_Begin]
Data.Loop   
 AD.Account.Delete %ADOUPath%,%AccountName%   
 DOS echo y| rd %HomeRoot%\%AccountName%\ /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   dkop34aD-39      
Susan Jones         s.jones   q01+opcieW      
[Data_End]