PublicFolder report

Written by Rob Shinwell on . Posted in POWERSHELL

#$AdminSessionADSettings.ViewEntireForest = $true $report = @() $mpf = import-csv -Path C:\Scripts\PFReports\MailPublicFolders.csv foreach ($folder in $mpf) { $mpf = get-mailpublicfolder -WarningAction SilentlyContinue -ErrorAction SilentlyContinue | where {$_.Name -eq $folder.Name} $mpfstats = $mpf | Get-PublicFolderStatistics -WarningAction SilentlyContinue -ErrorAction SilentlyContinue $alias = $mpf.Alias $DisplayName = $mpf.DisplayName $emailĀ  = $mpf.PrimarySmtpAddress $name = $mpf.Name $itemCount = $mpfstats.ItemCount $folderpath = $mpfstats.FolderPath $LastAccess = $mpfstats.LastAccessTime $LastMod = $mpfstats.LastModificationTime $TotSize = $mpfstats.TotalItemSize $returnedObj = new-object PSObject $returnedObj | add-member NoteProperty -name “Alias” -value $alias $returnedObj | add-member NoteProperty -name “DisplayName” -value $DisplayName $returnedObj | add-member NoteProperty -name “Email” -value $email $returnedObj | add-member NoteProperty -name “Item Count” -value $itemcount $returnedObj | add-member NoteProperty -name “Item Size (MB)” -value $TotSize.Value.ToMB() $returnedObj | add-member NoteProperty -name “Folder Path” -value $folderpath $returnedObj | add-member NoteProperty -name “Last Access Time” -value $LastAccess $returnedObj | add-member NoteProperty -name “Last Modification Time” -value $LastMod $report = $report += $returnedObj } $report | export-csv -Path C:\Scripts\PFReports\LA_PF_Report.csv