Check File and Folder Permissions with PowerShell
In this post, we will demonstrate how to use PowerShell to check file and folder permissions in a specified directory. Understanding file and folder permissions is essential for maintaining security compliance within your organization. This script helps you quickly identify who has access to specific files and folders, making it easier to manage permissions effectively. The following PowerShell script will traverse a given directory and display detailed permission information for each file and folder within it:
# Define the directory to check permissions
$directoryPath = "C:\YourDirectory"
# Get all items in the directory
$items = Get-ChildItem -Path $directoryPath -Recurse
# Create an array to hold permission results
$permissionsList = @()
# Check permissions for each item
foreach ($item in $items) {
$acl = Get-Acl -Path $item.FullName
foreach ($access in $acl.Access) {
$permissionsList += New-Object PSObject -Property @{
Path = $item.FullName
Identity = $access.IdentityReference
AccessControl = $access.FileSystemRights
IsInherited = $access.IsInherited
InheritanceType = $access.InheritanceType
}
}
}
# Display the permission results
$permissionsList | Format-Table -AutoSize
Write-Host "Permissions checked successfully for files and folders in $directoryPath."Run it across your fleet
This script runs as-is on a single host. Paste it into ServerEngine to schedule it, run it on a whole server group in parallel, and keep the credentials out of the file — see the scripts documentation and the credential store.
More in Security & Auditing
Enable the Windows Firewall with PowerShell
2026-08-17Check Windows Firewall Status with PowerShell
2026-08-17Disable SMBv1 with PowerShell
2026-08-17Enforce TLS 1.2 in the Registry with PowerShell
2026-08-17Enable RDP Network Level Authentication with PowerShell
2026-08-17Audit the Local Administrators Group with PowerShell
2026-08-17Ready when you are.
Try ServerEngine free for 7 days.