{"id":729,"date":"2016-04-22T12:54:33","date_gmt":"2016-04-22T12:54:33","guid":{"rendered":"https:\/\/www.lieben.nu\/liebensraum\/?p=729"},"modified":"2016-04-22T12:54:33","modified_gmt":"2016-04-22T12:54:33","slug":"exchange-2007-public-folder-report-incl-rights-email-addresses-and-size","status":"publish","type":"post","link":"https:\/\/lieben.nu\/liebensraum\/2016\/04\/exchange-2007-public-folder-report-incl-rights-email-addresses-and-size\/","title":{"rendered":"Exchange 2007 or 2010 Public Folder report incl rights, email addresses and size"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Because I couldn&#8217;t quickly find a good script\/tool to make a report of my Public Folders that includes a complete drilldown including if they&#8217;re mail enabled, what email addresses it has, who has rights on the folder and what size the folders are, I&#8217;m sharing this script with you \ud83d\ude42<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Edit: added support for Exchange 2010, uncomment the correct section and comment the 2007 code if you run this on 2010.<\/p>\n\n\n\n<!--more-->\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: powershell; title: ; notranslate\" title=\"\">\n########\n#publicFolderReport\n#Copyright: Free to use, please leave this header intact\n#Author: Jos Lieben \n#Company: Lieben Consultancy\n#Script help: http:\/\/www.liebensraum.nl\n#Purpose: This script will give you an inventory of your public folders including usage\n########\n\n$csvPath = Read-Host \"Type a full path for a CSV file if you wish to export to CSV, otherwise, press enter\"\nWrite-Host \"One moment please\u2026.\" -ForeGroundColor Green\n$publicfolders = get-publicfolder -recurse -Identity \"\\\"\n$totalSize = 0\n$output = @()\nWrite-Progress -Activity \"Gathering data....\" -PercentComplete 0 -Status \"0% klaar\"\n$totalToDo = $publicfolders.Count\n$done = 0\nForeach($folder in $publicfolders){\ntry{\n$done++\n$percent = ($done\/($publicfolders.Count))*100\n}catch{$percent = 0}\nTry{\n\nWrite-Progress -Activity \"Gegevens zoeken....\" -PercentComplete $percent -Status \"$percent% klaar - processing $($folder.Identity)\"\n#EXCHANGE 2007\n$stringStart = $folder.Replicas&#x5B;0].DistinguishedName.IndexOf(\"InformationStore,CN=\")+20\n$parseString = $folder.Replicas&#x5B;0].DistinguishedName.SubString($stringStart)\n$serverName = $parseString.SubString(0,$parseString.IndexOf(\",\"))\n#\/EXCHANGE 2007\n#EXCHANGE 2010\n#$serverName = $folder.OriginatingServer.domain\n#\/EXCHANGE 2010\n$stats = Get-PublicFolderStatistics -Server $serverName -Identity $folder.Identity\n$totalSize += $($stats.TotalItemSize.Value.ToMB())\n$obj = New-Object PSObject\n$obj | Add-Member NoteProperty folder($folder.Identity)\n$obj | Add-Member NoteProperty size($stats.TotalItemSize.Value.ToMB())\n$obj | Add-Member NoteProperty LastAccessTime($stats.lastAccessTime)\nif($folder.MailEnabled){\n$pfMailProperties = Get-MailPublicFolder -Identity $folder.Identity\n$proxies = $pfMailProperties.EmailAddresses -Join \",\"\n$obj | Add-Member NoteProperty mailEnabled(\"YES\")\n$obj | Add-Member NoteProperty emailAddresses($proxies)\n}else{\n$obj | Add-Member NoteProperty mailEnabled(\"NO\")\n$obj | Add-Member NoteProperty emailAddresses(\"NONE\")\n}\n$perms = Get-PublicFolderClientPermission -Identity $folder.Identity -ErrorAction SilentlyContinue\n$permColumn = 0\nforeach($perm in $perms){\nif($perm.User.ActiveDirectoryIdentity.Name){\n$obj | Add-Member NoteProperty username$permColumn($perm.User.ActiveDirectoryIdentity.Name)\n$permColumn++\n}\n}\n$output += $obj\n}catch{\nWrite-Host \"$($folder.Identity) failed to get info because of $($Error&#x5B;0])\" -ForeGroundColor Red\n}\n}\n\nif($csvPath){\n$output | Export-CSV -Path $csvPath -Delimiter \";\"\n}else{\nWrite-Output $output\n}\nWrite-Host \"Total size of all folders: $totalSize\"\n<\/pre><\/div>","protected":false},"excerpt":{"rendered":"<p>Because I couldn&#8217;t quickly find a good script\/tool to make a report of my Public Folders that includes a complete drilldown including if they&#8217;re mail enabled, what email addresses it has, who has rights on the folder and what size the folders are, I&#8217;m sharing this script with you \ud83d\ude42 Edit: added support for Exchange &hellip; <a href=\"https:\/\/lieben.nu\/liebensraum\/2016\/04\/exchange-2007-public-folder-report-incl-rights-email-addresses-and-size\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Exchange 2007 or 2010 Public Folder report incl rights, email addresses and size<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_crdt_document":"","footnotes":""},"categories":[14,39],"tags":[],"class_list":["post-729","post","type-post","status-publish","format-standard","hentry","category-exchange-2007","category-powershell"],"_links":{"self":[{"href":"https:\/\/lieben.nu\/liebensraum\/wp-json\/wp\/v2\/posts\/729","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lieben.nu\/liebensraum\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lieben.nu\/liebensraum\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lieben.nu\/liebensraum\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lieben.nu\/liebensraum\/wp-json\/wp\/v2\/comments?post=729"}],"version-history":[{"count":0,"href":"https:\/\/lieben.nu\/liebensraum\/wp-json\/wp\/v2\/posts\/729\/revisions"}],"wp:attachment":[{"href":"https:\/\/lieben.nu\/liebensraum\/wp-json\/wp\/v2\/media?parent=729"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lieben.nu\/liebensraum\/wp-json\/wp\/v2\/categories?post=729"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lieben.nu\/liebensraum\/wp-json\/wp\/v2\/tags?post=729"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}