PowerShell Get-Acl Cmdlet
PowerShell Script Files - Get-Acl
From a strategic point of view Get-Acl (Access Control List) is a stepping-stone to changing permissions with Set-Acl. When learning about Get-Acl select a file rather than a folder, those SID numbers can be so meaningless.
I have chosen the Windows log files as vehicle to test Get-Acl.
# PowerShell Get-Acl Windows Log files
Note 1: The reason that I used the variable $Files is that I want to remind you to change the value for the path before running this script on your machine.
Format-Table is of great help with Get-Acl. I recommend researching the precise spelling of the various properties by appending Get-Member thus:
# PowerShell Get-Acl Properties
Note 2: -MemberType *Property filters out methods, and shows just the various properties. One conclusion, PSChildName may be better than PSPath.
Note 3: Actually, any file will do to check the properties supported by Get-Acl.
Example 2: Get-Acl to Find a Particular Owner
The reasons that I chose -Match 'Administrator' is that every Windows operating system has Administrators, and I don't know the names of your users.
# PowerShell Get-Acl Find Owner = Administrator
Note 5: PowerShell syntax includes the ` backtick for word-wrap; however I try not use the backtick symbol `, instead I ended line 4 with the | pipe symbol. As a result of this formatting PowerShell realizes that the command continues on the next line.
In addition to pure research on PowerShell's Get-Acl, I strongly recommend that open Windows Explorer and look at not only the location of the files, but also at the permissions.
If you right-click any file or folder, select properties and check the permissions. For further detail click Edit, see screenshot to the right.
Another useful technique is to use CACLS
The problem: We need a list of all the permissions on a user's folder, especially any domain\username and group names. The basic command in Example 3a does not produce the desired results.
# Get-Acl Example 3a
The solution: -ExpandProperty
# Get-Acl Example 3b
SolarWinds' Network Performance Monitor will help you discover what's happening on your network. This utility will also guide you through troubleshooting; the dashboard will indicate whether the root cause is a broken link, faulty equipment or resource overload.
What I like best is the way NPM suggests solutions to network problems. Its also has the ability to monitor the health of individual VMware virtual machines. If you are interested in troubleshooting, and creating network maps, then I recommend that you try NPM now.
Research Get-Acl Parameters
One reason for research properties is if you want to modify the results, for example you wish to pipe the output into Format-Table, but are unsure which properties to specify.
# PowerShell Get-Acl Parameters
Checking the help file will reveal useful parameters, for instance the -audit switch maybe useful for your task. In addition to the file system you can also direct Get-Acl to list permissions on registry keys.
# PowerShell Content Cmdlet Research
This reveals the sister command Set-Acl. Incidentally, many of PowerShell's Get verbs also have a 'Set' companion cmdlet.
Summary of PowerShell's Get-Acl Cmdlet
Get-Acl is rather different from the mainstream PowerShell cmdlets. You can apply what you learn about 'Get' access control lists, changing permissions with Set-Acl.
If you like this page then please share it with your friends
See more PowerShell share examples including WMI
Please email me if you have a example scripts. Also please report any factual mistakes, grammatical errors or broken links, I will be happy to correct the fault.