Follow sqlserver-dba.com

Subscribe to RSS feed  Follow @jackvamvas - Twitter

*Use the Comments section for questions

SQLServer-DBA.com Links

Dba_db2_button

dba-ninja.com

SQL Server DBA Jobs

Windows folder permissions with Powershell Get-ACL

07 May,2017 by Tom Collins

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.

Get-ACL

 

 

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 ...

 


Author: Tom Collins (http://www.sqlserver-dba.com)


Share:

Verify your Comment

Previewing your Comment

This is only a preview. Your comment has not yet been posted.

Working...
Your comment could not be posted. Error type:
Your comment has been posted. Post another comment

The letters and numbers you entered did not match the image. Please try again.

As a final step before posting your comment, enter the letters and numbers you see in the image below. This prevents automated programs from posting comments.

Having trouble reading this image? View an alternate.

Working...

Post a comment on Windows folder permissions with Powershell Get-ACL


sqlserver-dba.com | SQL Server Performance Tuning | SQL Server DBA:Everything | FAQ | Contact|Copyright & Disclaimer