Network Share Permission Reporter
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.
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."