Previous Up Next

CUIP Tech Site

For Tech Coordinators, NSP-CUIP Techs, and CUIP Staff

Batch User Creation - RMTSHARE

Batch User Creation HOW-TO -- RMTSHARE and Making Home Directories Available

Instructions

  1. Create a worksheet for setting directory permissions.
    1. In your Excel workbook, create a new sheet.
    2. Name the new sheet 'share'.
    3. In cell A1 of sheet 'share', enter =CONCATENATE("@echo off")
    4. In cell A2 of sheet 'share', enter

      =CONCATENATE("rmtshare \\SERVER\",students.csv!H2,"$=c:\users\students\",YEAR(TODAY())+G-RIGHT(students.csv!E2,1),"\",students.csv!H2," /grant ",students.csv!H2,":C")

      making sure to replace "c:" with the letter of the drive where your students' home directories are stored and G with the value you calculated when you generated the 'homes.bat' script.

    5. AutoFill this formula for the rest of the students.
  2. Export the worksheet as a batch file named 'share.bat'.
    1. From the 'File' menu, select 'Save As...'.
    2. Set the file format to 'Text (OS/2 or MS-DOS)'.
    3. Set the save location to '...\LoginProject\Batch\Students\'
    4. Change the file extension to '.bat'.
    5. Save the file.
    6. Answer 'Yes' or 'Ok' to any prompts Excel gives you.
  3. Run the batch file you've created by either...

Explanation

Alright, you've secured the students' home directories against unwanted snooping, poking, prodding, and accidental goof-ups. Now let's make sure that they are actually useful by creating network shares for them. This batch file uses the program rmtshare.exe, which is a command-line version of the "Sharing" panel under the properties window that you can access for a directory using the GUI. If you want more information about rmtshare's syntax, read JSI Tip 6353. RMTShare.exe... For this stage of the process, the instructions are the same as the last two, but the names and formulae have been changed to protect the innocent. When you make your new sheet in the workbook, name it 'share' (since it makes the shares for the home directories), and use the formula

=CONCATENATE("rmtshare \\SERVER\",students.csv!H2,"$=c:\users\students\",YEAR(TODAY())+G-RIGHT(students.csv!E2,1),"\",students.csv!H2," /grant ",students.csv!H2,":C")

(with your drive letter replacing "c:", just like before) to generate the script.

This CONCATENATE() starts off with the call to the program, rmtshare, followed by the name you want to give the networks share. You already created this name for the addusers.exe input file, but we want all of our sheets to refer either to 'students.csv' or to themselves. Doing this prevents resorting the data in one sheet from disordering any of the other sheets. So, you'll enter \\SERVER\",students.csv!H2,"$, which re-creates the sharename by grabbing the username from the original sheet and adding the network path before and a dollar sign after. The dollar sign, if you'll recall, makes sure that users on the network can't just browse to someone else's home directory by making it hidden. Remember to replace SERVER with the network name of the computer that holds your students' home directories.

This name is followed by an equals sign and the name of the directory that will be shared under the name. To get the directory, we the use formula that you're probably sick of typing by now, c:\users\students\,YEAR(TODAY())+G-RIGHT(students.csv!E2,1),"\",students.csv!H2. As always, remember to replace "c:" with your drive letter and G with the number of grades in your school, minus one if you are doing this after the New Year. The last part of the formula, " /grant ",students.csv!H2,":C", generates the last part of the command, which tells rmtshare to give Change permissions to the username fetched with students.csv!H2, which is the username that corresponds to the network share and the home directory. The results should look something like this, adjusted for your data, of course:

rmtshare \\SERVER\SMITHA$=c:\users\students\2005\SMITHA /grant SMITHA:C

Once you've entered the formula and verified that it works right, use the AutoFill function to create the rest of the script. Now export the worksheet to the '.bat' file, and just like before, run the script.

AGAIN, DOES THIS HAVE TO BE RUN LOCALLY OR IS THERE A REMOTE OPTION?


Next: Batch User Creation - Login Script
Previous: Batch User Creation - CACLS
Up: Batch User Creation - Table of Contents
See also: CUIP Home
See also: CUIP Tech Home
CUIP Tech Site Map(not yet working)

This page is: http://tech.cuip.net/topics/logins/rmtshare.html
Author: Ben Buckley, benb@cuip.net
Last updated at 09:11 2005n June 17, 2005.
It has had 674749 visitors.