Share via


How to set Write permission for Everyone using Powershell

Question

Tuesday, June 3, 2014 11:30 AM

I am trying to Share a folder with everyone and using the below command but it is not working,it shows that FOlder shared successfully

NET SHARE Folder=C:\foldername "/GRANT:Everyone,FULL"

Can anyone tell me the correct command?

All replies (9)

Tuesday, June 3, 2014 11:42 AM ✅Answered

This may help you

$acl = Get-Acl C:\FolderName 
$permission = "Domain\User","FullControl","ContainerInherit,ObjectInherit”,”None”,”Allow” 
$accessRule = New-Object System.Security.AccessControl.FileSystemAccessRule $permission 
$acl.SetAccessRule($accessRule) 
$acl | Set-Acl c:\foldername  

Regards Chen V [MCTS SharePoint 2010]


Tuesday, June 3, 2014 11:47 AM ✅Answered | 1 vote

I use this

Invoke-Expression -Command ('net share "Transport=E:\Transport" "/grant:Everyone,FULL"')


Tuesday, June 3, 2014 1:27 PM ✅Answered

Hi all,

I totally agree with that practice Mekac, and given what the OP posted, I'd say his problem is with the NTFS part. Some shameless advertisement regarding the NTFS permissions:

Those will make creating and adding the rule more Powershell-y :)

Cheers,
Fred

There's no place like 127.0.0.1


Tuesday, June 3, 2014 11:31 AM

I am trying to Share a folder with everyone and using the below command but it is not working,it shows that FOlder shared successfully

NET SHARE Folder=C:\foldername "/GRANT:Everyone,FULL"

Can anyone tell me the correct command?


Tuesday, June 3, 2014 11:39 AM

That works fine for me. What operating system are you running this command on? If I remember correctly, that /GRANT option wasn't added to "net share" until Server 2008 / Vista.


Tuesday, June 3, 2014 11:44 AM

This may help you

$acl = Get-Acl C:\FolderName 
$permission = "Domain\User","FullControl","ContainerInherit,ObjectInherit”,”None”,”Allow” 
$accessRule = New-Object System.Security.AccessControl.FileSystemAccessRule $permission 
$acl.SetAccessRule($accessRule) 
$acl | Set-Acl c:\foldername  

Regards Chen V [MCTS SharePoint 2010]

Why u wanna set NTFS permissions when he wants Share permissions?


Tuesday, June 3, 2014 11:44 AM

This is a duplicate thred

http://social.technet.microsoft.com/Forums/scriptcenter/en-US/5c927b1c-8777-4984-8651-816f86566ab4/how-to-set-write-permission-for-everyone-using-powershell?forum=winserverpowershell

Moderator please merge this.

Regards Chen V [MCTS SharePoint 2010]


Tuesday, June 3, 2014 12:05 PM

Why u wanna set NTFS permissions when he wants Share permissions?

Good Point - This got to my mind because NTFS is more in depth.

Regards Chen V [MCTS SharePoint 2010]


Tuesday, June 3, 2014 12:35 PM | 1 vote

Why u wanna set NTFS permissions when he wants Share permissions?

Good Point - This got to my mind because NTFS is more in depth.

Regards Chen V [MCTS SharePoint 2010]

Well,
my best practice is set share permissions for Everyone::full and restrict access on NTFS.

I dont know if the OP knows the difference between them .. so your post might be helpfull as well :)