Retrieve File Permissions using Get-Acl with PowerShell
Retrieving the owner and permissions of a file, folders and even registry keys is a breeze with PowerShell’s Get-Acl cmdlet. Let’s try checking to see who has access to to the C:\Documents and Settings\Administrator folder.
Get-Acl "C:\Documents and Settings\Administrator" |
Now this return everything that I would expect it to, but I prefer the Format-List view, so let’s check the permissions on the the file C:\Windows\clock.avi and output it in a list view.
Get-Acl "C:\Windows\clock.avi" | Format-List |
Ok, now I did say we could check the permissions of a registry key, so let’s go for it…
1 | Get-Acl HKLM:\Software\Microsoft |
Now if you just want to find out the owner of the file you could pull back just that value
1 | Get-Acl "C:\Windows\clock.avi" | Select Owner |