Help with the script

Hello,
I need help with the following script. This script is working great for us except I would like to be able to tell if the IdentityREference is a USER or a GROUP. I would like the script to output everything the same way it is plus add an additional column which would say if it is a USER or a GROUP. Thank you so much.



# Include only folders from the root path
Get-ChildItem "C:\installs" -Recurse | ?{ $_.PsIsContainer } | %{
  $Path = $_.FullName

  (Get-Acl $Path).Access | Select-Object `
    @{n='Path';e={ $Path }}, IdentityReference, AccessControlType, `
    InheritanceFlags, PropagationFlags, FileSystemRights, IsInherited
} | Export-CSV "Permissions.csv"
creative555Asked:
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.

YZlatCommented:
you can use $object.Type property

try something like:

 (Get-Acl $Path).Access | Select-Object `
     @{n='Path';e={ $Path }}, IdentityReference, AccessControlType, `
     InheritanceFlags, PropagationFlags, FileSystemRights, IsInherited, $_.Type
 } | Export-CSV "Permissions.csv"

Open in new window

0
creative555Author Commented:
I tried and it didn't work. I got the error
invalid argument

System.Management.Automation.ScriptBlock}. 
At C:\scripts\GET-NTFSpermissions-Test.ps1:5 char:26 
+ (Get-Acl $Path).Access | Select-Object ` 
+                          ~~~~~~~~~~~~~~~ 
    + CategoryInfo          : InvalidArgument: (:) [Select-Object], NotSupportedException 
    + FullyQualifiedErrorId : DictionaryKeyUnknownType,Microsoft.PowerShell.Commands.Sele 
   ctObjectCommand
0
YZlatCommented:
remove the ` after Select-Object
0
Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.

creative555Author Commented:
Still getting an error
+                                                ~ 
Missing argument in parameter list. 
    + CategoryInfo          : ParserError: (:) [], ParseException 
    + FullyQualifiedErrorId : MissingExpressionAfterToken
0
creative555Author Commented:
Here is the entire script that I am trying

# Include only folders from the root path
Get-ChildItem "c:\installs" -Recurse | ?{ $_.PsIsContainer } | %{
  $Path = $_.FullName

(Get-Acl $Path).Access | Select-Object
     @{n='Path';e={ $Path }}, IdentityReference, AccessControlType, `
     InheritanceFlags, PropagationFlags, FileSystemRights, IsInherited, $_.Type
} | Export-CSV "Permissions-Test.csv"
0
footechCommented:
Without querying Active Directory and/or the local machine for each identity (i.e. each ACE), I don't see how this would be possible.  That could be a lot of queries.  Get-ACL doesn't return that info.  If I wanted to know whether the identity for an ACE represented a group or user, I would simply rely on a naming scheme for groups that made it clear anytime you were looking at a name you could immediately recognize it as belonging to a group or not.
0

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
creative555Author Commented:
oh. Ok. I thought it would be too difficult. WE will use the excel to do it then. THank you.
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.