Pergunta

The Test-ServiceHealth in powershell for Exchange 2013 provides the following output:

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      : {}

Using the format-table option how can i separate the Services Running removing the braces & commas and display them one below the other?

Foi útil?

Solução

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                                                    
Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top