for me this is the simpliest script to share folders with poweshell 4, works well in w2012:
#Username
$User = "
$DomainUser = "pacorini\"+$User
$BasePath = 'E:\HomeFolders\'
$ShareFolder = $BasePath+$User
#Create new share - this work only with windows 2012
#$Shares.Create($ShareFolder,$ShareName,0)
#Set NTFS Permission
$Ar = New-Object system.security.accesscontrol.filesystemaccessrule($DomainUser,'FullControl','ContainerInherit, ObjectInherit', 'None', 'Allow')
$Acl.AddAccessRule($Ar)
Set-Acl $ShareFolder $Acl
Grant-SmbShareAccess -Name $ShareName -AccountName $DomainUser -AccessRight Full -Force
Nessun commento:
Posta un commento