úterý 30. srpna 2016

MS Exchange Server 2016 - instalační script (díl 7)

A zde máme ještě shrnutí ... celý jednoduchý instalační script

Powershell:

# MĚŘENÍ ČASU INSTALACE  
  CLS  
  Remove-Variable -Name * -ErrorAction SilentlyContinue
  $datetime=Get-Date
  Write-Host "Dnes je:"$datetime -ForegroundColor Red

# DEFINICE
  $exsrv="EXSRV16"  
  $mdbname="EXSRV16a"

  $instadr="e:\Exchange_Server.2016"
  $instadrlog="e:\Exchange_Server.2016\Mailbox\$mdbname"
  $exsrvlic="ABCDE-12345-FGHIJ-67890-KLMNO"
  $autdis="https://autodiscover.firma.cz/Autodiscover/Autodiscover.xml"

# INSTALACE MS EXCHANGE Server 2016
  r:\setup.exe /Mode:Install /Roles:Mailbox /IAcceptExchangeServerLicenseTerms /Targetdir:$instadr /LogFolderPath:$instadrlog /MdbName:$mdbname

# KONTROLA INSTALACE MS EXCHANGE SERVERŮ
  Add-PsSnapin Microsoft.Exchange.Management.PowerShell.E2010
  Get-ExchangeServer | FT Name,AdminDisplayVersion,ServerRole -AutoSize

# NASTAVENÍ AUTODISCOVERY
  Get-ClientAccessService | FT Name,AutoDiscoverServiceInternalUri
  Set-ClientAccessService -Identity $exsrv -AutoDiscoverServiceInternalUri $autdis
  Get-ClientAccessService | FT Name,AutoDiscoverServiceInternalUri

# ZAPNUTÍ MAPI/HTTP
  Set-OrganizationConfig –MapihttpEnable $true

# STOP+DISABLE POP3+IMAP4
  Stop-Service msExchangeIMAP4
  Stop-Service msExchangeIMAP4BE
  Stop-Service msExchangePOP3
  Stop-Service msExchangePOP3BE
  Set-Service msExchangeIMAP4 -startup Disabled
  Set-Service msExchangeIMAP4BE -startup Disabled
  Set-Service msExchangePOP3 -startup Disabled
  Set-Service msExchangePOP3BE -startup Disabled

# LICENCE
  Set-ExchangeServer $exsrv -ProductKey $exsrvlic
   
# KONTROLA OAB
  Get-OfflineAddressBook | FT Name, IsDefault,ExchangeVersion
  Get-MailBoxDatabase | FT NAME, *offline*,exchangeversion -AutoSize

# IMPORT CERTIFIKÁTU
  $exsrv13cert = "C:\Exchange2013Cert.pfx"
  $heslo = "heslo1"
  $password = ConvertTo-SecureString $heslo -AsPlainText –Force

  Import-ExchangeCertificate -FileName $exsrv13cert -PrivateKeyExportable $true –Password $password | Enable-ExchangeCertificate –Services POP,IMAP,IIS,SMTP –DoNotRequireSsl


# Restart IIS (ale není nutno, neb vzápětí provedeme RESTART počítače)
  IISRESET /noforce


# KONEC MĚŘENÍ
  Write-Host "END + RESTART" -ForegroundColor Yellow
  Write-Host "Instalace začala  :" $datetime -ForegroundColor Red
  Write-Host "Instalace skončila:" (Get-Date) -ForegroundColor Red

# RESTART
  Write-Host "RESTART" -ForegroundColor RED
  # Start-Sleep -s 59
  # Restart-Computer

Žádné komentáře:

Okomentovat