This PowerShell script is built to audit and report the permissions on network shares across a specified server. It is crucial for system administrators to regularly check permissions to maintain security and compliance within their organization. By utilizing this script in conjunction with ServerEngine, administrators can ensure that access to sensitive data is tightly controlled and that only authorized users have permissions to network resources.
powershell
param (
[string]$serverName = "YourServerName"
)
# Getting the list of network shares
$shares = Get-WmiObject -Class Win32_Share -ComputerName $serverName
# Initialize an array to hold the permission details
$permissionsReport = @()
foreach ($share in $shares) {
$shareName = $share.Name
$securityDescriptor = Get-WmiObject -Class Win32_LogicalDisk -ComputerName $serverName | Where-Object { $_.DeviceID -eq $share.Path }
# Capture permission information
$securityDescriptor | ForEach-Object {
$permissions = @()
$acl = Get-Acl $_.ProviderName
foreach ($entry in $acl.Access) {
$permissions += "$($entry.IdentityReference) - $($entry.FileSystemRights) - $($entry.AccessControlType)"
}
# Create an object to hold the share permission details
$permissionsReport += [PSCustomObject]@{
ShareName = $shareName
Permissions = $permissions -join "; "
}
}
}
# Output the permissions report to a CSV file
$permissionsReport | Export-Csv -Path "C:\NetworkSharePermissions.csv" -NoTypeInformation
Write-Output "Network share permissions report has been created at C:\NetworkSharePermissions.csv."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.