Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Windows folder permissions with Powershell Get-ACL

Windows folder permissions report using Powershell Get-ACL is required by the Operations Team. They need to be able to pick any Windows folder and report on the permssions . The equivalent as when you right-click on a folder and pick the Security tab.

I need the basic Powershell functionality – and then I can build the script around the basic statement.

Answer: There are numerous methods to obtain the details. Using Get-ACL , you can run this across whatever folders are required. Before you can execute Get-ACL , you need to define the list of folders. That requires the Powershell Get-ChildItem cmdlet.

You’ll also need to exclude files. Exclude files by using $_.PsIsContainer.

Get-ChildItem M:\test | where-object {($_.PsIsContainer)} | Get-ACL | Format-List

Using this script will give you something like these details 

Path   : Microsoft.PowerShell.Core\FileSystem::M:\test
Owner  : BUILTIN\Administrators
Group  : MyDomain\ Users
Access : BUILTIN\Administrators Allow  FullControl
         BUILTIN\Administrators Allow  FullControl
         NT AUTHORITY\SYSTEM Allow  FullControl
         CREATOR OWNER Allow  
         BUILTIN\Users Allow  ReadAndExecute, Synchronize
         BUILTIN\Users Allow  AppendData
         BUILTIN\Users Allow  CreateFiles

If you want to read more about Powershell Get-ChildItem  and how to report a list of folders read Powerhsell Get-ChildItem folders only  

SQL Server - Powershell Get-ChildItem with examples ...



This post first appeared on SQLSERVER-DBA.com, please read the originial post: here

Share the post

Windows folder permissions with Powershell Get-ACL

×

Subscribe to Sqlserver-dba.com

Get updates delivered right to your inbox!

Thank you for your subscription

×