I need a script to run on Vista Ultimate to share an external drive and assign full control to Everyone. I've got a batch file to create the share using net share
, but there doesn't seem to be a way to change the permissions. I reckon this must be possible in PowerShell, but I have no idea where to start.
As of WMF 4:
New-SmbShare –Name ShareName –Path C:\LocalFolder –FullAccess Username
http://technet.microsoft.com/en-us/library/jj635722.aspx
In case you're searching for an answer to this question, but you're running Windows 7 (instead of Vista), as I was, you might be interested to know that permissions can be set in the NET SHARE command, now, directly.
For instance,
NET SHARE Movies=M:\Movies /GRANT:Everyone`,READ
will create a share and give Everyone read-only permissions to it.
Instead of READ, you can use CHANGE or FULL as well.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With