3

I want to create a shared folder using PowerShell and then want to set permission on it as follows:

  1. Farm account: Full access
  2. Application pool account: Full access
  3. Everyone or Authenticated users: Read

What will be the possible powershell command to accomplish this?

closed as off-topic by Eric Alexander Sep 20 '16 at 13:38

  • This question does not appear to be about SharePoint within the scope defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

  • what you mean by Shared Folder? is it under any document library? – Waqas Sarwar MVP Mar 2 '15 at 18:05
  • No, These folders will be created under physical drive like C:\ – SPBeginer Mar 2 '15 at 18:32
  • I'm voting to close this question as off-topic because this is not a SharePoint specific issue. – Eric Alexander Sep 20 '16 at 13:38
5

here is the Create folder command:

New-Item "C:\Shared" –type directory

If you are creating multiple levels at once (like "C:\NewRootFolder\NewChildFolder\NewShared" you can add the –force switch to make it create all necessary parent folders in the heirarchy)

Now that you have a folder that you want to share, you can turn it into a shared folder using the New-SMBShare cmdlet.

New-SMBShare –Name "Shared" –Path "C:\Shared" `
 –ContinuouslyAvailable `
 –FullAccess domain\admingroup  `
 -ChangeAccess domain\deptusers `
 -ReadAccess "domain\authenticated users"

How to Create a Network Share with PowerShell 3

0

Don't think it's about SharePoint, but to share folder from cmd You don't need PS, You can use standard net share command:

@Echo off
ECHO Creating your sharing folder and network discovery
NET SHARE Upload=D:\Upload /GRANT:everyone,FULL
ECHO Your Upload folder is now available for sharing folder
ECHO.
NET SHARE Downloads=D:\Downloads /GRANT:everyone,READ
ECHO Your Download folder is now available for sharing folder
exit

Not the answer you're looking for? Browse other questions tagged or ask your own question.