Report on public folder permissions and usage

Is there any way to run a full report on public folder usage and permissions on exchange 2013. thanks.
LVL 6
Sid_FAsked:
Who is Participating?
 
ITguy565Commented:
This script should do what you are looking for :

https://gallery.technet.microsoft.com/office/Snapshot-report-of-Public-21235573

# This Sample Code is provided for the purpose of illustration only and is not intended to be used in a production environment.   
# THIS SAMPLE CODE AND ANY RELATED INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,  
# INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.   
# We grant You a nonexclusive, royalty-free right to use and modify the Sample Code and to reproduce and distribute the object  
# code form of the Sample Code, provided that You agree: (i) to not use Our name, logo, or trademarks to market  
# Your software product in which the Sample Code is embedded; (ii) to include a valid copyright notice on Your software product  
# in which the Sample Code is embedded; and (iii) to indemnify, hold harmless, and defend Us and Our suppliers from and against  
# any claims or lawsuits, including attorneys’ fees, that arise or result from the use or distribution of the Sample Code. 
 
Write-Progress -Activity "Finding Public Folders" -Status "running get-publicfolders -recurse" 
$folders = get-publicfolder -recurse -resultsize unlimited 
$arFolderData = @() 
$totalfolders = $folders.count 
$i = 1 
foreach ($folder in $folders)  
{ 
    $statusstring = "$i of $totalfolders" 
    write-Progress -Activity "Gathering Public Folder Information" -Status $statusstring -PercentComplete ($i/$totalfolders*100) 
    $folderstats = get-publicfolderstatistics $folder.identity 
    $folderdata = new-object Object 
    $folderdata | add-member -type NoteProperty -name FolderName $folder.name 
    $folderdata | add-member -type NoteProperty -name FolderPath $folder.identity 
    $folderdata | add-member -type NoteProperty -name LastAccessed $folderstats.LastAccessTime 
    $folderdata | add-member -type NoteProperty -name LastModified $folderstats.LastModificationTime 
    $folderdata | add-member -type NoteProperty -name Created $folderstats.CreationTime 
    $folderdata | add-member -type NoteProperty -name ItemCount $folderstats.ItemCount 
    $folderdata | add-member -type NoteProperty -name Size $folderstats.TotalItemSize 
    $folderdata | Add-Member -type NoteProperty -Name Mailenabled $folder.mailenabled 
 
    if ($folder.mailenabled) 
    { 
        #since there is no guarentee that a public folder has a unique name we need to compare the PF's entry ID to the recipient objects external email address 
        $entryid = $folder.entryid.tostring().substring(76,12) 
        $primaryemail = (get-recipient -filter "recipienttype -eq 'PublicFolder'" -resultsize unlimited | where {$_.externalemailaddress -like "*$entryid"}).primarysmtpaddress 
        $folderdata | add-member -type NoteProperty -name PrimaryEmailAddress $primaryemail 
    } else  
    { 
        $folderdata | add-member -type NoteProperty -name PrimaryEmailAddress "Not Mail Enabled" 
    } 
 
    if ($folderstats.ownercount -gt 0) 
    { 
        $owners = get-publicfolderclientpermission $folder.identity | where {$_.accessrights -like "*owner*"} 
        $ownerstr = "" 
        foreach ($owner in $owners)  
        { 
            $ownerstr += $owner.user.exchangeaddressbookdisplayname + "," 
        } 
     } else { 
        $ownerstr = "" 
     } 
     $folderdata | add-member -type NoteProperty -name Owners $ownerstr 
     $arFolderData += $folderdata 
     $i++ 
 } 
 $arFolderData | export-csv -path PublicFolderData.csv -notypeinformation 

Open in new window

0
 
ITguy565Commented:
As for permissions ,  This script should get you what you are looking for :

reference : http://itstuffilearnedtoday.blogspot.com/2015/08/powershell-script-to-report-all.html

######### BEGIN SCRIPT #########

Write-Host -Foreground Red "This script must be run from the Exchange Management Shell!"
$Init = Read-Host "Press Enter to Continue"

#Get all of the Public Folders
$PublicFolders = get-publicfolder -recurse

#Create a new array to hold the data
$Permissions = @()

Foreach ($Folder in $PublicFolders){
 #Full path and name of the public folder
 [string]$Foldername = ($Folder.ParentPath) + '\' + ($Folder.Name)
 
 #Get the permissions of the public Folder
 $FolderPermissions = Get-PublicFolderClientPermission $Folder
 
 Foreach ($Entry in $Folderpermissions){
  #If the User identity in NOT Null
  If (($Entry.User).ActiveDirectoryIdentity){
   #Get the User Identity of the permission
   $UserIdentity = (($Entry.User).ActiveDirectoryIdentity).ToString()
   
   #Create a new object to hold the data
   $PermissionItem = New-Object System.Object
   
   #Put the Full path and name of the public folder into the object
   $PermissionItem | Add-Member -type NoteProperty -name Folder -value $FolderName
   
   #Put the User Identity of the permission into the object
   $PermissionItem | Add-Member -type NoteProperty -name User -value ($Entry.User).ExchangeAddressBookDisplayName
   
   #Had to get funky here, and the Accessrights are an array and not readily enumaratable (is that even a word?)
   Foreach ($Value in ($Entry.AccessRights)){$Rights = (($Value.Permission).ToString())}
   
   #Add the user's rights to the object
   $PermissionItem | Add-Member -type NoteProperty -name Rights -value $Rights
   
   #Add the object into the array
   $Permissions += $PermissionItem
  } #End If
 } #End Foreach $Entry
} #End Foreach $Folder

#Export unique user values to a text document
$Permissions | select user -unique | sort user | out-file "C:\temp\UniquePublicFolderPermissions.txt"

#Export the permissions for all folders to CSV
$Permissions | Export-CSV "C:\temp\AllPublicFolderPemissions.csv" -NoTypeInformation

######### END SCRIPT #########

Open in new window

0
 
AmitIT ArchitectCommented:
This is what, I run to pull the report.

Get-PublicFolder –identity “\PF NAME” -Recurse -ResultSize Unlimited | Get-PublicFolderClientPermission | Select Identity,User,{$_.AccessRights} | Export-CSV "c:\PF.csv"
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.