脚本命令如下:
##全部状态查询
function state{
function state{
get-exchangeserver| foreach{
Get-ServerComponentState -Identity "$_.Name"
}
Get-ServerComponentState -Identity "$_.Name"
}
}
##筛选组建异常的
function proxyInactive{
function proxyInactive{
state | where {$_.state -eq "InActive"}
}
#proxyInactive
#proxyInactive
##执行状态修正
proxyInactive |foreach{
Set-ServerComponentState -Identity $_.identity.name -State Active -Requester healthapi -Component $_.Component
}
proxyInactive |foreach{
Set-ServerComponentState -Identity $_.identity.name -State Active -Requester healthapi -Component $_.Component
}