How to install Exchange 2007 from command line
Command line installation of Exchange 2007 can be achieved by using setup.com , below is setup.com help file.

Microsoft Exchange Server 2007 Setup Parameter Help
Install/Uninstall Server Role Usage:
Setup.com /mode:<setup mode> /roles:<roles to install> [/OptionalParameters]
--Install/Uninstall Required Parameters--
/mode, /m
Specifies the operation to perform:
. Install: (Default)--Installs one or more server roles.
. Uninstall: Removes one or all installed server roles.
/roles, /role, /r
Specifies the name of the Exchange Organization:
Specifies which server roles to install or uninstall:
/role:Mailbox
/roles:Mailbox, HubTransport
The following are the valid roles:
. HubTransport, HT, H
. ClientAccess, CA, C
. Mailbox, MB, M
. UnifiedMessaging, UM, U
. EdgeTransport, ET, E
. ManagementTools, MT, T
--Install/Uninstall Optional Parameters--
[/OrganizationName, /on]
/OrganizationName:MyCompany
* This parameter is required if the Exchange Organization
has not been created.
[/TargetDir, /t]
Specifies the location to install Exchange Server 2007 files.
Default: %programfiles%\Microsoft\Exchange Server
[/SourceDir, /s]
Specifies the path to the Exchange DVD.
[/UpdatesDir, /u]
Updates from the directory specified will be installed during
setup.
[/DomainController, /dc]
Specifies the domain controller that setup will use to read
and to write to Active Directory. Netbios or FQDN format can be used.
[/?]
Displays the help for setup.
--Install/Uninstall Advanced Optional Parameters--
[/AnswerFile /af]
Specifies the location of an answer file that contains advanced
parameters for setup.
The format for the answer file is <Key>=<Value>
Only the advanced parameters are valid for the answer file.
[/DoNotStartTransport]
Edge Transport Service will not be started during setup when this
parameter is specified.
Roles: Hub Transport, Edge Transport
[/EnableLegacyOutlook]
Specifies that legacy outlook clients can connect to the Exchange
2007 servers.
Roles: Mailbox
Remarks: This parameter can only be specified during the first
Exchange 2007 Mailbox server installation to an organization.
[/LegacyRoutingServer]
Specifies the name of a legacy Exchange server that will be used
to route messages to.
Roles: Hub Transport
Remarks: This parameter can only be specified during the first
Exchange 2007 Hub Transport server installation to an organization.
[/EnableErrorReporting]
This enables the Exchange server to automatically submit critical
error reports. Microsoft uses this information to diagnose problems
and provide solutions.
This parameter applies to installation of all server roles.
[/NoSelfSignedCertificates]
Specifies that setup should skip creating self signed certificates
if no other valid certificate is found for use in SSL/TLS sessions.
Roles: Client Access, Unified Messaging
[/AdamLdapPort]
LDAP Port to use for Edge Transport server role AD/AM instance.
Roles: Edge Transport
[/AdamSslPort]
SSL Port to use for Edge Transport server role AD/AM instance.
Roles: Edge Transport
Microsoft Exchange Server 2007 Setup Parameter Help
Install/Uninstall Server Role Usage:
Setup.com /mode:<setup mode> /roles:<roles to install> [/OptionalParameters]
--Install/Uninstall Required Parameters--
/mode, /m
Specifies the operation to perform:
. Install: (Default)--Installs one or more server roles.
. Uninstall: Removes one or all installed server roles.
/roles, /role, /r
Specifies the name of the Exchange Organization:
Specifies which server roles to install or uninstall:
/role:Mailbox
/roles:Mailbox, HubTransport
The following are the valid roles:
. HubTransport, HT, H
. ClientAccess, CA, C
. Mailbox, MB, M
. UnifiedMessaging, UM, U
. EdgeTransport, ET, E
. ManagementTools, MT, T
--Install/Uninstall Optional Parameters--
[/OrganizationName, /on]
/OrganizationName:MyCompany
* This parameter is required if the Exchange Organization
has not been created.
[/TargetDir, /t]
Specifies the location to install Exchange Server 2007 files.
Default: %programfiles%\Microsoft\Exchange Server
[/SourceDir, /s]
Specifies the path to the Exchange DVD.
[/UpdatesDir, /u]
Updates from the directory specified will be installed during
setup.
[/DomainController, /dc]
Specifies the domain controller that setup will use to read
and to write to Active Directory. Netbios or FQDN format can be used.
[/?]
Displays the help for setup.
--Install/Uninstall Advanced Optional Parameters--
[/AnswerFile /af]
Specifies the location of an answer file that contains advanced
parameters for setup.
The format for the answer file is <Key>=<Value>
Only the advanced parameters are valid for the answer file.
[/DoNotStartTransport]
Edge Transport Service will not be started during setup when this
parameter is specified.
Roles: Hub Transport, Edge Transport
[/EnableLegacyOutlook]
Specifies that legacy outlook clients can connect to the Exchange
2007 servers.
Roles: Mailbox
Remarks: This parameter can only be specified during the first
Exchange 2007 Mailbox server installation to an organization.
[/LegacyRoutingServer]
Specifies the name of a legacy Exchange server that will be used
to route messages to.
Roles: Hub Transport
Remarks: This parameter can only be specified during the first
Exchange 2007 Hub Transport server installation to an organization.
[/EnableErrorReporting]
This enables the Exchange server to automatically submit critical
error reports. Microsoft uses this information to diagnose problems
and provide solutions.
This parameter applies to installation of all server roles.
[/NoSelfSignedCertificates]
Specifies that setup should skip creating self signed certificates
if no other valid certificate is found for use in SSL/TLS sessions.
Roles: Client Access, Unified Messaging
[/AdamLdapPort]
LDAP Port to use for Edge Transport server role AD/AM instance.
Roles: Edge Transport
[/AdamSslPort]
SSL Port to use for Edge Transport server role AD/AM instance.
Roles: Edge Transport
Upgrade Exchange Server Usage:
Setup.com /mode:Upgrade [/OptionalParameters]
--Upgrade Required Parameters--
/mode, /m
Specifies the operation to perform:
Upgrade: Upgrades all installed servers roles.
--Upgrade Optional Parameters--
[/SourceDir, /s]
Specifies the path to the Exchange DVD.
[/UpdatesDir, /u]
Updates from the directory specified will be installed during
setup.
[/DomainController, /dc]
Specifies the domain controller that setup will use to read
and to write to Active Directory. Netbios or FQDN format can be used.
[/UpgradeCms,/uc]
Required to Upgrade CMS
[/?]
Displays the help for setup.
--Upgrade Advanced Optional Parameters--
[/AnswerFile /af]
Specifies the location of an answer file that contains advanced
parameters for setup.
The format for the answer file is <Key>=<Value>
Only the advanced parameters are valid for the answer file.
[/DoNotStartTransport]
Edge Transport Service will not be started during setup when this
parameter is specified.
Roles: Hub Transport, Edge Transport
Recover Exchange Server Usage:
Setup.com /mode:RecoverServer [/OptionalParameters]
--Recover Exchange Server Required Parameters--
/mode, /m
Specifies the operation to perform:
RecoverServer: Recovers an existing Exchange server object.
--Recover Exchange Server Optional Parameters--
[/TargetDir, /t]
Specifies the location to install Exchange Server 2007 files.
Default: %programfiles%\Microsoft\Exchange Server
[/UpdatesDir, /u]
Updates from the directory specified will be installed
during setup.
[/DomainController, /dc]
Specifies the domain controller that setup will use to read
and to write to Active Directory. Netbios or FQDN format can be used.
[/EnableErrorReporting]
This enables the Exchange server to automatically submit critical
error reports. Microsoft uses this information to diagnose problems
and provide solutions.
[/DoNotStartTransport]
Edge Transport Service will not be started during setup when this
parameter is specified.
Roles: Hub Transport, Edge Transport
Prepare Topology Usage:
Setup.com /PrepareAD [/DomainController:<FQDN of DC>]
Setup.com /PrepareSchema [/DomainController:<FQDN of DC>]
Setup.com /PrepareDomain [/DomainController:<FQDN of DC>]
Setup.com /PrepareDomain:<domainA,domainB> [/DomainController:<FQDN of DC>]
Setup.com /PrepareAllDomains [/DomainController:<FQDN of DC>]
Setup.com /PrepareLegacyExchangePermissions [/DomainController:<FQDN of DC>]
Setup.com /PrepareLegacyExchangePermissions:<domainA> [/DomainController:<FQDN of DC>]
--Prepare Topology Required Parameters--
/PrepareLegacyExchangePermissions, /pl
Prepares the permissions in a legacy forest.
Use this parameter only if you have Exchange 2000 or 2003 servers in your organization.
/PrepareLegacyExchangePermissions:<domain FQDN>, /pl:<domain FQDN>
Prepares the permissions for the specified domain.
/PrepareAD, /p
Prepares the Active Directory forest for the Exchange installation.
This will perform all the operations listed below in the local domain.
/PrepareSchema, /ps
Prepares the Active Directory Schema for the Exchange installation.
/PrepareDomain, /pd
Prepares the local domain for the Exchange installation.
/PrepareDomain:<domain FQDN>, /pd:<domain FQDN>
Prepares the specified domain for the Exchange installation.
/PrepareAllDomains, /pad
Prepares all domains in the forest for the Exchange
installation.
--Prepare Topology Optional Parameters--
[/DomainController, /dc]
Specifies the domain controller that setup will use to read
and write to Active Directory. Netbios or FQDN format can be used.
Clustered Mailbox Server Setup Usage:
Setup.com /NewCms /CmsName:<name>
[/CmsIpAddress:<IP address>] [/CmsIpv4Addresses:<IP addresses>]
[/CmsIpv4Networks:<network names>] [/CmsIpv6Networks:<network names>]
[/CmsSharedstorage] [/CmsDatapath:<Cms data path>]
Setup.com /RemoveCms /CmsName:<name>
Setup.com /RecoverCms /CmsName:<name>
[/CmsIpAddress:<IP address>] [/CmsIpv4Addresses:<IP addresses>]
[/CmsIpv4Networks:<network names>] [/CmsIpv6Networks:<network names>]
Setup.com /UpgradeCms /CmsName:<name>
--Cluster Setup Modes--
[/NewCms]
Creates a new clustered Mailbox server.
[/RemoveCms]
Removes an existing clustered Mailbox server.
[/ClearLocalCms]
Clears the local CMS configuration.
[/RecoverCms]
Recover an existing clustered Mailbox server.
[/UpgradeCMS]
Upgrade an existing CMS.
If there are multiple CMS instances, run /UpgradeCMS /CmsName:<name> for each CMS.
--Required Cluster Parameters--
/CmsName, /cn
Name of the Exchange clustered Mailbox server.
--Optional Cluster Parameters--
[/CMSIPAddress, /cip]
Static IPV4 address of the clustered mailbox server.
At least one IP address must be specified for a clustered mailbox server.
Use either /CMSIPAddress or /CMSIPV4Addresses to specify a static IPV4 address.
[/CMSIPv4Addresses]
Static IPV4 address(es) of the clustered mailbox server.
At least one IP address must be specified for a clustered mailbox server.
Use either /CMSIPAddress or /CMSIPV4Addresses to specify a static IPV4 address.
[/CMSIPv4Networks]
Names of cluster networks to create dynamic IPV4 addresses.
At least one IP address must be specified for a clustered mailbox server.
Use this option to specify the network for dynamic IPV4 address(es).
[/CMSIPv6Networks]
Names of cluster networks to create IPV6 addresses.
At least one IP address must be specified for a clustered mailbox server.
Use this option to specify the network(s) for IPV6 address(es).
[/CmsSharedStorage, /css]
Specifies that shared storage in a single copy cluster will be used.
[/CMSDataPath, /cdp]
Path for storage group and database data.
Server Setup Delegation Usage:
Setup.com /NewProvisionedServer:<ServerName> [/ServerAdmin:<Server Admin Group Name>]
Setup.com /RemoveProvisionedServer:<ServerName>
Setup.com /ForeignForestFQDN:<ForestFQDN>
--Server Setup Delegation Required Parameters--
/NewProvisionedServer:<ServerName>, /nprs
Creates a placeholder server object so that a delegated server admin can
run Exchange installation.
/RemoveProvisionedServer, /rprs
Removes the provisioned server object.
/ForeignForestFQDN
Creates another set of Exchange security groups in a separate forest.
--Server Setup Delegation Optional Parameter--
[/ServerAdmin, /sa]
User or group to be granted permission as Server Administrator.
You can only use this parameter with the /NewProvisionedServer parameter.
