Programmatically determining whether or not Exchange is installed

1.6k views Asked by At

How can you programmatically by means of PowerShell or Batch scripting determine if Exchange is installed on a server or not? I have 225 servers among which I need to find all Exchange servers.

2

There are 2 answers

0
Mathias R. Jessen On BEST ANSWER

You can query Active Directory for Exchange servers (requires the Active Directory PowerShell module):

# 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
0
Greenstone Walker On

From Exchange Management Shell (2007+).

Get-ExchangeServer

From PowerShell on the machine in question:

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

Alternatively - ask the Exchange Server admin team!