Exchange 2013的powershell中的Test-ServiceHealth
提供以下输出:
Role : Mailbox Server Role
RequiredServicesRunning : True
ServicesRunning : {IISAdmin, MSExchangeADTopology, MSExchangeDelivery, MSExchangeIS...}
ServicesNotRunning : {}
Role : Client Access Server Role
RequiredServicesRunning : True
ServicesRunning : {IISAdmin, MSExchangeADTopology, MSExchangeIMAP4, MSExchangeMailboxReplication...}
ServicesNotRunning : {}
使用format-table
选项如何分离服务正在删除大括号&逗号并将它们显示在另一个之下?
答案 0 :(得分:1)
您可以将数组值加入多行字符串,然后使用-Wrap
中的Format-Table
开关,如下所示:
[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