From 46e8c8fd45c484d7a7088d94addbf4e9be346768 Mon Sep 17 00:00:00 2001 From: Chris Long Date: Thu, 20 May 2021 15:07:46 -0700 Subject: [PATCH] Add install-exchange.ps1 to Vagrantfile for exchange --- AWS/Terraform/modules/exchange/main.tf | 3 ++- Vagrant/Exchange/Vagrantfile | 4 ++++ Vagrant/scripts/install-exchange.ps1 | 6 +++++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/AWS/Terraform/modules/exchange/main.tf b/AWS/Terraform/modules/exchange/main.tf index df1a483..8fb10e5 100644 --- a/AWS/Terraform/modules/exchange/main.tf +++ b/AWS/Terraform/modules/exchange/main.tf @@ -32,4 +32,5 @@ resource "aws_instance" "exchange" { root_block_device { delete_on_termination = true } -} \ No newline at end of file +} + diff --git a/Vagrant/Exchange/Vagrantfile b/Vagrant/Exchange/Vagrantfile index 699f44a..ff79204 100644 --- a/Vagrant/Exchange/Vagrantfile +++ b/Vagrant/Exchange/Vagrantfile @@ -23,6 +23,10 @@ Vagrant.configure("2") do |config| cfg.vm.provision "shell", path: "scripts/install-osquery.ps1", privileged: false cfg.vm.provision "shell", path: "scripts/install-sysinternals.ps1", privileged: false cfg.vm.provision "shell", path: "scripts/install-velociraptor.ps1", privileged: false + cfg.vm.provision "shell", path: "scripts/install-exchange.ps1", privileged: false + cfg.vm.provision "reload" + # Uncomment the line below once the commands in install-exchange.ps1 have been properly worked out + #cfg.vm.provision "shell", path: "scripts/install-exchange.ps1", privileged: false cfg.vm.provision "shell", inline: "Set-SmbServerConfiguration -AuditSmb1Access $true -Force", privileged: false cfg.vm.provision "shell", inline: 'cscript c:\windows\system32\slmgr.vbs /dlv', privileged: false diff --git a/Vagrant/scripts/install-exchange.ps1 b/Vagrant/scripts/install-exchange.ps1 index 96f41e2..12076db 100644 --- a/Vagrant/scripts/install-exchange.ps1 +++ b/Vagrant/scripts/install-exchange.ps1 @@ -160,7 +160,7 @@ If (-not(Test-Path c:\exchange_prereqs_complete.txt)) { Write-Host "$('[{0:HH:mm}]' -f (Get-Date)) [+] A reboot is required to continue installation of exchange." Write-Host "$('[{0:HH:mm}]' -f (Get-Date)) [+] Rebooting in 3 seconds..." Start-Sleep -Seconds 3 - shutdown /r /t 1 + #shutdown /r /t 1 exit 0 } Else { @@ -194,6 +194,7 @@ If (-not (Test-Path "d:\Setup.EXE")) { If (Test-Path "d:\Setup.exe") { Write-Host "$('[{0:HH:mm}]' -f (Get-Date)) Beginning installation of Exchange 2016..." + # Debugging: I need to figure out how to run these commands one-by-one and have them wait properly. Start-Process cmd.exe -ArgumentList "/k", "d:\setup.exe", "/PrepareSchema", "/IAcceptExchangeServerLicenseTerms" -Credential $credential -Wait Start-Process cmd.exe -ArgumentList "/k", "d:\setup.exe", "/PrepareAD", "/OrganizationName: DetectionLab", "/IAcceptExchangeServerLicenseTerms" -Credential $credential -Wait Start-Process cmd.exe -ArgumentList "/k", "d:\setup.exe", "/Mode:Install", "/Role:Mailbox", "/IAcceptExchangeServerLicenseTerms" -Credential $credential -Wait @@ -203,3 +204,6 @@ Else { Write-Host "$('[{0:HH:mm}]' -f (Get-Date)) Something went wrong downloading or mounting the ISO..." } +# Cleanup +# Shink disk +c:\Tools\Sysinternals\sdelete64.exe c: -z