sorting - How to print Powershell Array Columns to Rows -


i'm running script find users in exchange folders within inbox. return 1 of users this:

$mailbox = @{name=test; folderpath=/inbox/test; foldersize=118.6 kb (121,475 bytes); folderandsubfoldersize=118.6 kb (121,475 bytes)} @{name=test folder 2; folderpath=/inbox/test folder 2; foldersize=0 b (0 bytes); folderandsubfoldersize=0 b (0 bytes)} 

i want take data , send them email listing folders. i'm using code body of email: "the following folders in inbox: $mailbox.folderpath"

i want (with line breaks):

the following folders in inbox:   /inbox/test   /inbox/test folder 2 

currently returns on 1 line:

the following in inbox:  /inbox/test /inbox/test folder 2 

how separate entries on different lines? thank you.

you try this:

$array = @("the following folders in inbox: ") foreach ($folder in $mailbox.folderpath)  {     $array += ($folder + "`n") } 

and $array put in body of email.


Popular posts from this blog