You could join the array values to a multiline-string, and then use the -Wrap
switch in Format-Table
, like this:
[pscustomobject]@{
Role = "Mailbox Server Role"
RequiredServicesRunning = $True
ServicesRunning = "IISAdmin", "MSExchangeADTopology", "MSExchangeDelivery"
ServicesNotRunning = ""
},[pscustomobject]@{
Role = "Client Access Server Role"
RequiredServicesRunning = $true
ServicesRunning= "IISAdmin", "MSExchangeADTopology", "MSExchangeIMAP4"
ServicesNotRunning = ""
} | Format-Table -AutoSize -Wrap Role, RequiredServicesRunning, @{n="ServicesRunning";e={$_.ServicesRunning -join "`n"}}, @{n="ServicesNotRunning";e={$_.ServicesNotRunning -join "`n"}}
Role RequiredServicesRunning ServicesRunning ServicesNotRunning
---- ----------------------- --------------- ------------------
Mailbox Server Role True IISAdmin
MSExchangeADTopology
MSExchangeDelivery
Client Access Server Role True IISAdmin
MSExchangeADTopology
MSExchangeIMAP4