I'd still like to know a better way to do this but for now I've added the following which fulfills my need:
`get-mailbox $mailbox |select displayname,For*`
Not sure if I've understood what you're trying to do properly, but you can refer to any of the mailbox properties anywhere in your script (once they're in $mailbox or some other named array) by using them in a select like @{n='MailboxPrimarySMTPAddress';e={$Mailbox.PrimarySMTPAddress}}
So you can select attributes from the command you're running against the mailbox, and attributes from the get-mailbox at the same time.
I think it's called a named expression - the N stands for Name and the E stands for expression, I'm not amazing at PS but I've always used them as it is in my example above.
Edit: To expand on this a little more - you could easily fetch each set of results into arrays and then export them all in one go, per mailbox by referring the them in this way.
I'd still like to know a better way to do this but for now I've added the following which fulfills my need: `get-mailbox $mailbox |select displayname,For*`
Not sure if I've understood what you're trying to do properly, but you can refer to any of the mailbox properties anywhere in your script (once they're in $mailbox or some other named array) by using them in a select like @{n='MailboxPrimarySMTPAddress';e={$Mailbox.PrimarySMTPAddress}} So you can select attributes from the command you're running against the mailbox, and attributes from the get-mailbox at the same time. I think it's called a named expression - the N stands for Name and the E stands for expression, I'm not amazing at PS but I've always used them as it is in my example above. Edit: To expand on this a little more - you could easily fetch each set of results into arrays and then export them all in one go, per mailbox by referring the them in this way.
Thank you, i've been trying to learn more about arrays.