Command to list single users that have special permissions to folders and sub

Welcome Forums General PowerShell Q&A Command to list single users that have special permissions to folders and sub

This topic contains 5 replies, has 4 voices, and was last updated by

 
Participant
3 years, 3 months ago.

  • Author
    Posts
  • #32113

    Participant
    Points: 0
    Rank: Member

    Hi,

    For now i have following:

    get-childitem \\xxxxxfps001\Applications | where {get-aduser -filter {telephonenumber -like "*"}} | where{$_.psiscontainer} | foreach-object { get-acl $_.fullname | select path,owner,accesstostring}

    It kinda works – but is pretty slow. I want to list on single users (thats why i was using telephone as filter – as groups and special users dont have it).

    Any other idea how to do it efficiently?

  • #32115

    Participant
    Points: 0
    Rank: Member

    Hi,

    you can try running it like this:

    $users = (get-aduser -filter {telephonenumber -like "*"}).sAMAccountName
    get-childitem \\xxxxxfps001\Applications | where{$_.psiscontainer} | get-acl | where {$_.Owner.split('\')[1] -iin $users}

    if you have users from multiple domains you check the ACL owner domain as well. i used the split function here to get only the username without the domain.

  • #32119

    Participant
    Points: 0
    Rank: Member

    It shows me this error:

    Unexpected token 'iin' in expression or statement.
    At line:1 char:110

    Unexpected token 'users' in expression or statement.
    At line:1 char:114

  • #32120

    Participant
    Points: 1
    Rank: Member

    That's a type-o. Should be "-in" not "-iin", without the "" of course.

  • #32153

    Participant
    Points: 0
    Rank: Member

    $users = (get-aduser -filter {telephonenumber -like "*"}).sAMAccountName
    get-childitem \\xxxxxfps001\Applications | where{$_.psiscontainer} | get-acl | where {$_.Owner.split('\')[1] -in $users}
    You must provide a value expression on the right-hand side of the '-' operator.
    At line:3 char:110

    Unexpected token 'in' in expression or statement.
    At line:3 char:111

    Unexpected token 'users' in expression or statement.
    At line:3 char:114

    Something still wrong

  • #32155

    Participant
    Points: 0
    Rank: Member

    $psversiontable.PSVersion.Major -eq 2 ?

    try to use $users -contains $_.Owner.split('\')[1] instead of $_.Owner.split('\')[1] -in $users

The topic ‘Command to list single users that have special permissions to folders and sub’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort