Public folder in exchange 2010
I have made two script for public folder in exchange 2010.
One script give me all the public folder list and other script give me owner list of all public folder.
 
Get-PublicFolderStatistics -ResultSize Unlimited |  where {$_.LastUserAccessTime -lt (get-date).AddDays(-90)}
 
Get-PublicFolderStatistics -ResultSize Unlimited | Get-PublicFolderClientPermission | Where {($_.AccessRights -eq "Owner"}
 
Can I merge these two script in single one so I have single excel having public folder lists and their owner?
 

 

May 27th, 2015 11:56am

>> I have made two script for public folder in exchange 2010.One script give me all the public folder list and other script give me owner list of all public folder.

This Get-PublicFolderStatistics -ResultSize Unlimited |  where {$_.LastUserAccessTime -lt (get-date).AddDays(-90)}

give you a filtered list of all the folders that where lasted accessed 90 days okay and

this Get-PublicFolderStatistics -ResultSize Unlimited | Get-PublicFolderClientPermission | Where {($_.AccessRights -eq "Owner"}

Gives you the owner of all the Folders. So something like

$folders = Get-PublicFolderStatistics -ResultSize Unlimited |  where {$_.LastUserAccessTime -lt (get-date).AddDays(-90)}
foreach($folder in $folders){
 $Owners = ""
 $Permissions = Get-PublicFolderClientPermission -Identity $folder.EntryId
 foreach($Permission in $Permissions){
  if($Permission.AccessRights.Contains("Owner")){
   $Owners += $Permission.User.DisplayName + ";"
  }
 }
 Add-Member -InputObject $folder -MemberType NoteProperty -Name Owners -Value $Owners -Force
 
}
$folders | export-csv -Path c:\temp\folderstats.csv -NoTypeInformation

Cheers
Glen


Free Windows Admin Tool Kit Click here and download it now
May 28th, 2015 6:36am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics