diff --git a/Build/Automate/DC/Phase2.ps1 b/Build/Automate/DC/Phase2.ps1 index 51a0a46..6226a84 100644 --- a/Build/Automate/DC/Phase2.ps1 +++ b/Build/Automate/DC/Phase2.ps1 @@ -37,6 +37,8 @@ if (Test-Path B:\Automate\automate.ini) { Write-BuildLog "Change default local administrator password" net user administrator $AdminPWD B:\automate\_Common\Autologon administrator lab $AdminPWD + $emailto = ((Select-String -SimpleMatch "emailto=" -Path "B:\Automate\automate.ini").line).substring(8) + $SmtpServer = ((Select-String -SimpleMatch "SmtpServer=" -Path "B:\Automate\automate.ini").line).substring(11) } Else { Write-BuildLog "Cannot find Automate.ini, this isn't a good sign" } @@ -461,6 +463,7 @@ If (((([System.Environment]::OSVersion.Version.Major *10) +[System.Environment]: Write-BuildLog "The version of SQL Management Studio on the Build share is incompatible with SQL Server 2008 Express R2 SP1. Please see ReadMe.html on the Build share." } else { Write-BuildLog "SQL Management Studio found; installing." + Install-WindowsFeature Net-Framework-Core Start-Process B:\SQLManagementStudio_x64_ENU.exe -ArgumentList "/ACTION=INSTALL /IACCEPTSQLSERVERLICENSETERMS /FEATURES=Tools /q" -Wait -Verb RunAs } } else { Write-BuildLog "SQL Management Studio not found (optional)."} @@ -531,19 +534,19 @@ if (Test-Path -Path "B:\VMTools\setup*") { $vcinstall = ((Select-String -SimpleMatch "VCInstall=" -Path "B:\Automate\automate.ini").line).substring(10) switch ($vcinstall) { 60 { - B:\Automate\_Common\wget.exe -nd http://packages.vmware.com/tools/esx/6.0/windows/VMware-tools-windows-9.10.0-2476743.iso -awget.log + B:\Automate\_Common\wget.exe -nd http://packages.vmware.com/tools/esx/6.0/windows/VMware-tools-windows-9.10.0-2476743.iso --no-check-certificate -awget.log . "C:\Program Files\7-Zip\7z.exe" x -r -y -aoa -oB:\VMtools\ c:\temp\VMware-tools-windows-9.10.0-2476743.iso >> C:\ExtractLog.txt Write-BuildLog "VMware Tools V6.0 Downloaded and extracted to build share." } 55 { - B:\Automate\_Common\wget.exe -nd http://packages.vmware.com/tools/esx/5.5u2/windows/VMware-tools-windows-9.4.10-2068191.iso -awget.log + B:\Automate\_Common\wget.exe -nd http://packages.vmware.com/tools/esx/5.5u2/windows/VMware-tools-windows-9.4.10-2068191.iso --no-check-certificate -awget.log . "C:\Program Files\7-Zip\7z.exe" x -r -y -aoa -oB:\VMtools\ c:\temp\VMware-tools-windows-9.4.10-2068191.iso >> C:\ExtractLog.txt Write-BuildLog "VMware Tools V5.5u2 Downloaded and extracted to build share." } 51 { - B:\Automate\_Common\wget.exe -nd http://packages.vmware.com/tools/esx/5.1u3/windows/x64/VMware-tools-windows-9.0.15-2323214.iso -awget.log + B:\Automate\_Common\wget.exe -nd http://packages.vmware.com/tools/esx/5.1u3/windows/x64/VMware-tools-windows-9.0.15-2323214.iso --no-check-certificate -awget.log . "C:\Program Files\7-Zip\7z.exe" x -r -y -aoa -oB:\VMtools\ c:\temp\VMware-tools-windows-9.0.15-2323214.iso >> C:\ExtractLog.txt Write-BuildLog "VMware Tools V5.1u3 Downloaded and extracted to build share." } 50 { - B:\Automate\_Common\wget.exe -nd http://packages.vmware.com/tools/esx/5.0u3/windows/x64/VMware-tools-windows-8.6.11-1310128.iso -awget.log + B:\Automate\_Common\wget.exe -nd http://packages.vmware.com/tools/esx/5.0u3/windows/x64/VMware-tools-windows-8.6.11-1310128.iso --no-check-certificate -awget.log . "C:\Program Files\7-Zip\7z.exe" x -r -y -aoa -oB:\VMtools\ c:\temp\VMware-tools-windows-8.6.11-1310128.iso >> C:\ExtractLog.txt Write-BuildLog "VMware Tools V5.0u3 Downloaded and extracted to build share." } @@ -558,7 +561,22 @@ if (Test-Path -Path "B:\VMTools\setup*") { if (($vmtools) -and (-Not (Test-Path "C:\Program Files\VMware\VMware Tools\VMwareToolboxCmd.exe"))) { Write-BuildLog "Installing VMware tools, build complete after reboot." Write-BuildLog "(Re)build vCenter next." + if (([bool]($emailto -as [Net.Mail.MailAddress])) -and ($SmtpServer -ne "none")){ + $mailmessage = New-Object system.net.mail.mailmessage + $SMTPClient = New-Object Net.Mail.SmtpClient($SmtpServer, 25) + $mailmessage.from = "AutoLab" + $mailmessage.To.add($emailto) + $Summary = "Completed AutoLab VM build.`r`n" + $Summary += "The build of $env:computername has finished, installing VMware Tools and rebooting`r`n" + $Summary += "The build log is attached`r`n" + $mailmessage.Subject = "$env:computername VM build finished" + $mailmessage.Body = $Summary + $attach = new-object Net.Mail.Attachment("C:\buildlog.txt", 'text/plain') + $mailmessage.Attachments.Add($attach) + $message.Attachments.Add($attach) + $SMTPClient.Send($mailmessage) + } Start-Process B:\VMTools\setup64.exe -ArgumentList '/s /v "/qn"' -verb RunAs -Wait - Start-Sleep -Seconds 5 + Start-Sleep -Seconds 300 } Read-Host "Press to exit" \ No newline at end of file diff --git a/Build/Automate/DC/SQLTCP.reg b/Build/Automate/DC/SQLTCP.reg index 13e112a..242bb33 100644 Binary files a/Build/Automate/DC/SQLTCP.reg and b/Build/Automate/DC/SQLTCP.reg differ diff --git a/Build/Automate/ShutLab.ps1 b/Build/Automate/ShutLab.ps1 index 1aa3e24..36468f6 100644 --- a/Build/Automate/ShutLab.ps1 +++ b/Build/Automate/ShutLab.ps1 @@ -36,6 +36,23 @@ If ([string]::Compare($ReBuild, "Y", $True) -eq "0"){ exit } } + Write-host "Connect to Linux amchiunes to cache RSA Keys, say yes to all" + $ping = new-object System.Net.NetworkInformation.Ping + $Reply = $ping.send("192.168.199.254") + if ($Reply.status –eq "Success") { + Write-Host " WAN" -foregroundcolor "Green" + cmd /c '"C:\Program Files (x86)\PuTTY\plink.exe" 192.168.199.254 -l root -pw VMware1! exit' + } + $Reply = $ping.send("gw") + if (($Reply.status –eq "Success") -and (!((get-vmplatform) -ne "Ravello"))) { + Write-Host " Router" -foregroundcolor "Green" + cmd /c '"C:\Program Files (x86)\PuTTY\plink.exe" gw -l root -pw VMware1! exit' + } + $Reply = $ping.send("nas") + if ($Reply.status –eq "Success") { + Write-Host " NAS" -foregroundcolor "Green" + cmd /c '"C:\Program Files (x86)\PuTTY\plink.exe" NAS -l root -pw VMware1! exit' + } Write-Host "Connect to vCenter" -foregroundcolor "Green" $null = connect-viserver vc.lab.local -user administrator -password $AdminPWD Write-Host "Shutdown any running VMs" -foregroundcolor "Green" @@ -49,7 +66,6 @@ If ([string]::Compare($ReBuild, "Y", $True) -eq "0"){ ShutWinServ ("cs2.lab.local") ShutWinServ ("v1.lab.local") ShutWinServ ("vbr.lab.local") - $ping = new-object System.Net.NetworkInformation.Ping $Reply = $ping.send("vc2.lab.local") if ($Reply.status –eq "Success") { Write-Host "Shutdown SRM Site" -foregroundcolor "Green" @@ -76,11 +92,6 @@ If ([string]::Compare($ReBuild, "Y", $True) -eq "0"){ Write-Host "Shutdown NAS" -foregroundcolor "Green" cmd /c '"C:\Program Files (x86)\PuTTY\plink.exe" NAS -l root -pw VMware1! shutdown -h now' } - $Reply = $ping.send("vcd") - if ($Reply.status –eq "Success") { - Write-Host "Shutdown vCloud" -foregroundcolor "Green" - cmd /c '"C:\Program Files (x86)\PuTTY\plink.exe" vcd -l root -pw VMware1! shutdown -h now' - } ShutWinServ ("dc2.lab.local") ShutWinServ ("dc.lab.local") ShutWinServ ("vc2.lab.local") diff --git a/Build/Automate/VC/Build.ps1 b/Build/Automate/VC/Build.ps1 index 6e7f69f..8958110 100644 --- a/Build/Automate/VC/Build.ps1 +++ b/Build/Automate/VC/Build.ps1 @@ -102,6 +102,8 @@ if (Test-Path "B:\Automate\automate.ini") { } $AdminPWD = "VMware1!" $AdminPWD = ((Select-String -SimpleMatch "Adminpwd=" -Path "B:\Automate\automate.ini").line).substring(9) + $emailto = ((Select-String -SimpleMatch "emailto=" -Path "B:\Automate\automate.ini").line).substring(8) + $SmtpServer = ((Select-String -SimpleMatch "SmtpServer=" -Path "B:\Automate\automate.ini").line).substring(11) } else { Write-BuidLog "Unable to find B:\Automate\automate.ini. Where did it go?" } @@ -646,6 +648,20 @@ If ($AutovCNS -eq "True"){ Write-BuildLog "Installing VMware tools, build complete after reboot." if (Test-Path B:\VMTools\setup64.exe) { #Read-Host "End of install checkpoint, before VMTools" + if (([bool]($emailto -as [Net.Mail.MailAddress])) -and ($SmtpServer -ne "none")){ + $mailmessage = New-Object system.net.mail.mailmessage + $SMTPClient = New-Object Net.Mail.SmtpClient($SmtpServer, 25) + $mailmessage.from = "AutoLab" + $mailmessage.To.add($emailto) + $Summary = "Completed AutoLab VM build.`r`n" + $Summary += "The build of $env:computername has finished, installing VMware Tools and rebooting`r`n" + $Summary += "The build log is attached`r`n" + $mailmessage.Subject = "$env:computername VM build finished" + $mailmessage.Body = $Summary + $attach = new-object Net.Mail.Attachment("C:\buildlog.txt", 'text/plain') + $mailmessage.Attachments.Add($attach) + $SMTPClient.Send($mailmessage) + } Start-Process B:\VMTools\setup64.exe -ArgumentList '/s /v "/qn"' -verb RunAs -Wait } diff --git a/Build/Automate/Validate.ps1 b/Build/Automate/Validate.ps1 index 69d4bdd..feb4b58 100644 --- a/Build/Automate/Validate.ps1 +++ b/Build/Automate/Validate.ps1 @@ -53,7 +53,6 @@ if ($CompName -eq "DC") { } net user SVC_Veeam $AdminPWD >> C:\AD-Users.log 2>> C:\Error.log net user SVC_SRM $AdminPWD >> C:\AD-Users.log 2>> C:\Error.log - net user SVC_vCD $AdminPWD >> C:\AD-Users.log 2>> C:\Error.log net user DomUser $AdminPWD >> C:\AD-Users.log 2>> C:\Error.log net user vi-admin $AdminPWD >> C:\AD-Users.log 2>> C:\Error.log net user administrator $AdminPWD >> C:\AD-Users.log 2>> C:\Error.log @@ -246,9 +245,6 @@ if ($CompName -eq "DC") { Check-DNSRecord ("nas.lab.local") Check-DNSRecord ("host1.lab.local") Check-DNSRecord ("host2.lab.local") - Check-DNSRecord ("vcd.lab.local") - Check-DNSRecord ("vcd-proxy.lab.local") - Check-DNSRecord ("vshield.lab.local") Check-DNSRecord ("192.168.199.4") Check-DNSRecord ("192.168.199.5") Check-DNSRecord ("192.168.199.6") @@ -328,9 +324,6 @@ if ($CompName -eq "DC2") { Check-DNSRecord ("nas.lab.local") Check-DNSRecord ("host1.lab.local") Check-DNSRecord ("host2.lab.local") - Check-DNSRecord ("vcd.lab.local") - Check-DNSRecord ("vcd-proxy.lab.local") - Check-DNSRecord ("vshield.lab.local") Check-DNSRecord ("192.168.199.4") Check-DNSRecord ("192.168.199.5") Check-DNSRecord ("192.168.199.6") diff --git a/Build/Automate/automate.ini b/Build/Automate/automate.ini index 7c16231..9af6fba 100644 --- a/Build/Automate/automate.ini +++ b/Build/Automate/automate.ini @@ -20,3 +20,5 @@ ViewVMProductKey=XXXXX-XXXXX-XXXXX-XXXXX-XXXXX KMSIP=0.0.0.0 +emailto=none +SmtpServer=none \ No newline at end of file diff --git a/Build/ChangeLog.txt b/Build/ChangeLog.txt index 52f2e27..6711bb2 100644 --- a/Build/ChangeLog.txt +++ b/Build/ChangeLog.txt @@ -1,3 +1,6 @@ +Version xx +- Added Email notification for VC & DC build. Specify destination address & SMTP server in autolmate.ini + Version 2.6 - Support for vSphere 6.0 - Nested 2012 Server VM