Get-Mailbox and Get-MailboxFolderStatistics

Welcome Forums General PowerShell Q&A Get-Mailbox and Get-MailboxFolderStatistics

This topic contains 0 replies, has 1 voice, and was last updated by  Forums Archives 7 years ago.

  • Author
  • #6499

    Points: 0
    Rank: Member

    by mhenderson3123 at 2013-01-07 10:37:56

    I'm using Exchange 2007 and would like to combine output from these two commands. The issue is when using the get-mailboxfolderstatics command to list folders the Identity also references the folder (i.e. testmjh\Test Folder). I'd like to be able to use the CSV file to suck the information into a SQL table and want to use just the alias, displayname, or SamAccountName as a column. Is there a way select several items from the Get-Mailbox command as well as the get-mailboxfolderstatistics command in a pipe in order to get content from both in one listing?

    by DonJ at 2013-01-08 08:27:25

    Not in a single pipeline, no. You would query the objects separately, store them in variables, and then create a new PSObject combining the desired properties from both. I frequently demo this with multiple WMI objects – see ... A&index=77, for example.

    by mhenderson3123 at 2013-01-08 09:56:02

    I looked at the various solutions which use a combination varaiable but was not successful in getting the desired list which combined the two. I ended up looking at this from a SQL standpoint and created a simple SQL query which updated the column in the table stripping anything to the right of the first \:

    Update [Table Name]
    SET [Identity]= (Select LEFT(([Identity]) ,CHARINDEX('\',([Identity]))-1 ))

The topic ‘Get-Mailbox and Get-MailboxFolderStatistics’ is closed to new replies.