Today i've needed a way to automatically create a windows share on flash disks with a script file (so this script can be run by the user after he pluggin the stick in).
The Windows Ressource Kit provides the tool "RMTSHARE.EXE" which is able to solve this problem. You can find the Windows Resource Kit on your Windows Server 2003/2008 CD or download it directly here.
Example:
To create a share called "temp" on folder "C:\temp" with Read/Write Permissions and grant local user "admin" type:
rmtshare \\localhost\temp=C:\temp /GRANT localhost\admin:RC
The general syntax is:
rmtshare \\server[\sharename[=path [/printer]]] [/grant [user[:perms ]]] [/remove user][/users:number] [/unlimited] [/remark:"text"] /delete
Valid permissions options are: r=read, c=change (write), f=full, and n=none. You can type "read", but only the first character is used.
You can also use the tool to remotely view all shares of a windows host by just typing:
rmtshare \\SQLSERVERNAME
The bad news is: RMTSHARE.EXE isn't compatible with 64bit versions of Windows, like Win7 x64 or Windows server 2008 R2. :-(
6 Comments:
Why this RMTSHARE.EXE was not compatible with 64bit versions of Window$ (like Win7 x64 or Win Server 2008 R2)..? So, innovations are welcome, right..?
Btw, thanks for sharing it, dude.. :)
Hi,
Same thing for me.
It's seem not compatible if Win 7 x64.
And I got an error on XP SP3 x86 :
The command : "Rmtshare.exe \\127.0.0.1\D=d:\ /grant:F administrator"
return : The command failed: -1073741819
Is someone know why ?
Thanks
Vincent,
You have the permissions before the user. It needs to be
Rmtshare.exe \\127.0.0.1\D=d:\ /grant administrator:F
Also, your command is set to work on an existing local share. Have you already shared D:\ as D? You are hitting your localhost. RMTshare is really meant to do remote shares. If you just need to set local share perms, use net use /grant
RMTSHARE is compatible with 64bit.
Just unzip the RMTSHAR.EXE (to readme.txt und RMTSHARE.EXE) and you'll be able to run RMTSHARE.EXE in your cmd-line
For w7 use NET SHARE
See NET SHARE /?
Is there a way to make rmtshsre run as administartor from non-admin user account. The application I use runs under system acct and couldnot run rmtshare and establish the connection succesfully. Any thoughts? The error is "The command failed : 5".
Post a Comment