top of page

PowerShell - Add User/Group to UNC share Get-Acl

  • Writer: Jon Boyette
    Jon Boyette
  • Jan 10, 2022
  • 1 min read

Save as name.ps1, once ran, prompts for UNC to add group or user to, then the user/group by domain\user capable to add, then asks for read, modify, full rights defined

$c = Read-Host "Enter Share UNC Path"

$d = Read-Host "Enter Account Credentials domain\username to Add to Share"

$e = Read-Host "Enter Read, Modify or Full for Groups Access rights to Apply"

{

$acl = Get-Acl $c


$AccessRule = New-Object System.Security.AccessControl.FileSystemAccessRule("$d","$e")


$acl.SetAccessRule($AccessRule)


$acl | Set-Acl \\Yourserver\Yourshare

}


 
 
 

Recent Posts

See All
PowerShell - List All Domain SPNs

Save as same List_ALL_SPNs.ps1 or similar, this LDap calls the Domain for all Service Principal names and accounts related #Build LDAP...

 
 
 
PowerShell - Start-Monitoring

This is a great script used to Monitor and Email if a server is up or down, once ran, and smtp and from address is set, then run:...

 
 
 

Comments


Post: Blog2 Post
  • Facebook
  • Twitter
  • LinkedIn

©2022 by Boyette Technical Services. Proudly created with Wix.com

bottom of page