Hi, folks!
Version 1.0 has already been published here (simple script for automation of Exchange 2016 installation. can be used on multiple servers).
Today’s version is a little bit improved (2 separate files for 2-node configuration, 535 and 420 strings respectively, can be easy scaled out with copy-paste to more than 2 nodes). It helps you to install Exchange, prepare environment for DAG (prestage CNO, witness and etc) and create one with at least 2 members
Each node can be configured simultaneously (it’s not needed to wait while fist node finishes all tasks and etc. just run both scripts, relax and get a cup of coffee). It’s also ideally suitable for using as a part of VMM Service Templates or other kinds of unattended installations (I’ll show you it later)
If you’d like to get script files – write me directly or leave request in the comments. I’ll send you zip-file.
Update: scripts are at my GitHub Repo. Thanks for stars and commits!
What does script do (exch01.ps1)?
- Sets network settings (DNS, IP, GW) on targeted server
#.......... xIPAddress NewIPAddress #Set IPv4 on Ethernet adapter { IPAddress = $ip InterfaceAlias = "Ethernet" SubnetMask = 24 AddressFamily = "IPV4" DependsOn = "[xDhcpClient]DisabledDhcpClient" } xDefaultGatewayAddress GW #Set GW address { Address = $gw InterfaceAlias = "Ethernet" AddressFamily = "IPv4" DependsOn = "[xIPAddress]NewIPAddress" } #...........
- Installs required prerequisites for Exchange (including UCMA) and does reboot if it’s really required
#........ WindowsFeature WebNet45 { Ensure = 'Present' Name = 'Web-Net-Ext45' } WindowsFeature WebReq { Ensure = 'Present' Name = 'Web-Request-Monitor' } WindowsFeature WebSrv { Ensure = 'Present' Name = 'Web-Server' } #.........
- Adds server to domain and reboots it to apply changes
xComputer DomainJoin { Name = $nodename DomainName = $domainname Credential = $creds DependsOn = "[xDnsServerAddress]DNSServers" }
- Setups Exchange and checks if reboot is required after installation
xExchInstall InstallExchange { Path = "C:\ExchInstall\Exch\Setup.exe" Arguments = "/mode:Install /role:Mailbox /OrganizationName:""$netbios"" /Iacceptexchangeserverlicenseterms" Credential = $Creds DependsOn = '[xPendingReboot]BeforeExchangeInstall' }
- Adds and checks that DAG CNO is existed and required permissions are applied
#........... SetScript = { $creds = New-Object Management.Automation.PSCredential("$($using:netbios)\Administrator",(ConvertTo-SecureString $using:pass -AsPlainText -Force)) New-ADComputer -Name DAG01 -DNSHostName DAG01 -DisplayName DAG01 -Enabled $false -Credential $creds -verbose $DC=(Get-ADDomainController -Credential $creds).HostName ICM -ComputerName $DC -Credential $creds -ScriptBlock { #Variables $dagacc = Get-ADComputer DAG01 #-Credential $creds $dagldap="LDAP" + '://' + $dagacc.DistinguishedName $dagadsi = New-Object DirectoryServices.DirectoryEntry $dagldap #..... } #...........
- Configures witness server, DAG and generates status of successful completion
#........ xExchDatabaseAvailabilityGroup DAG { Name = $dagSettings.DAGName Credential = $creds AutoDagTotalNumberOfServers = $dagSettings.AutoDagTotalNumberOfServers AutoDagDatabaseCopiesPerVolume = $dagSettings.AutoDagDatabaseCopiesPerVolume #....... WitnessDirectory = 'C:\FSW' WitnessServer = $dagSettings.WitnessServer } #.........
Script file named as exch02.ps1 has almost the same steps with the following differences:
- Waits while Exchange setup initiated on the first node finishes Active Directory preparation and then starts Exchanges installation on the second node
- Waits while DAG becomes online and only then starts adding the second node
- No witness and DAG CNO preparation (hope it’s clear)
Requirements are still the same: exchange media, UCMA package, certificates for securing MOF-files (optional). All prerequisites (except Exchange media files) are in the zip-file (all-in-one).
Thanks for reading and have a nice week!