Skip to content

Instantly share code, notes, and snippets.

@techdecline
Created September 26, 2018 10:37
Show Gist options
  • Select an option

  • Save techdecline/1acfbf351505601c8441e58f507f5580 to your computer and use it in GitHub Desktop.

Select an option

Save techdecline/1acfbf351505601c8441e58f507f5580 to your computer and use it in GitHub Desktop.
function New-FileShare {
param ($FilePath)
$folder = New-Item -Path $FilePath -ItemType Directory
$readGroup = New-ADGroup -name "ACL_Read_$($folder.Name)" -PassThru -GroupCategory Security -GroupScope DomainLocal
$writeGroup = New-ADGroup -name "ACL_Write_$($folder.Name)" -PassThru -GroupCategory Security -GroupScope DomainLocal
#Start-Sleep -Seconds 5
New-SmbShare -Name $folder.Name -Path $FilePath -ChangeAccess $writeGroup.Name -ReadAccess $readGroup.Name -FullAccess Administrators
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment