Get-mailbox and Get-MailboxFolderStatistics ?..

Ask your PowerShell-related questions, including questions on cmdlet development!
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Post Reply
jackyjoy123
Posts: 2
Joined: Wed Dec 16, 2020 2:40 am

Get-mailbox and Get-MailboxFolderStatistics ?..

Post by jackyjoy123 »

Hello,

I am using a script below to get the Deleted items information. What I want to be able to do is instead of using Identity from the Get-MailboxFolderStatistics I would like to use the DisplayName from get-mailbox
get-mailbox | Get-MailboxFolderStatistics -FolderScope 'DeletedItems' | Select Identity, FolderPath, ItemsInFolder, FolderSize.

thanks
jackyjoy

jvierra
Posts: 14672
Joined: Tue May 22, 2007 9:57 am
Answers: 6
Has voted: 1 time
Been upvoted: 5 times
Contact:

Re: Get-mailbox and Get-MailboxFolderStatistics ?..

Post by jvierra »

This is how to persist an object in the pipeline:

Code: Select all

Get-Mailbox -PipelineVariable mb | 
    Get-MailboxFolderStatistics -FolderScope DeletedItems |
    Select-Object @{n='DisplayName';e={$mb.DisplayName}}, FolderPath, ItemsInFolder, FolderSize

Post Reply