Admin Tip #271: Create shares and manage share permissions from the Windows NT commandline using RMTSHARE

Hits: Failed to execute CGI : Win32 Error Code = 3


Microsoft training courses teach Windows NT administrators to create and manage network shares and permissions to those shares using the Server Manager GUI. Its the tool of choice if you are going to create one or two shares and modify share permissions on a similarly limited set. What if you have a departmental or divisional consolidation and there are 100s of new shares or 1000s of existing permissions to modify?

As any unix administrator and any NT administrator in a large shop will attest, there is no substitute for good commandline tools which can be scripted for automation. They can take the druggery out of such large tasks (once they have been scripted and tested).

The commandline tool for these tasks is RMTSHARE.EXE. Rmtshare is a Windows NT Resource Kit commandline utility. The syntax to create a share:

rmtshare \\server2\hrshare=d:\dept\hr\salarysurvey /remark="HR 2000 Salary Survey files"

You will find that you will need to use quotes to keep rmtshare straight on parameters when paths have blanks. For example:

rmtshare \\server2\hrshare="d:\dept\human resources\salarysurvey" /remark="HR 2000 Salary Survey files"

To grant or remove permissions, the basic syntax is:

rmtshare \\server2\hrshare /revoke wmaples:f

rmtshare \\server2\hrshare /grant wmaples:c

where you are granting account wmaples, change (c) access to share hrshare on server server2. You can manage the full set of grants and revokes. The basic permissions are c for change, f for full access, r for readonly, and n for none. Like most commandline utilities, you can get help on the syntax by:

rmtshare /?

Try it. It can save you a lot of time.



Must have for NT administrators