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
Member_2_6474242Senior Systems AdministratorAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

oBdACommented:
You're still running PowerShell 2.0, by now nearly nine years old.
Instead of "Get-ChildItem C:Homefolders -Directory", you can use
$HomeFolders = Get-ChildItem C:Homefolders | Where-Object {$_.PsIsContainer}

Open in new window

Or, in your example,
((Get-ChildItem c:\test | Where-Object {$_.PsIsContainer}).GetAccessControl('Access')).Access

Open in new window


Or upgrade PowerShell, if possible:
Windows Management Framework 5.1
https://www.microsoft.com/en-us/download/details.aspx?id=54616
1

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ben Personick (Previously QCubed)Lead Network EngineerCommented:
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.
0
Member_2_6474242Senior Systems AdministratorAuthor Commented:
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
0
Introducing the "443 Security Simplified" Podcast

This new podcast puts you inside the minds of leading white-hat hackers and security researchers. Hosts Marc Laliberte and Corey Nachreiner turn complex security concepts into easily understood and actionable insights on the latest cyber security headlines and trends.

Jose Gabriel Ortega CEE Solution Guide - CEO Faru Bonon ITCommented:
This expert suggested creating a Gigs project.
I'd propose this since it requires more than just simple scripting.
0
Member_2_6474242Senior Systems AdministratorAuthor Commented:
how can i  do it. What is a Gigs project?
0
Jose Gabriel Ortega CEE Solution Guide - CEO Faru Bonon ITCommented:
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"
0
Member_2_6474242Senior Systems AdministratorAuthor Commented:
thanks
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Powershell

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.