Changing the Permissions on a Windows Share Remotely?

12,189

Solution 1

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.

Solution 2

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.

Solution 3

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.

Share:
12,189
leeand00
Author by

leeand00

Projects jobdb - Creator of Open Source Job Search Document Creator/Tracker http://i9.photobucket.com/albums/a58/Maskkkk/c64nMe.jpg Received my first computer (see above) at the age of 3, wrote my first program at the age of 7. Been hooked on programming ever since.

Updated on September 18, 2022

Comments

  • leeand00
    leeand00 almost 2 years

    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?

  • jscott
    jscott about 11 years
    +1, See also fsmgmt.msc, connect to remote computer.
  • kralyk
    kralyk about 11 years
    ahh...good call...I missed the "command line" tag...you are probably right that the OP wants a command line utility not the GUI.