Suppose you're building a disaster-recovery script. You have everything about your Windows NT installation scripted perfectly, except for the creation of shares. Building shares and setting share permissions is simple from Windows NT Explorer, but you want to build shares from a batch file. The Microsoft Windows NT Server 4.0 Resource Kit's Rmtshare utility lets you create and delete file shares, modify the shares'permissions, and display information about the shares. Rmtshare lets you create and modify shares on remote machines, but the tool doesn't work for print shares.
To create a share with Rmtshare, type
rmtshare \\<server name>\<share name>= <drive:\directory>
The server name variable is the name of the machine that the share resides on. Share name is the name that you want to give the new share. And drive:\directory is the path to the directory you want to share. Suppose you want to share a directory called C:\finance that resides on a machine named Wally, and you want to call the share Bucksdata. Log on to any machine with an account that Wally recognizes as administrative, and type
After you type this command line, you'll see the message The command completed successfully. At that point, the share is immediately available. Permissions on the share are Full Control for the Everyone group.
You can then use Rmtshare's /grant option to restrict users' permissions on Bucksdata. A /grant command line looks like
rmtshare \\<server name>\<share name> /grant <username>:<permission>
This command line is simple, but it isn't quite as simple as it looks. The username variable obviously refers to a username. But if you're sitting at machine A and instructing machine B to change permissions for a user named Jennifer, machine B might not know whether you want to change Jennifer's account in machine A's SAM database, her account in machine B's SAM database, or her domain account. If you're referring to Jennifer's domain account and the domain's name is Corporate, I recommend using corporate\jennifer as the /grant command line's username.
The /grant command line's permission value can be fc, which stands for Full Control; r, which specifies Read Only rights; c, which gives the user Change access; or n, which specifies No Access. Suppose I have two users with accounts in the Corporate domain. The accounts' usernames are jennifer and joe. I want to change the accounts' permissions on the Bucksdata share on Wally; I want Jennifer to have Change access and Joe to have No Access. I need to type
rmtshare \\wally\bucksdata /grant corporate\jennifer:c corporate\joe:n
Rmtshare has a couple of other notable options. The /remove option lets you remove all references to a user from the share's permissions list. To remove Joe's No Access designation, type
rmtshare \\wally\bucksdata /remove corporate\joe
Rmtshare's /delete option lets you stop sharing a directory:
rmtshare \\wally\bucksdata /delete
And finally, you can use Rmtshare with just a server name and share name to find out information about a particular share. Type
to see detailed information about Bucksdata, including the share's path, its permissions, and any comment you've added to the share. Or use the command line without \bucksdata to list all the shares on Wally, including the hidden shares.
For command-line aficionados, Rmtshare fills an important NT gap. If only Rmtshare managed printer shares!