Avatar of Member_2_6474242
Member_2_6474242
Flag for Fiji asked on

How To Manage File System ACLs With PowerShell

I have tried How To Manage File System ACLs With PowerShell
link http://www.tomsitpro.com/articles/powershell-manage-file-system-acl,2-837.html

I am unable to get the last part to run any help will be appreciated
http://www.tomsitpro.com/articles/powershell-manage-file-system-acl,2-837.html

First part
((Get-Item c:\test).GetAccessControl('Access')).Access

Second part
[PS] C:\Windows\system32>((Get-ChildItem c:\test -Directory).GetAccessControl('Access')).Access
Get-ChildItem : A parameter cannot be found that matches parameter name 'Directory'.
At line:1 char:35
+ ((Get-ChildItem c:\test -Directory <<<< ).GetAccessControl('Access')).Access
    + CategoryInfo          : InvalidArgument: (:) [Get-ChildItem], ParameterBindingException
    + FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand
PowershellScripting Languages

Avatar of undefined
Last Comment
Member_2_6474242

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
oBdA

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Ben Personick (Previously QCubed)

Actually, I think I mistook your use of a parameter that is unsupported as if it was part of the directory path.

If not, then you need to wrap your directory path in quotes.

Second part
[PS] C:\Windows\system32>((Get-ChildItem c:\test -Directory).GetAccessControl('Access')).Access
Get-ChildItem : A parameter cannot be found that matches parameter name 'Directory'.
At line:1 char:35
+ ((Get-ChildItem c:\test -Directory <<<< ).GetAccessControl('Access')).Access
    + CategoryInfo          : InvalidArgument: (:) [Get-ChildItem], ParameterBindingException
    + FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.Commands.GetChildItemCommand

Becomes:

((Get-ChildItem "c:\test -Directory").GetAccessControl('Access')).Access

Open in new window


Yeah my mistake, look at the answer above mine, quick read-through I did I didn't realize you were running into an issue of trying to run newer Powershell commands in an older PS environment, the above answer answers this succinctly.
Member_2_6474242

ASKER
what i want to achieve is to set permissions to multiple folders on a shared network drive. The drive has folders with the id of users which is the logon name. Is there any working script that can get this done
Jose Gabriel Ortega Castro

I'd propose this since it requires more than just simple scripting.
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
Member_2_6474242

ASKER
how can i  do it. What is a Gigs project?
Jose Gabriel Ortega Castro

A Gigs project is a paid project. where you can hire a freelancer to do the job.
It's located at the top of the page under "Products/Gigs"
Member_2_6474242

ASKER
thanks
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.