new Psobject outputting expression

Welcome Forums General PowerShell Q&A new Psobject outputting expression

This topic contains 2 replies, has 2 voices, and was last updated by

 
Participant
4 weeks, 1 day ago.

  • Author
    Posts
  • #114153

    Participant
    Points: 25
    Rank: Member

    Hi – was wondering if I could get some help..  I would like to output a specific set of subfolders in outlook based on a specific path.  The script is done but my output contains the expression of the output.. I'm looking to remove @{FolderPath= from the output

    $arrymailboxes = get-mailbox -organizationalunit "Users"

    $arrymailboxes | % {

    New-Object psobject -Property @{

    Name = $_.Name

    DMSubFolder = (get-MailboxFolderStatistics $_.Name | ? {$_.FolderPath -like "/Inbox/_DM*"} | select folderpath )

    }

    }

    Output

    User, New    {@{FolderPath=/Inbox/_DM Quick Filer}, @{FolderPath=/Inbox/_DM Quick Filer/_Confidential}, @{FolderPath=/Inbox/_DM Quick Filer/120165046 – General Inquiries}

  • #114174

    Participant
    Points: 10
    Rank: Member
    
    # Added -ExpandProperty after Select-Object cmdlet
    
    ? {$_.FolderPath -like "/Inbox/_DM*"} | Select-Object -ExpandProperty folderpath )
    
    
  • #114177

    Participant
    Points: 25
    Rank: Member

    stoke of genius.. thankyou..

You must be logged in to reply to this topic.