How to grant domain user access to network share via batch file?

3

I am trying to grant access rights to a domain user in a batch file like this:

net share sharename=c:\dir /GRANT:\domain\username,FULL

But it fails. I can only grant rights to local users. Is there a way to grant rights to domain users with net share? If not, how can I do so in a batch file?

harp

Posted 2012-10-09T14:44:19.180

Reputation: 211

Answers

2

net share sharename=c:\dir /GRANT:domain\username,FULL

REMINGTON

Posted 2012-10-09T14:44:19.180

Reputation: 21

2This is the exact command the author tried. You simply removed the / from the domain path which does not make a difference. – Ramhound – 2017-01-30T14:26:43.710

0

You must also send the command icacl which grants the user full permissions.

  icacls "C:\dir" /grant  computerName\userName:(OI)(CI)F

you can find the full documentation here

https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/icacls

Flash10101

Posted 2012-10-09T14:44:19.180

Reputation: 1

no need for a batch file, simply send this command after or prior to sharing the folder – Flash10101 – 2018-02-09T08:38:51.650