Powershell - Need a script that will return all AD Users with share access

Welcome Forums General PowerShell Q&A Powershell - Need a script that will return all AD Users with share access

This topic contains 1 reply, has 2 voices, and was last updated by

 
Senior Moderator
2 months, 1 week ago.

  • Author
    Posts
  • #166097

    Participant
    Topics: 1
    Replies: 0
    Points: -43
    Rank: Member

    Background:

    I'm in process of obtaining a list of AD users and their emails for each of several shares. There are some explicit permissions set for individual AD users set in NTFS but it's largely security groups.

    What I need is a script that can go recursively through a share folder and it's subfolders and output me at most the ad username and email for each user who has access. It would need to pull the individual users from the security groups who have access as well.

    I want the script operator to either edit the path in the script or be able to run it like .\scriptname -PATH "C:\Users" -Recurse or similar.

    Basically I need

    Get-ACLs for the specified folder path recursively

    Get-ADGroupMembers for the groups that have permissions for the share path and/or subfolders

    Output a list containing the samaccountname and mail properties to either txt or CSV.

     

    Thanks in advance for your assistance!

  • #166160

    Senior Moderator
    Topics: 8
    Replies: 1041
    Points: 3,439
    Helping Hand
    Rank: Community Hero

    What I need is a script

    You have identified what cmdlets are required for you to start writing the script. To send mail, you would use Send-MailMessage cmdlet.

    start writing a script with the same order you highlighted above, folks here would assist you for any doubts/errors you get with that script.

You must be logged in to reply to this topic.