Forum Discussion
Frenchy81100
Nov 14, 2022Copper Contributor
Specials Get-Acl and Set-Acl rules on directories
Hello Everyone, I'm managing to create a script for a company I am working with, and unfortunately, I'm stuck. The company wants some people to only access few directories using that path m...
- Nov 15, 2022
$Data1=Get-ChildItem C:\Users\Administrateur\Software\Clients -Directory -Recurse | where-object Name -eq Direct
Does that work? I don't think the * works... Nope, it doesn't 🙂
Nov 15, 2022
Perhaps you should take Ownership first?
$ACL = Get-ACL .\smithb
$Group = New-Object System.Security.Principal.NTAccount("Builtin", "Administrators")
$ACL.SetOwner($Group)
Set-Acl -Path .\smithb\profile.v2 -AclObject $ACL
https://learn-powershell.net/2014/06/24/changing-ownership-of-file-or-folder-using-powershell/
$ACL = Get-ACL .\smithb
$Group = New-Object System.Security.Principal.NTAccount("Builtin", "Administrators")
$ACL.SetOwner($Group)
Set-Acl -Path .\smithb\profile.v2 -AclObject $ACL
https://learn-powershell.net/2014/06/24/changing-ownership-of-file-or-folder-using-powershell/
Frenchy81100
Nov 15, 2022Copper Contributor
Yes I already am the owner of all the folders and files
- Nov 15, 2022
$Data1=Get-ChildItem C:\Users\Administrateur\Software\Clients -Directory -Recurse | where-object Name -eq Direct
Does that work? I don't think the * works... Nope, it doesn't 🙂- Frenchy81100Nov 16, 2022Copper Contributor
I checked with that line:
Get-ChildItem C:\Users\Administrateur\Software\Clients\ -Recurse | Where-Object -Property Name -Contains 'Direct'
It looks like it works and showed me the Folder in the different "Clients" Folders. I need to manage it for the rest of the Script.
Thank you a lot for your good help!
- Nov 16, 2022No problem, glad to help... Please mark my answer as solution to mark this as solved 🙂