以编程方式确定是否安装了 Exchange

Programmatically determining whether or not Exchange is installed

如何通过 PowerShell 或批处理脚本以编程方式确定服务器上是否安装了 Exchange?我有225台服务器,我需要找到其中所有的Exchange服务器。

您可以在 Active Directory 中查询 Exchange 服务器(需要 Active Directory PowerShell 模块):

# Locate configuration naming context for the forest
$ConfigNC = Get-ADRootDSE | Select-Object -ExpandProperty configurationNamingContext
# Search for registered Exchange servers
$Servers  = Get-ADObject -Filter {objectClass -eq "msExchExchangeServer" -and objectClass -ne "msExchClientAccessArray"} -SearchBase $ConfigNC | Select Name

来自 Exchange Management Shell (2007+).

Get-ExchangeServer

来自问题机器上的电源Shell:

Get-Service -name MSExchangeServiceHost
# If it is not there then Exchange Server is not installed.

或者 - 询问 Exchange Server 管理团队!