2

I read about the Net Share command a lot of places. It appears to have the ability to stop a remote share from being shared using the /DELETE argument, and it also appears to be able to add users to the share using /GRANT.

Now one thing that seems not possible is to do is to remove people from the remote share using the Net Share command. Is there some way of doing this?

3 Answers 3

5

Since you seem to be using this in a script:

  1. you could use the 3rd party open source SetACL utility to modify remote share permissions

  2. the same goes for Microsoft's RMTSHARE which is a separate resource kit download

  3. you could use Enter-PSSession or InvokeCommand -Computer in PowerShell and remote the share permission management through PowerShell commands too. If you don't like / use / want PowerShell, WMI (which is used for share permission management in the PowerShell examples you find on the net) is remoteable all by itself and scriptable through other languages (e.g. VBScript) too.

WMI is rather complex to script and debug though, so it can become a pain in the bum, but is the only approach which would work out of the box, without installing additional software.

1
  • ahh...good call...I missed the "command line" tag...you are probably right that the OP wants a command line utility not the GUI.
    – TheCleaner
    May 2, 2013 at 1:43
3

Use Computer Management via compmgmt.msc and then right click on Computer Management (Local) and choose to Connect to another computer.

Then you can type in the DNS name of the computer or IP and remotely manage the shares and their permissions under the "Shared Folders" tab.

You will need Admin rights on that remote server to do so though (along with possible Windows firewall rules)...but if you are a Domain Admin you should be fine.

1
  • 1
    +1, See also fsmgmt.msc, connect to remote computer.
    – jscott
    May 2, 2013 at 0:34
1

I'm never found an easy way to do this using the net share command. I've done it in the past using only net share commands by deleting the share, and recreating the share and only adding the proper permissions.

Then I discovered rmtshare and powershell later on and my life was more complete.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .