diff --git a/Build/Automate/AddHosts.ps1 b/Build/Automate/AddHosts.ps1 new file mode 100644 index 0000000..3b2bf56 --- /dev/null +++ b/Build/Automate/AddHosts.ps1 @@ -0,0 +1,534 @@ +# Script to add add ESX servers to vCenter and do initial configuration +# +# +# Version 0.9 +# +# +if (Test-Path C:\PSFunctions.ps1) { + . "C:\PSFunctions.ps1" +} else { + Write-BuildLog "PSFunctions.ps1 not found. Please copy all PowerShell files from B:\Automate to C:\ and rerun AddHosts.ps1" + Read-Host "Press to exit" + exit +} +#if ((Test-Administrator) -and (Test-Path "C:\Program Files\VMware\VMware Tools\VMwareToolboxCmd.exe")) { +# Write-BuildLog " " +# Write-BuildLog "This script should not be 'Run As Administrator'" +# Write-BuildLog " " +# Write-BuildLog "Just double click the shortcut" +# Write-BuildLog " " +# Read-Host "Press to exit" +# exit +#} +$a = (Get-Host).UI.RawUI +$b = $a.WindowSize +$b.Height = $a.MaxWindowSize.Height -1 +$a.WindowSize = $b +# WASP is a 64bit plugin, the Guest Cust. PowerCLI commands are only 32bit +#import-module C:\windows\system32\WASP.dll +#select-window -Title "Administrator: C:\*" | set-windowposition -left 3 -top 3 + +$Subnet = ((Get-WmiObject -Class Win32_NetworkAdapterConfiguration -Filter IPEnabled=TRUE -ComputerName .).IPAddress[0]).split(".")[2] +If ($Subnet -eq "199") { + Write-BuildLog "Building Primary Site" + $HostPrefix = "host" + $DCName = "Lab" + $ClusterName = "Local" + $SRM = $False +} +If ($Subnet -eq "201") { + Write-BuildLog "Building SRM Site" + $HostPrefix = "host1" + $DCName = "SRM" + $ClusterName = "DR" + $SRM = $True +} + +if ((Get-Service vpxd).Status -eq "Starting") { + Write-BuildLog "The vCenter service is still starting; script will pause until service has started." + do { + Start-Sleep -Seconds 30 + } until ((Get-Service vpxd).Status -eq "Running") +} elseif ((Get-Service vpxd).Status -eq "Stopped") { + Write-BuildLog "The vCenter service is stopped. Please verify the DC VM is powered on and databases have started." + Read-Host "Press to exit" + exit +} + +if ((Get-PSSnapin -Name VMware.VimAutomation.Core -ErrorAction SilentlyContinue) -eq $null) { + try { + Write-BuildLog "Loading PowerCLI plugin, this may take a little while." + Add-PSSnapin VMware.VimAutomation.Core + } + catch { + Write-BuildLog "Unable to load the PowerCLI plugin. Please verify installation or install VMware PowerCLI and run this script again." + Read-Host "Press to exit" + exit + } +} +for ($i=1;$i -le 4; $i++) { + $vmhost = "$HostPrefix$i.lab.local" + $ping = new-object System.Net.NetworkInformation.Ping + $Reply = $ping.send($vmhost) + if ($Reply.status –eq "Success") { + $MaxHosts = $i + } else { + $i =4 + } +} +If (!($MaxHosts -ge 2)){ + Write-Host "Couldn't find first two hosts to build, need host1 & host2 built before running this script" + Read-Host "Build the hosts & rerun this script" + Exit +} +Write-BuildLog " " +If (!(Test-Path "B:\*")) { Net use B: \\nas\Build} +if (Test-Path "B:\Automate\automate.ini") { + Write-BuildLog "Determining automate.ini settings." + $AdminPWD = ((Select-String -SimpleMatch "Adminpwd=" -Path "B:\Automate\automate.ini").line).substring(9) + $createds = ((Select-String -SimpleMatch "BuildDatastores=" -Path "B:\Automate\automate.ini").line).substring(16).Trim() + $createvm = ((Select-String -SimpleMatch "BuildVM=" -Path "B:\Automate\automate.ini").line).substring(8).Trim() + $createxp = ((Select-String -SimpleMatch "BuildViewVM=" -Path "B:\Automate\automate.ini").line).substring(12).Trim() + if ($createds -like "true") { + $createds = $true + Write-BuildLog " Datastores will be built and added to vCenter." + } else { + $createds = $false + } + if ($createvm -like "true") { + $createvm = $true + $ProdKey = ((Select-String -SimpleMatch "ProductKey=" -Path "B:\Automate\automate.ini" -List).line).substring(11).Trim() + Write-BuildLog " Windows 2003 VM for Lab will be created." + } else { + $createvm = $false + } + if ($createxp -like "true") { + $createxp = $true + $XPKey = ((Select-String -SimpleMatch "ViewVMProductKey=" -Path "B:\Automate\automate.ini").line).substring(17) + Write-BuildLog " Windows XP VM for VMware View Lab to be built." + } else { + $createxp = $false + } +} else { + Write-BuildLog "Unable to find B:\Automate\automate.ini. Where did it go?" +} + +Write-BuildLog "Connect to vCenter; this takes a while and may show a warning in yellow" + +try { + If ($SRM -eq $True) {$Connect = "vc2.lab.local"} + Else {$VCServer = "vc.lab.local"} + $Connect = Connect-VIServer $VCServer +} +catch { + Write-BuildLog "Unable to connect to vCenter. Exiting." + Read-Host "Press to exit" + exit +} +Write-BuildLog "Create datacenter and cluster" +if ((Get-DataCenter | where {$_.Name -eq $DCName}) -eq $null) { + $newDC = New-DataCenter -Location (Get-Folder -NoRecursion) -Name $DCName + $dc = $newDC.ExtensionData.MoRef + $pool = New-Object VMware.Vim.IpPool + $pool.name = "MyIPPool" + $pool.ipv4Config = New-Object VMware.Vim.IpPoolIpPoolConfigInfo + $pool.ipv4Config.subnetAddress = "192.168.$Subnet.0" + $pool.ipv4Config.netmask = "255.255.255.0" + $pool.ipv4Config.gateway = "192.168.$Subnet.2" + $pool.ipv4Config.range = "192.168.$Subnet.200#16" + $pool.ipv4Config.dns = New-Object System.String[] (1) + $pool.ipv4Config.dns[0] = "192.168.$Subnet.4" + $pool.ipv4Config.dhcpServerAvailable = $false + $pool.ipv4Config.ipPoolEnabled = $true + $pool.ipv6Config = New-Object VMware.Vim.IpPoolIpPoolConfigInfo + $pool.ipv6Config.subnetAddress = "" + $pool.ipv6Config.netmask = "ffff:ffff:ffff:ffff:ffff:ffff::" + $pool.ipv6Config.gateway = "" + $pool.ipv6Config.dns = New-Object System.String[] (1) + $pool.ipv6Config.dns[0] = "" + $pool.ipv6Config.dhcpServerAvailable = $false + $pool.ipv6Config.ipPoolEnabled = $false + $pool.dnsDomain = "" + $pool.dnsSearchPath = "" + $pool.hostPrefix = "" + $pool.httpProxy = "" + $pool.networkAssociation = New-Object VMware.Vim.IpPoolAssociation[] (1) + $pool.networkAssociation[0] = New-Object VMware.Vim.IpPoolAssociation + $pool.networkAssociation[0].network = New-Object VMware.Vim.ManagedObjectReference + $pool.networkAssociation[0].network.type = "DistributedVirtualPortgroup" + $pool.networkAssociation[0].network.Value = "dvportgroup-178" + $pool.networkAssociation[0].networkName = "" + $PoolManager = Get-View -Id 'IpPoolManager-IpPoolManager' + $Nul = $PoolManager.CreateIpPool($dc, $pool) +} +if ((Get-Cluster | where {$_.Name -eq $ClusterName}) -eq $null) { + $Cluster = New-Cluster $ClusterName -DRSEnabled -Location $DCName -DRSAutomationLevel FullyAutomated +} + +for ($i=1;$i -le $MaxHosts; $i++) { + $Num = $i +10 + $VMHost = $HostPrefix + $VMHost += $i + $VMHost += ".lab.local" + $VMotionIP = "172.16.$SubNet." + $VMotionIP += $Num + $IPStoreIP1 = "172.17.$SubNet." + $IPStoreIP1 += $Num + $IPStoreIP2 = "172.17.$SubNet." + $Num = $i +20 + $IPStoreIP2 += $Num + $FTIP = "172.16.$SubNet." + $FTIP += $Num + $Num = $i +40 + $vHeartBeatIP = "172.16.$SubNet." + $vHeartBeatIP += $Num + Write-BuildLog $VMHost + if ((Get-VMHost | where {$_.Name -eq $VMHost}) -eq $null) { + $Null = Add-VMHost $VMhost -user root -password $AdminPWD -Location $ClusterName -force:$true + Start-Sleep -Seconds 30 + try { + $null = Get-VMHost $VMHost + } + catch { + Write-BuildLog "Unable to find " $VMHost "; please verify the host is built and rerun the AddHosts script." + Read-Host "Press to exit" + exit + } + Start-Sleep 5 + While ((Get-VMHost $VMHost).ConnectionState -ne "Connected"){ + Write-BuildLog " " + Write-BuildLog $VMHost " is not yet connected. Pausing for 5 seconds." + Write-BuildLog " " + Start-Sleep 5 + } + $VMHostObj = Get-VMHost $VMHost + if (($vmhostObj.ExtensionData.Config.Product.FullName.Contains("ESXi")) -and ((get-VmHostNtpServer $VMhostobj) -ne "192.168.199.4")) { + # These services aren't relevant on ESX Classic, only ESXi + $null = Add-VMHostNtpServer -NtpServer "192.168.199.4" -VMHost $VMhost + $ntp = Get-VMHostService -VMHost $VMhost | Where {$_.Key -eq "ntpd"} + $null = Set-VMHostService $ntp -Policy "On" + $SSH = Get-VMHostService -VMHost $VMhost | Where {$_.Key -eq "TSM-SSH"} + $null = Set-VMHostService $SSH -Policy "On" + $TSM = Get-VMHostService -VMHost $VMhost | Where {$_.Key -eq "TSM"} + $null = Set-VMHostService $TSM -Policy "On" + if ($vmhostObj.version.split(".")[0] -ne "4") { + if ($PCLIVerNum -ge 51) { + $null = Get-AdvancedSetting -Entity $VMHostObj -Name "UserVars.SuppressShellWarning" | Set-AdvancedSetting -Value "1" -confirm:$false + } else { + $null = Set-VMHostAdvancedConfiguration -vmhost $VMhost -Name "UserVars.SuppressShellWarning" -Value 1 + } + } + } + $DSName = $VMHost.split('.')[0] + $DSName += "_Local" + $sharableIds = Get-ShareableDatastore | Foreach {$_.ID } + $null = Get-Datastore -vmhost $vmhost | Where {$sharableIds -notcontains $_.ID } | Set-DataStore -Name $DSName + $switch = Get-VirtualSwitch -vmHost $vmHostobj + if($switch -isnot [system.array]) { + Write-BuildLog " Configuring network." + $null = set-VirtualSwitch $switch -Nic vmnic0,vmnic1 -confirm:$false + $pg = New-VirtualPortGroup -Name vMotion -VirtualSwitch $switch + if ($vmhostObj.ExtensionData.Config.Product.FullName.Contains("ESXi")) { + $null = New-VMHostNetworkAdapter -VMHost $vmhost -Portgroup $pg -VirtualSwitch $switch -IP $VMotionIP -SubnetMask "255.255.255.0" -vMotionEnabled:$true -ManagementTrafficEnabled:$True + } else { + $null = New-VMHostNetworkAdapter -VMHost $vmhost -Portgroup $pg -VirtualSwitch $switch -IP $VMotionIP -SubnetMask "255.255.255.0" -vMotionEnabled:$true + $pg = New-VirtualPortGroup -Name vHeartBeat -VirtualSwitch $switch + $null = New-VMHostNetworkAdapter -VMHost $vmhost -Portgroup $pg -VirtualSwitch $switch -IP $vHeartBeatIP -SubnetMask "255.255.255.0" -ConsoleNIC + } + $pg = New-VirtualPortGroup -Name FT -VirtualSwitch $switch + $null = New-VMHostNetworkAdapter -VMHost $vmhost -Portgroup $pg -VirtualSwitch $switch -IP $FTIP -SubnetMask "255.255.255.0" -FaultToleranceLoggingEnabled:$true + $pg = New-VirtualPortGroup -Name IPStore1 -VirtualSwitch $switch + $null = New-VMHostNetworkAdapter -VMHost $vmhost -Portgroup $pg -VirtualSwitch $switch -IP $IPStoreIP1 -SubnetMask "255.255.255.0" + $pg = New-VirtualPortGroup -Name IPStore2 -VirtualSwitch $switch + $null = New-VMHostNetworkAdapter -VMHost $vmhost -Portgroup $pg -VirtualSwitch $switch -IP $IPStoreIP2 -SubnetMask "255.255.255.0" + $null = Get-VMHostStorage $VMHost | Set-VMHostStorage -SoftwareIScsiEnabled $true + $null = get-virtualportgroup -name vMotion | Get-NicTeamingPolicy | Set-NicTeamingPolicy -MakeNicActive vmnic1 + $null = get-virtualportgroup -name vMotion | Get-NicTeamingPolicy | Set-NicTeamingPolicy -MakeNicStandby vmnic0 + $pnic = (Get-VMhostNetworkAdapter -VMHost $VMHost -Physical)[2] + $switch = New-VirtualSwitch -VMhost $vmHost -Nic $pnic.DeviceName -NumPorts 128 -Name vSwitch1 + $null = New-VirtualPortGroup -Name Servers -VirtualSwitch $switch + $null = New-VirtualPortGroup -Name Workstations -VirtualSwitch $switch + $null = set-VirtualSwitch $switch -Nic vmnic2,vmnic3 -confirm:$false + Start-Sleep -Seconds 30 + If ($SRM -ne $True) { + Write-BuildLog " Add NFS datastores" + # Build datastore now added in unattend script + #$null = New-Datastore -nfs -VMhost $vmhost -Name Build -NFSHost "172.17.199.7" -Path "/mnt/LABVOL/Build" -readonly + $null = New-Datastore -nfs -VMhost $vmhost -Name NFS01 -NFSHost "172.17.199.7" -Path "/mnt/LABVOL/NFS01" + $null = New-Datastore -nfs -VMhost $vmhost -Name NFS02 -NFSHost "172.17.199.7" -Path "/mnt/LABVOL/NFS02" + } + if ($vmhostObj.version.split(".")[0] -ne "4") { + $null = remove-datastore -VMhost $vmhost -datastore remote-install-location -confirm:$false + } + Write-BuildLog " Configuring iSCSI" + $MyIQN = "iqn.1998-01.com.vmware:" + $VMHost.split('.')[0] + $null = Get-VMHostHba -VMhost $vmhost -Type iScsi | Set-VMHostHBA -IScsiName $MyIQN + If ($SRM -ne $True) { + $null = Get-VMHostHba -VMhost $vmhost -Type iScsi | New-IScsiHbaTarget -Address 172.17.199.7 -Type Send + $null = Get-VMHostStorage $VMHost -RescanAllHba + } + } + $null = Move-VMhost $VMHost -Destination $ClusterName + } +} + +Write-BuildLog "Restarting all hosts for consistency. This will take a few minutes." +$null = Get-VMHost -location $ClusterName | Restart-VMHost -confirm:$false -Force +Write-Host "Wait until all hosts have stopped pinging" +$PingStatus = @() +for ($i=1;$i -le $MaxHosts; $i++) {$PingStatus +=$True} +do { + Start-Sleep -Seconds 1 + $ping = new-object System.Net.NetworkInformation.Ping + for ($i=1;$i -le $MaxHosts; $i++) { + $VMHost = $HostPrefix + $VMHost += $i + $VMHost += ".lab.local" + If ((!(($ping.send($vmhost)).status –eq "Success")) -and ($PingStatus[$I-1] -eq $True)) {$PingStatus[$I-1] = $False} + } + $StayHere = $False + for ($i=1;$i -le $MaxHosts; $i++) { + If ($PingStatus[$I-1] -eq $True) {$StayHere = $True} + } +} while ($StayHere) +Write-Host "Wait until all hosts are pinging" +do { + Start-Sleep -Seconds 1 + $ping = new-object System.Net.NetworkInformation.Ping + for ($i=1;$i -le $MaxHosts; $i++) { + $VMHost = $HostPrefix + $VMHost += $i + $VMHost += ".lab.local" + If (($ping.send($vmhost)).status –eq "Success") {$PingStatus[$I-1] = $True} + } + $StayHere = $False + for ($i=1;$i -le $MaxHosts; $i++) { + If ($PingStatus[$I-1] -eq $False) {$StayHere = $True} + } +} while ($StayHere) +Write-Host "Wait until all hosts are Connected" +for ($i=1;$i -le $MaxHosts; $i++) {$PingStatus +=$False} +do { + Start-Sleep -Seconds 1 + for ($i=1;$i -le $MaxHosts; $i++) { + $VMHost = $HostPrefix + $VMHost += $i + $VMHost += ".lab.local" + If ((get-vmhost -name $VMHost).ConnectionState -eq "Connected" ) {$PingStatus[$I-1] = $True} + } + $StayHere = $False + for ($i=1;$i -le $MaxHosts; $i++) { + If ($PingStatus[$I-1] -eq $False) {$StayHere = $True} + } +} while ($StayHere) +Write-Host "Wait 2 minutes so last host is properly up" +start-sleep 120 +If ($SRM -ne $True){ + if (((Get-OSCustomizationSpec | where {$_.Name -eq "Windows"}) -eq $null) -and ($ProdKey -ne $null) ){ + $null = New-OsCustomizationSpec -Name Windows -OSType Windows -FullName Lab -OrgName Lab.local -NamingScheme VM -ProductKey $ProdKey -LicenseMode PerSeat -AdminPass VMware1! -Workgroup Workgroup -ChangeSid -AutoLogonCount 999 + } + if (((Get-OSCustomizationSpec | where {$_.Name -eq "WinXP"}) -eq $null) -and ($ProdKey -ne $null)) { + $null = New-OsCustomizationSpec -Name WinXP -OSType Windows -FullName Lab -OrgName Lab.local -NamingScheme VM -ProductKey $XPKey -LicenseMode PerSeat -AdminPass VMware1! -Workgroup Workgroup -ChangeSid -AutoLogonCount 999 + } + $VMHostObj = Get-VMHost $VMHost + If (($VMHostObj.Version.Split("."))[0] -eq "6") { + $MinVMFSVer = 5 + } Else { + $MinVMFSVer = 3 + } + if ($CreateDS) { + Write-BuildLog "Creating iSCSI datastores." + $iSCSILUNs = get-scsilun -vmhost $VMHost -CanonicalName "t10.*" + if ($vmhostobj.version.split(".")[0] -ne "4") { + if (((Get-Datastore | where {$_.Name -eq "iSCSI1"}) -eq $null) ) { + $null = New-Datastore -VMHost $VMHost -Name iSCSI1 -Path $iSCSILUNs[0].CanonicalName -Vmfs -FileSystemVersion 5 + Write-BuildLog "Created iSCSi1 Datstore" + } else { + Write-BuildLog "Registering all VMs found on existing datastore iSCSI1." + Register-VMs ("iSCSI1") + } + } + if ((Get-Datastore | where {$_.Name -eq "iSCSI2"}) -eq $null) { + $null = New-Datastore -VMHost $VMHost -Name iSCSI2 -Path $iSCSILUNs[1].CanonicalName -Vmfs -FileSystemVersion $MinVMFSVer + Write-BuildLog "Created iSCSi2 Datastore" + } else { + Write-BuildLog "Registering all VMs found on existing datastore iSCSI2." + Register-VMs ("iSCSI2") + } + if ((Get-Datastore | where {$_.Name -eq "iSCSI3"}) -eq $null) { + $null = New-Datastore -VMHost $VMHost -Name iSCSI3 -Path $iSCSILUNs[2].CanonicalName -Vmfs -FileSystemVersion $MinVMFSVer + Write-BuildLog "Created iSCSi3 datstore" + } else { + Write-BuildLog "Registering all VMs found on existing datastore iSCSI3" + Register-VMs ("iSCSI3") + } + } + Write-BuildLog "Setting up HA on cluster since shared storage is configured." + $Cluster = Get-Cluster -Name $ClusterName + $null = set-cluster -cluster $Cluster -HAEnabled:$True -HAAdmissionControlEnabled:$True -confirm:$false + $null = New-AdvancedSetting -Entity $cluster -Type ClusterHA -Name 'das.isolationaddress1' -Value "192.168.$SubNet.4" -confirm:$false -force + $null = New-AdvancedSetting -Entity $cluster -Type ClusterHA -Name 'das.isolationaddress2' -Value "172.17.$SubNet.7" -confirm:$false -force + $null = New-AdvancedSetting -Entity $cluster -Type ClusterHA -Name 'das.usedefaultisolationaddress' -Value false -confirm:$false -force + $spec = New-Object VMware.Vim.ClusterConfigSpecEx + $null = $spec.dasConfig = New-Object VMware.Vim.ClusterDasConfigInfo + $null = $spec.dasConfig.admissionControlPolicy = New-Object VMware.Vim.ClusterFailoverResourcesAdmissionControlPolicy + $null = $spec.dasConfig.admissionControlPolicy.cpuFailoverResourcesPercent = 50 + $null = $spec.dasConfig.admissionControlPolicy.memoryFailoverResourcesPercent = 50 + $Cluster = Get-View $Cluster + $null = $Cluster.ReconfigureComputeResource_Task($spec, $true) + Write-BuildLog "Waiting two minutes for HA to complete configuration." + Start-Sleep -Seconds 120 + + $VMHostObj = Get-VMHost $VMHost + $VMName="Template2012" + if (($CreateVM) -and ((Get-VM -name $VMName -ErrorAction "SilentlyContinue") -eq $null ) -and (test-path "\\192.168.199.7\build\Win2012.ISO")) { + $Datastore = Get-Datastore -VMhost $vmHost -name "NFS01" + Start-Sleep -Seconds 2 + if (!(Get-PSDrive -Name NFS01 -ErrorAction "SilentlyContinue")) { + $null = New-PSDrive -Name NFS01 -PSProvider ViMdatastore -Root '\' -Location $Datastore + } + #Create new VM if existing VM or template doesn't exist + if (!(Test-Path NFS01:\$VMName\$VMName.vmdk)) { + Write-BuildLog "Creating Template2012 VM as Windows Server 2012" + If ((Get-vmhost)[0].version -lt "5.5.0"){ + $MyVM = New-VM -Name $VMName -VMhost $vmHost -datastore $Datastore -NumCPU 1 -MemoryMB 768 -DiskMB 16384 -DiskStorageFormat Thin -GuestID windows8Server64Guest + get-networkadapter $MyVM |set-networkadapter -type e1000 -confirm:$false + } Else { + $MyVM = New-VM -Name $VMName -VMhost $vmHost -datastore $Datastore -NumCPU 1 -MemoryMB 768 -DiskMB 16384 -DiskStorageFormat Thin -GuestID windows8Server64Guest -Version "v8" + } + $null = New-CDDrive -VM $MyVM -ISOPath "[Build] /Win2012.ISO" -StartConnected + $null = New-FloppyDrive -VM $MyVM -FloppyImagePath "[Build] Automate/BootFloppies/Nested2012.flp" -StartConnected + $strBootHDiskDeviceName = "Hard disk 1" + $viewVM = Get-View -ViewType VirtualMachine -Property Name, Config.Hardware.Device -Filter @{"Name" = "^$VMName$"} + ## get the VirtualDisk device, then grab its Key (DeviceKey, used later) + $intHDiskDeviceKey = ($viewVM.Config.Hardware.Device | ?{$_.DeviceInfo.Label -eq $strBootHDiskDeviceName}).Key + ## bootable Disk BootOption device, for use in setting BootOrder (the corresponding VirtualDisk device is bootable, assumed) + $oBootableHDisk = New-Object -TypeName VMware.Vim.VirtualMachineBootOptionsBootableDiskDevice -Property @{"DeviceKey" = $intHDiskDeviceKey} + ## bootable CDROM device (per the docs, the first CDROM with bootable media found is used) + $oBootableCDRom = New-Object -Type VMware.Vim.VirtualMachineBootOptionsBootableCdromDevice + ## create the VirtualMachineConfigSpec with which to change the VM's boot order + $spec = New-Object VMware.Vim.VirtualMachineConfigSpec -Property @{"BootOptions" = New-Object VMware.Vim.VirtualMachineBootOptions -Property @{BootOrder = $oBootableCDRom, $oBootableHDisk}} + $null = $viewVM.ReconfigVM_Task($spec) + Write-BuildLog "Powering on VM and installing Windows." + $null = Start-VM $MyVM + } else { + Write-BuildLog "Found existing WinTemplate." + if (Test-Path NFS01:\$VMName\$VMName.vmtx) { + Write-BuildLog "Registering existing Template2012 template." + $vmxFile = Get-Item NFS01:\$VMName\$VMName.vmtx + $null = New-Template -VMHost $VMHost -TemplateFilePath $vmxFile.DatastoreFullPath + Write-BuildLog "Existing WinTemplate Template added to inventory." + } + } + Start-Sleep -Seconds 2 + $null = Remove-PSDrive NFS01 + } + + + if ($vmhostObj.version.split(".")[0] -eq "4") { + $Datastore = Get-Datastore -VMhost $vmHost -name "iSCSI2" + $VMName="WinTemplate4" + } else { + $Datastore = Get-Datastore -VMhost $vmHost -name "iSCSI1" + $VMName="WinTemplate" + } + + if (($CreateVM) -and ((Get-VM -name $VMName -ErrorAction "SilentlyContinue") -eq $null ) -and (test-path "\\192.168.199.7\build\Auto2K3.ISO")) { + if (!(Get-PSDrive -Name iSCSI1 -ErrorAction "SilentlyContinue")) { + $null = New-PSDrive -Name iSCSI1 -PSProvider ViMdatastore -Root '\' -Location $Datastore + } + Start-Sleep -Seconds 2 + #Create new VM if existing VM or template doesn't exist + if (!(Test-Path iSCSI1:\$VMName\$VMName.vmdk)) { + Write-BuildLog "Creating WinTemplate VM Windows Server 2003." + If ((Get-vmhost)[0].version -lt "5.5.0"){ + $MyVM = New-VM -Name $VMName -VMhost $vmHost -datastore $Datastore -NumCPU 1 -MemoryMB 384 -DiskMB 3072 -DiskStorageFormat Thin -GuestID winNetEnterpriseGuest + } Else { + $MyVM = New-VM -Name $VMName -VMhost $vmHost -datastore $Datastore -NumCPU 1 -MemoryMB 384 -DiskMB 3072 -DiskStorageFormat Thin -GuestID winNetEnterpriseGuest -Version "v8" + } + $null = New-CDDrive -VM $MyVM -ISOPath "[Build] /Auto2K3.iso" -StartConnected + Write-BuildLog "Powering on VM and installing Windows." + $null = Start-VM $MyVM + } else { + Write-BuildLog "Found existing WinTemplate." + if (Test-Path iSCSI1:\$VMName\$VMName.vmtx) { + Write-BuildLog "Registering existing WinTemplate template." + $vmxFile = Get-Item iSCSI1:\$VMName\$VMName.vmtx + $null = New-Template -VMHost $VMHost -TemplateFilePath $vmxFile.DatastoreFullPath + Write-BuildLog "Existing WinTemplate Template added to inventory." + } + } + Start-Sleep -Seconds 2 + $null = Remove-PSDrive iSCSI1 + } + $VMName = "WinXP" + $Datastore = Get-Datastore "iSCSI2" + if (($CreateXP) -and ((Get-VM -name $VMName -ErrorAction "SilentlyContinue") -eq $null ) -and (test-path "\\192.168.199.7\build\AutoXP.iso")) { + if (!(Get-PSDrive -Name iSCSI2 -ErrorAction "SilentlyContinue")) { + $null = New-PSDrive -Name iSCSI2 -PSProvider ViMdatastore -Root '\' -Location $Datastore + } + Start-Sleep -Seconds 2 + #Create new VM if existing VM or template doesn't exist + if (!(Test-Path iSCSI2:\$VMName\$VMName.vmdk)) { + Write-BuildLog "Creating Windows XP VM for View." + If ((Get-vmhost)[0].version -lt "5.5.0"){ + $MyVM = New-VM -Name $VMName -VMhost $vmHost -datastore $Datastore -NumCPU 1 -MemoryMB 384 -GuestID winXPProGuest + } Else { + $MyVM = New-VM -Name $VMName -VMhost $vmHost -datastore $Datastore -NumCPU 1 -MemoryMB 384 -GuestID winXPProGuest -Version "v8" + } + $null = New-CDDrive -VM $MyVM -ISOPath "[Build] /AutoXP.iso" -StartConnected + $null = New-FloppyDrive -VM $MyVM -FloppyImagePath "[Build] Automate/BootFloppies/vmscsi-1.2.0.4.flp" -StartConnected + $strBootHDiskDeviceName = "Hard disk 1" + $viewVM = Get-View -ViewType VirtualMachine -Property Name, Config.Hardware.Device -Filter @{"Name" = "^$VMName$"} + ## get the VirtualDisk device, then grab its Key (DeviceKey, used later) + $intHDiskDeviceKey = ($viewVM.Config.Hardware.Device | ?{$_.DeviceInfo.Label -eq $strBootHDiskDeviceName}).Key + ## bootable Disk BootOption device, for use in setting BootOrder (the corresponding VirtualDisk device is bootable, assumed) + $oBootableHDisk = New-Object -TypeName VMware.Vim.VirtualMachineBootOptionsBootableDiskDevice -Property @{"DeviceKey" = $intHDiskDeviceKey} + ## bootable CDROM device (per the docs, the first CDROM with bootable media found is used) + $oBootableCDRom = New-Object -Type VMware.Vim.VirtualMachineBootOptionsBootableCdromDevice + ## create the VirtualMachineConfigSpec with which to change the VM's boot order + $spec = New-Object VMware.Vim.VirtualMachineConfigSpec -Property @{"BootOptions" = New-Object VMware.Vim.VirtualMachineBootOptions -Property @{BootOrder = $oBootableCDRom, $oBootableHDisk}} + $null = $viewVM.ReconfigVM_Task($spec) + $Null = Start-VM $MyVM + } else { + Write-BuildLog "Found existing WinXP." + if (Test-Path iSCSI1:\$VMName\$VMName.vmtx) { + Write-BuildLog "Registering existing WinTemplate template." + $vmxFile = Get-Item iSCSI2:\$VMName\$VMName.vmtx + $null = New-Template -VMHost $VMHost -TemplateFilePath $vmxFile.DatastoreFullPath + Write-BuildLog "Existing WinTemplate Template added to inventory." + } + } + Start-Sleep -Seconds 2 + $null = Remove-PSDrive iSCSI2 + } + $VMName = "TTYLinux" + if ((Get-VM -name $VMName -ErrorAction "SilentlyContinue") -eq $null ) { + Write-BuildLog "Registering existing tiny TTYLinux VM." + $Datastore = Get-Datastore "Build" + if (!(Get-PSDrive -Name Build -ErrorAction "SilentlyContinue")) { + $null = New-PSDrive -Name Build -PSProvider ViMdatastore -Root '\' -Location $Datastore + } + $Datastore = Get-Datastore "iSCSI3" + if (!(Get-PSDrive -Name iSCSI3 -ErrorAction "SilentlyContinue")) { + $null = New-PSDrive -Name iSCSI3 -PSProvider ViMdatastore -Root '\' -Location $Datastore + } + if (!(Test-Path iSCSI3:/TTYLinux/TTYLinux.vmx)) { + Write-BuildLog "Copying TTYLinux VM to iSCSI3 datastore." + $Datastore = Get-Datastore "iSCSI3" + Copy-DatastoreItem Build:/Automate/ShellVMs/TTYLinux iSCSI3:\ -recurse + } + $vmxFile = Get-Item iSCSI3:/TTYLinux/TTYLinux.vmx + $null= New-VM -VMFilePath $VMXFile.DatastoreFullPath -VMHost $vmhost -Location "vm" -name "TTYLinux" + Start-Sleep -Seconds 2 + $null = Remove-PSDrive Build + $null = Remove-PSDrive iSCSI3 + } +} +Write-BuildLog " " + +$null = Disconnect-VIServer -Server * -confirm:$false +if (Test-Path "C:\Program Files\VMware\VMware Tools\VMwareToolboxCmd.exe") { + Read-Host " Configuration complete, press to continue." +} +exit diff --git a/Build/Automate/BootFloppies/CS1.flp b/Build/Automate/BootFloppies/CS1.flp new file mode 100644 index 0000000..1a89be1 Binary files /dev/null and b/Build/Automate/BootFloppies/CS1.flp differ diff --git a/Build/Automate/BootFloppies/CS2.flp b/Build/Automate/BootFloppies/CS2.flp new file mode 100644 index 0000000..c2b17eb Binary files /dev/null and b/Build/Automate/BootFloppies/CS2.flp differ diff --git a/Build/Automate/BootFloppies/DC.flp b/Build/Automate/BootFloppies/DC.flp new file mode 100644 index 0000000..3a31f93 Binary files /dev/null and b/Build/Automate/BootFloppies/DC.flp differ diff --git a/Build/Automate/BootFloppies/DC2.flp b/Build/Automate/BootFloppies/DC2.flp new file mode 100644 index 0000000..837f650 Binary files /dev/null and b/Build/Automate/BootFloppies/DC2.flp differ diff --git a/Build/Automate/BootFloppies/Nested2012.flp b/Build/Automate/BootFloppies/Nested2012.flp new file mode 100644 index 0000000..998dc72 Binary files /dev/null and b/Build/Automate/BootFloppies/Nested2012.flp differ diff --git a/Build/Automate/BootFloppies/SS.flp b/Build/Automate/BootFloppies/SS.flp new file mode 100644 index 0000000..74fd88c Binary files /dev/null and b/Build/Automate/BootFloppies/SS.flp differ diff --git a/Build/Automate/BootFloppies/V1.flp b/Build/Automate/BootFloppies/V1.flp new file mode 100644 index 0000000..7874fb2 Binary files /dev/null and b/Build/Automate/BootFloppies/V1.flp differ diff --git a/Build/Automate/BootFloppies/VBR.flp b/Build/Automate/BootFloppies/VBR.flp new file mode 100644 index 0000000..a465027 Binary files /dev/null and b/Build/Automate/BootFloppies/VBR.flp differ diff --git a/Build/Automate/BootFloppies/VC.flp b/Build/Automate/BootFloppies/VC.flp new file mode 100644 index 0000000..55b8579 Binary files /dev/null and b/Build/Automate/BootFloppies/VC.flp differ diff --git a/Build/Automate/BootFloppies/VC2.flp b/Build/Automate/BootFloppies/VC2.flp new file mode 100644 index 0000000..f8317f4 Binary files /dev/null and b/Build/Automate/BootFloppies/VC2.flp differ diff --git a/Build/Automate/BootFloppies/freesco.flp b/Build/Automate/BootFloppies/freesco.flp new file mode 100644 index 0000000..d7c9649 Binary files /dev/null and b/Build/Automate/BootFloppies/freesco.flp differ diff --git a/Build/Automate/BootFloppies/vmscsi-1.2.0.4.flp b/Build/Automate/BootFloppies/vmscsi-1.2.0.4.flp new file mode 100644 index 0000000..bf67f21 Binary files /dev/null and b/Build/Automate/BootFloppies/vmscsi-1.2.0.4.flp differ diff --git a/Build/Automate/CS1/Build.cmd b/Build/Automate/CS1/Build.cmd new file mode 100644 index 0000000..a3516a2 --- /dev/null +++ b/Build/Automate/CS1/Build.cmd @@ -0,0 +1,23 @@ +@echo off +echo ************************* +echo * +echo ** +echo * Connect to build share +net use B: \\192.168.199.7\Build >> c:\buildlog.txt +type b:\automate\version.txt >> c:\buildlog.txt +regedit -s b:\Automate\_Common\ExecuPol.reg +regedit -s b:\Automate\_Common\NoSCRNSave.reg +regedit -s B:\Automate\_Common\ExplorerView.reg +regedit -s b:\Automate\_Common\IExplorer.reg +regedit -s b:\Automate\_Common\Nested.reg +REG ADD "HKCU\Environment" /V SEE_MASK_NOZONECHECKS /T REG_SZ /D 1 /F +REG ADD "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /V SEE_MASK_NOZONECHECKS /T REG_SZ /D 1 /F +REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Attachments " /V SaveZoneInformation /T REG_DWORD /D 1 /F +echo * Activate Windows >> c:\buildlog.txt +cscript //B "%windir%\system32\slmgr.vbs" /ato +copy B:\Automate\PSFunctions.ps1 C:\ +copy B:\Automate\%computername%\Build.ps1 c:\ +echo * Starting PowerShell script for Phase 2 completion +echo * Starting PowerShell script for Phase 2 completion >> C:\buildlog.txt +powershell c:\Build.ps1 +if exist C:\Build.ps1 del c:\Build.ps1 \ No newline at end of file diff --git a/Build/Automate/CS1/Build.ps1 b/Build/Automate/CS1/Build.ps1 new file mode 100644 index 0000000..280e08b --- /dev/null +++ b/Build/Automate/CS1/Build.ps1 @@ -0,0 +1,76 @@ +if (Test-Path C:\PSFunctions.ps1) { + . "C:\PSFunctions.ps1" +} else { + Write-Host "PSFunctions.ps1 not found. Please copy all PowerShell files from B:\Automate to C:\ and rerun Build.ps1" + Read-Host "Press to exit" + exit +} + +if (Test-Path "B:\Automate\automate.ini") { + Write-BuildLog "Determining automate.ini settings." + $viewinstall = ((Select-String -SimpleMatch "ViewInstall=" -Path "B:\Automate\automate.ini").line).substring(12) + Write-BuildLog " VMware View install set to $viewinstall." + $timezone = ((Select-String -SimpleMatch "TZ=" -Path "B:\Automate\automate.ini").line).substring(3) + Write-BuildLog " Timezone set to $timezone." + tzutil /s "$timezone" + $AdminPWD = ((Select-String -SimpleMatch "Adminpwd=" -Path "B:\Automate\automate.ini").line).substring(9) +} +If (([System.Environment]::OSVersion.Version.Major -eq 6) -and ([System.Environment]::OSVersion.Version.Minor -ge 2)) { + Write-BuildLog "Disabling autorun of ServerManager at logon." + Start-Process schtasks -ArgumentList ' /Change /TN "\Microsoft\Windows\Server Manager\ServerManager" /DISABLE' -Wait -Verb RunAs + Write-BuildLog "Disabling screen saver" + set-ItemProperty -path 'HKCU:\Control Panel\Desktop' -name ScreenSaveActive -value 0 +} +$Files = get-childitem "b:\view$viewinstall" +for ($i=0; $i -lt $files.Count; $i++) { + If ($Files[$i].Name -like "VMware-viewconnectionserver*") {$Installer = $Files[$i].FullName} +} +Switch ($ViewInstall) { + 50 { + Write-BuildLog "Install View 5.0 Connection Server" + Start-Process $Installer -wait -ArgumentList " /s /v'/qn VDM_SERVER_INSTANCE_TYPE=1'" + C:\Windows\Microsoft.NET\Framework64\v2.0.50727\InstallUtil.exe "C:\Program Files\VMware\VMware View\Server\bin\PowershellServiceCmdlets.dll" >> c:\buildLog.txt + copy b:\automate\ViewSetup.ps1 c:\ + start-sleep 60 + %SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe c:\ViewSetup.ps1 >> c:\buildlog.txt + } + 51 { + Write-BuildLog "Install View 5.1 Connection Server" + Start-Process $Installer -wait -ArgumentList '/s /v"/qb VDM_SERVER_INSTANCE_TYPE=1 VDM_SERVER_RECOVERY_PWD=VMware1! VDM_SERVER_RECOVERY_PWD2=VMware1! VDM_INITIAL_ADMIN_OPTION=1 CEIP_OPTIN=0"' + C:\Windows\Microsoft.NET\Framework64\v2.0.50727\InstallUtil.exe "C:\Program Files\VMware\VMware View\Server\bin\PowershellServiceCmdlets.dll" >> c:\buildLog.txt + } + 52 { + Write-BuildLog "Install View 5.2 Connection Server" + Start-Process $Installer -wait -ArgumentList '/s /v"/qb VDM_SERVER_INSTANCE_TYPE=1 VDM_SERVER_RECOVERY_PWD=VMware1! VDM_SERVER_RECOVERY_PWD2=VMware1! VDM_INITIAL_ADMIN_OPTION=1 CEIP_OPTIN=0"' + C:\Windows\Microsoft.NET\Framework64\v2.0.50727\InstallUtil.exe "C:\Program Files\VMware\VMware View\Server\bin\PowershellServiceCmdlets.dll" >> c:\buildLog.txt + } + 53 { + Write-BuildLog "Install View 5.3 Connection Server" + Start-Process $Installer -wait -ArgumentList '/s /v"/qn VDM_SERVER_INSTANCE_TYPE=1 VDM_SERVER_RECOVERY_PWD=VMware1! VDM_SERVER_RECOVERY_PWD2=VMware1! VDM_INITIAL_ADMIN_OPTION=1 CEIP_OPTIN=0"' + C:\Windows\Microsoft.NET\Framework64\v2.0.50727\InstallUtil.exe "C:\Program Files\VMware\VMware View\Server\bin\PowershellServiceCmdlets.dll" >> c:\buildLog.txt + } + 60 { + Write-BuildLog "Install View 6.0 Connection Server" + copy $Installer C:\ViewInstaller.exe + Start-Process C:\ViewInstaller.exe -wait -ArgumentList '/s /v"/qn VDM_SERVER_INSTANCE_TYPE=1 FWCHOICE=1 VDM_INITIAL_ADMIN_SID=S-1-5-32-544 VDM_SERVER_RECOVERY_PWD=VMware1 VDM_SERVER_RECOVERY_PWD_REMINDER=First"' + C:\Windows\Microsoft.NET\Framework64\v2.0.50727\InstallUtil.exe "C:\Program Files\VMware\VMware View\Server\bin\PowershellServiceCmdlets.dll" >> c:\buildLog.txt + } +} +Write-BuildLog "Install Flash Player" +Start-Process msiexec -wait -ArgumentList " /i b:\Automate\_Common\install_flash_player_11_active_x.msi /qn" +Write-BuildLog "Setup Firewall" +netsh advfirewall firewall add rule name="All ICMP V4" dir=in action=allow protocol=icmpv4 +netsh advfirewall firewall set rule group="remote desktop" new enable=Yes +netsh advfirewall firewall set rule group="File and Printer Sharing" new enable=Yes +Write-BuildLog "Setup persistet route to other subnet for SRM and View" +route add 192.168.201.0 mask 255.255.255.0 192.168.199.254 -p +Write-BuildLog "Cleanup" +regedit /s b:\Automate\_Common\ExecuPol.reg +regedit -s b:\Automate\_Common\NoSCRNSave.reg +Write-BuildLog "Change default local administrator password" +net user administrator $AdminPWD +B:\automate\_Common\Autologon vi-admin lab $AdminPWD +reg delete HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /v Build /f +Write-BuildLog "Install VMware Tools" +b:\VMTools\Setup64.exe /s /v "/qn" +Read-Host "Rebooting after VMTools Install" diff --git a/Build/Automate/CS1/Shortcuts.vbs b/Build/Automate/CS1/Shortcuts.vbs new file mode 100644 index 0000000..e4468ac --- /dev/null +++ b/Build/Automate/CS1/Shortcuts.vbs @@ -0,0 +1,10 @@ +set WshShell = WScript.CreateObject("WScript.Shell") + +set oShortCutLink = WshShell.CreateShortcut("C:\Users\Public\Desktop\BuildLog.lnk") +oShortCutLink.TargetPath = "c:\BuildLog.txt" +oShortCutLink.Save + +set oShortCutLink = WshShell.CreateShortcut("C:\Users\Public\Desktop\View Setup.lnk") +oShortCutLink.TargetPath = "%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe" +oShortCutLink.Arguments = " c:\ViewSetup.ps1" +oShortCutLink.Save diff --git a/Build/Automate/CS2/Build.cmd b/Build/Automate/CS2/Build.cmd new file mode 100644 index 0000000..189e38e --- /dev/null +++ b/Build/Automate/CS2/Build.cmd @@ -0,0 +1,21 @@ +@echo off +echo ************************* +echo * +echo ** +echo * Connect to build share +net use B: \\192.168.199.7\Build >> c:\buildlog.txt +type b:\automate\version.txt >> c:\buildlog.txt +regedit -s b:\Automate\_Common\ExecuPol.reg +regedit -s b:\Automate\_Common\NoSCRNSave.reg +regedit -s B:\Automate\_Common\ExplorerView.reg +regedit -s b:\Automate\_Common\IExplorer.reg +REG ADD "HKCU\Environment" /V SEE_MASK_NOZONECHECKS /T REG_SZ /D 1 /F +REG ADD "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /V SEE_MASK_NOZONECHECKS /T REG_SZ /D 1 /F +REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Attachments " /V SaveZoneInformation /T REG_DWORD /D 1 /F +echo * Activate Windows >> c:\buildlog.txt +cscript //B "%windir%\system32\slmgr.vbs" /ato +copy B:\Automate\PSFunctions.ps1 C:\ +copy B:\Automate\%computername%\Build.ps1 c:\ +echo * Starting PowerShell script for Phase 2 completion +echo * Starting PowerShell script for Phase 2 completion >> C:\buildlog.txt +powershell c:\Build.ps1 diff --git a/Build/Automate/CS2/Build.ps1 b/Build/Automate/CS2/Build.ps1 new file mode 100644 index 0000000..91cc3d8 --- /dev/null +++ b/Build/Automate/CS2/Build.ps1 @@ -0,0 +1,84 @@ +if (Test-Path C:\PSFunctions.ps1) { + . "C:\PSFunctions.ps1" +} else { + Write-Host "PSFunctions.ps1 not found. Please copy all PowerShell files from B:\Automate to C:\ and rerun Build.ps1" + Read-Host "Press to exit" + exit +} + +if (Test-Path "B:\Automate\automate.ini") { + Write-BuildLog "Determining automate.ini settings." + $viewinstall = ((Select-String -SimpleMatch "ViewInstall=" -Path "B:\Automate\automate.ini").line).substring(12) + Write-BuildLog " VMware View install set to $viewinstall." + $timezone = ((Select-String -SimpleMatch "TZ=" -Path "B:\Automate\automate.ini").line).substring(3) + Write-BuildLog " Timezone set to $timezone." + tzutil /s "$timezone" + $AdminPWD = ((Select-String -SimpleMatch "Adminpwd=" -Path "B:\Automate\automate.ini").line).substring(9) +} +If (([System.Environment]::OSVersion.Version.Major -eq 6) -and ([System.Environment]::OSVersion.Version.Minor -ge 2)) { + Write-BuildLog "Disabling autorun of ServerManager at logon." + Start-Process schtasks -ArgumentList ' /Change /TN "\Microsoft\Windows\Server Manager\ServerManager" /DISABLE' -Wait -Verb RunAs + Write-BuildLog "Disabling screen saver" + set-ItemProperty -path 'HKCU:\Control Panel\Desktop' -name ScreenSaveActive -value 0 +} +if (Test-Path "C:\VMware-view*") { + $Files = get-childitem "C:\" + for ($i=0; $i -lt $files.Count; $i++) { + If ($Files[$i].Name -like "VMware-view*") {$Installer = $Files[$i].FullName} + } + switch ($viewinstall) { + 60 { + Write-BuildLog "Install View 6.0 Connection Server" + Start-Process $Installer -wait -ArgumentList '/s /v"/qn VDM_SERVER_INSTANCE_TYPE=2 ADAM_PRIMARY_NAME=cs1.lab.local"' + C:\Windows\Microsoft.NET\Framework64\v2.0.50727\InstallUtil.exe "C:\Program Files\VMware\VMware View\Server\bin\PowershellServiceCmdlets.dll" >> c:\buildLog.txt + } + 53{ + Write-BuildLog "Install View 5.3 Connection Server" + Start-Process $Installer -wait -ArgumentList '/s /v"/qn VDM_SERVER_INSTANCE_TYPE=2 ADAM_PRIMARY_NAME=cs1.lab.local"' + C:\Windows\Microsoft.NET\Framework64\v2.0.50727\InstallUtil.exe "C:\Program Files\VMware\VMware View\Server\bin\PowershellServiceCmdlets.dll" >> c:\buildLog.txt + } + 52 { + Write-BuildLog "Install View 5.2 Connection Server" + Start-Process $Installer -wait -ArgumentList '/s /v"/qn VDM_SERVER_INSTANCE_TYPE=2 ADAM_PRIMARY_NAME=cs1.lab.local"' + C:\Windows\Microsoft.NET\Framework64\v2.0.50727\InstallUtil.exe "C:\Program Files\VMware\VMware View\Server\bin\PowershellServiceCmdlets.dll" >> c:\buildLog.txt + } + 51 { + Write-BuildLog "Install View 5.1 Connection Server" + Start-Process $Installer -wait -ArgumentList '/s /v"/qn VDM_SERVER_INSTANCE_TYPE=2 ADAM_PRIMARY_NAME=cs1.lab.local"' + C:\Windows\Microsoft.NET\Framework64\v2.0.50727\InstallUtil.exe "C:\Program Files\VMware\VMware View\Server\bin\PowershellServiceCmdlets.dll" >> c:\buildLog.txt + } + 50 { + Write-BuildLog "Install View 5.0 Connection Server" + Start-Process $Installer -wait -ArgumentList '/s /v"/qn VDM_SERVER_INSTANCE_TYPE=2 ADAM_PRIMARY_NAME=cs1.lab.local"' + C:\Windows\Microsoft.NET\Framework64\v2.0.50727\InstallUtil.exe "C:\Program Files\VMware\VMware View\Server\bin\PowershellServiceCmdlets.dll" >> c:\buildLog.txt + } + } + reg delete HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /v Build /f + Exit +} +Write-BuildLog "Install Flash Player" +Start-Process msiexec -wait -ArgumentList " /i b:\Automate\_Common\install_flash_player_11_active_x.msi /qn" +Write-BuildLog "Setup Firewall" +netsh advfirewall firewall add rule name="All ICMP V4" dir=in action=allow protocol=icmpv4 +netsh advfirewall firewall set rule group="remote desktop" new enable=Yes +netsh advfirewall firewall set rule group="File and Printer Sharing" new enable=Yes +Write-BuildLog "Setup persistet route to other subnet for SRM and View" +route add 192.168.201.0 mask 255.255.255.0 192.168.199.254 -p +Write-BuildLog "Cleanup" +regedit /s b:\Automate\_Common\ExecuPol.reg +regedit -s b:\Automate\_Common\NoSCRNSave.reg +Write-BuildLog "Change default local administrator password" +net user administrator $AdminPWD +B:\automate\_Common\Autologon administrator CS2 $AdminPWD +Write-BuildLog "Copy Connection server install and setup recall" +$Files = get-childitem "b:\view$viewinstall" +for ($i=0; $i -lt $files.Count; $i++) { + If ($Files[$i].Name -like "VMware-viewconnectionserver*") {$Installer = $Files[$i].FullName} +} +copy $Installer C:\ +reg add HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /v Build /t REG_SZ /d "cmd /c c:\Build.cmd" /f >> c:\buildlog.txt +Write-BuildLog "Install VMware Tools" +b:\VMTools\Setup64.exe /s /v "/qn" +Read-Host "Reboot?" + + diff --git a/Build/Automate/CS2/Shortcuts.vbs b/Build/Automate/CS2/Shortcuts.vbs new file mode 100644 index 0000000..e4468ac --- /dev/null +++ b/Build/Automate/CS2/Shortcuts.vbs @@ -0,0 +1,10 @@ +set WshShell = WScript.CreateObject("WScript.Shell") + +set oShortCutLink = WshShell.CreateShortcut("C:\Users\Public\Desktop\BuildLog.lnk") +oShortCutLink.TargetPath = "c:\BuildLog.txt" +oShortCutLink.Save + +set oShortCutLink = WshShell.CreateShortcut("C:\Users\Public\Desktop\View Setup.lnk") +oShortCutLink.TargetPath = "%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe" +oShortCutLink.Arguments = " c:\ViewSetup.ps1" +oShortCutLink.Save diff --git a/Build/Automate/DC/DCPromo.ps1 b/Build/Automate/DC/DCPromo.ps1 new file mode 100644 index 0000000..fe6c773 --- /dev/null +++ b/Build/Automate/DC/DCPromo.ps1 @@ -0,0 +1,7 @@ +#Install-Windowsfeature AD-Domain-Services,DNS -IncludeManagementTools +Add-WindowsFeature -name ad-domain-services -IncludeManagementTools +Write-Host "Convertto-SecureString" +$safemodeadminpwd = ConvertTo-SecureString -String "VMware1!" -asplaintext -force + +Write-Host "Install-ADDSForest" +Install-ADDSForest -DomainName "lab.local" -ForestMode Win2008R2 -DomainMode Win2008R2 -SafeModeAdministratorPassword $safemodeadminpwd -Force diff --git a/Build/Automate/DC/DCpromo.txt b/Build/Automate/DC/DCpromo.txt new file mode 100644 index 0000000..9507ccf --- /dev/null +++ b/Build/Automate/DC/DCpromo.txt @@ -0,0 +1,9 @@ +[DCInstall] +InstallDNS = yes +DomainNetBiosName = lab +NewDomain=forest +NewDomainDNSName = lab.local +RebootOnCompletion = yes +ReplicaOrNewDomain = Domain +SiteName = "Lab" +SafeModeAdminPassword="VMware1!" diff --git a/Build/Automate/DC/DropDBs.txt b/Build/Automate/DC/DropDBs.txt new file mode 100644 index 0000000..23b1315 --- /dev/null +++ b/Build/Automate/DC/DropDBs.txt @@ -0,0 +1,18 @@ +drop database vCenter +go +drop database VUM +go +drop database ViewEvents +go +drop database ViewComposer +go +drop database SRM +go +drop database SRMRep +go +drop database RSA +go +drop database vCloud51 +go +drop database vCloud15 +go \ No newline at end of file diff --git a/Build/Automate/DC/MakeDB.txt b/Build/Automate/DC/MakeDB.txt new file mode 100644 index 0000000..024bb66 --- /dev/null +++ b/Build/Automate/DC/MakeDB.txt @@ -0,0 +1,89 @@ +Create Login vpx WITH PASSWORD = 'VMware1!' +Go +create Database vCenter +Go +use vCenter +go +sp_addrolemember @rolename = 'db_owner', @membername = 'vpx' +go +use MSDB +go +sp_addrolemember @rolename = 'db_owner', @membername = 'vpx' +go +use master +go +sp_addrolemember @rolename = 'db_owner', @membername = 'vpx' +go +grant VIEW SERVER STATE to vpx +go +GRANT VIEW ANY DEFINITION TO vpx +go +create database VUM +GO +ALTER AUTHORIZATION ON DATABASE::vCenter TO vpx +ALTER AUTHORIZATION ON DATABASE::VUM TO vpx +ALTER AUTHORIZATION ON DATABASE::msdb TO vpx +Go +Create Login VMview WITH PASSWORD = 'VMware1!' +Go +create database ViewEvents +GO +create database ViewComposer +GO +ALTER AUTHORIZATION ON DATABASE::ViewEvents TO VMview +ALTER AUTHORIZATION ON DATABASE::ViewComposer TO VMview +go +Create Login VMSRM WITH PASSWORD = 'VMware1!' +Go +create database SRM +GO +create database SRMRep +GO +ALTER AUTHORIZATION ON DATABASE::SRM TO VMSRM +ALTER AUTHORIZATION ON DATABASE::SRMRep TO VMSRM +Go +EXEC master..sp_addsrvrolemember @loginame = 'lab\VI-admin', @rolename = 'sysadmin' +Go +EXEC master..sp_addsrvrolemember @loginame = 'lab\SVC_Veeam', @rolename = 'sysadmin' +Go +USE MASTER +GO +CREATE DATABASE RSA ON PRIMARY( +NAME='RSA_DATA', +FILENAME='C:\Program Files\Microsoft SQL Server\MSSQL10_50.SQLEXPRESS\MSSQL\DATA\RSA_DATA.mdf', +SIZE=10MB, +MAXSIZE=UNLIMITED, +FILEGROWTH=10%), +FILEGROUP RSA_INDEX( +NAME='RSA_INDEX', +FILENAME='C:\Program Files\Microsoft SQL Server\MSSQL10_50.SQLEXPRESS\MSSQL\DATA\RSA_INDEX.ndf', +SIZE=10MB, +MAXSIZE=UNLIMITED, +FILEGROWTH=10%) +LOG ON( +NAME='translog', +FILENAME='C:\Program Files\Microsoft SQL Server\MSSQL10_50.SQLEXPRESS\MSSQL\DATA\translog.ldf', +SIZE=10MB, +MAXSIZE=UNLIMITED, +FILEGROWTH=10% ) +GO +SP_DBOPTION 'RSA', 'autoshrink', true +GO +EXEC SP_DBOPTION 'RSA', 'trunc. log on chkpt.', true +GO +CHECKPOINT +GO +USE MASTER +GO +CREATE LOGIN RSA_DBA WITH PASSWORD = 'VMware1!', DEFAULT_DATABASE = RSA +GO +CREATE LOGIN RSA_USER WITH PASSWORD = 'VMware1!', DEFAULT_DATABASE = RSA +GO +USE RSA +GO +ALTER AUTHORIZATION ON DATABASE::RSA TO [RSA_DBA] +GO +CREATE USER RSA_USER FOR LOGIN [RSA_USER] +GO +CHECKPOINT +GO diff --git a/Build/Automate/DC/MakeDB41.txt b/Build/Automate/DC/MakeDB41.txt new file mode 100644 index 0000000..72054e2 --- /dev/null +++ b/Build/Automate/DC/MakeDB41.txt @@ -0,0 +1,32 @@ +Create Login vpx WITH PASSWORD = 'VMware1!' +Go +create Database vCenter +Go +create database VUM +GO +ALTER AUTHORIZATION ON DATABASE::vCenter TO vpx +ALTER AUTHORIZATION ON DATABASE::VUM TO vpx +ALTER AUTHORIZATION ON DATABASE::msdb TO vpx +Go +Create Login VMview WITH PASSWORD = 'VMware1!' +Go +create database ViewEvents +GO +create database ViewComposer +GO +ALTER AUTHORIZATION ON DATABASE::ViewEvents TO VMview +ALTER AUTHORIZATION ON DATABASE::ViewComposer TO VMview +go +Create Login VMSRM WITH PASSWORD = 'VMware1!' +Go +create database SRM +GO +create database SRMRep +GO +ALTER AUTHORIZATION ON DATABASE::SRM TO VMSRM +ALTER AUTHORIZATION ON DATABASE::SRMRep TO VMSRM +Go +EXEC master..sp_addsrvrolemember @loginame = 'lab\VI-admin', @rolename = 'sysadmin' +Go +EXEC master..sp_addsrvrolemember @loginame = 'lab\SVC_Veeam', @rolename = 'sysadmin' +Go \ No newline at end of file diff --git a/Build/Automate/DC/MakeDBvCD15.txt b/Build/Automate/DC/MakeDBvCD15.txt new file mode 100644 index 0000000..6f3c892 --- /dev/null +++ b/Build/Automate/DC/MakeDBvCD15.txt @@ -0,0 +1,26 @@ +USE [master] +GO +CREATE DATABASE [vCloud15] ON PRIMARY +(NAME = N'vCloud15', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL10_50.SQLEXPRESS\MSSQL\DATA\vCloud15.mdf', SIZE = 100MB, FILEGROWTH = 10% ) +LOG ON +(NAME = N'vcdb_log', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL10_50.SQLEXPRESS\MSSQL\DATA\vCloud15.ldf', SIZE = 1MB, FILEGROWTH = 10%) +COLLATE Latin1_General_CS_AS +GO +USE [vCloud15] +GO +ALTER DATABASE [vCloud15] SET SINGLE_USER WITH ROLLBACK IMMEDIATE; +ALTER DATABASE [vCloud15] SET ALLOW_SNAPSHOT_ISOLATION ON; +ALTER DATABASE [vCloud15] SET READ_COMMITTED_SNAPSHOT ON WITH NO_WAIT; +ALTER DATABASE [vCloud15] SET MULTI_USER; +GO +USE [vCloud15] +GO +CREATE LOGIN [vCloud15] WITH PASSWORD = 'VMware1!', DEFAULT_DATABASE =[vCloud15], + DEFAULT_LANGUAGE =[us_english], CHECK_POLICY=OFF +GO +CREATE USER [vCloud15] for LOGIN [vCloud15] +GO +USE [vCloud15] +GO +sp_addrolemember [db_owner], [vCloud15] +GO diff --git a/Build/Automate/DC/MakeDBvCD51.txt b/Build/Automate/DC/MakeDBvCD51.txt new file mode 100644 index 0000000..677833f --- /dev/null +++ b/Build/Automate/DC/MakeDBvCD51.txt @@ -0,0 +1,26 @@ +USE [master] +GO +CREATE DATABASE [vCloud51] ON PRIMARY +(NAME = N'vCloud51', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL10_50.SQLEXPRESS\MSSQL\DATA\vCloud51.mdf', SIZE = 100MB, FILEGROWTH = 10% ) +LOG ON +(NAME = N'vcdb_log', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL10_50.SQLEXPRESS\MSSQL\DATA\vCloud51.ldf', SIZE = 1MB, FILEGROWTH = 10%) +COLLATE Latin1_General_CS_AS +GO +USE [vCloud51] +GO +ALTER DATABASE [vCloud51] SET SINGLE_USER WITH ROLLBACK IMMEDIATE; +ALTER DATABASE [vCloud51] SET ALLOW_SNAPSHOT_ISOLATION ON; +ALTER DATABASE [vCloud51] SET READ_COMMITTED_SNAPSHOT ON WITH NO_WAIT; +ALTER DATABASE [vCloud51] SET MULTI_USER; +GO +USE [vCloud51] +GO +CREATE LOGIN [vcloud51] WITH PASSWORD = 'VMware1!', DEFAULT_DATABASE =[vCloud51], + DEFAULT_LANGUAGE =[us_english], CHECK_POLICY=OFF +GO +CREATE USER [vcloud51] for LOGIN [vcloud51] +GO +USE [vCloud51] +GO +sp_addrolemember [db_owner], [vcloud51] +GO \ No newline at end of file diff --git a/Build/Automate/DC/Phase2.cmd b/Build/Automate/DC/Phase2.cmd new file mode 100644 index 0000000..1be1bde --- /dev/null +++ b/Build/Automate/DC/Phase2.cmd @@ -0,0 +1,52 @@ +@echo off +ver | find "6.1" > nul +if %ERRORLEVEL% == 0 goto ver_2K8 +ver | find "6.2" > nul +if %ERRORLEVEL% == 0 goto ver_2K12 +ver | find "6.3" > nul +if %ERRORLEVEL% == 0 goto ver_2K12 +Exit +:ver_2K12 +If Exist C:\Windows\SYSVOL\* Goto ver_2K8 +echo * Install DHCP and DNS +echo * Install DHCP and DNS >> c:\buildlog.txt +Dism /online /enable-feature /featurename:DHCPServer /quiet +Dism /online /enable-feature /featurename:DHCPServer-Tools /all /quiet +Dism /online /enable-feature /featurename:DNS-Server-Full-Role /quiet +Dism /online /enable-feature /featurename:DNS-Server-Tools /all /quiet +echo * Install AD DC Role +echo * Install AD DC Role >> c:\buildlog.txt +Dism /online /enable-feature /featurename:DirectoryServices-DomainController /all /quiet +Dism /online /enable-feature /featurename:DirectoryServices-AdministrativeCenter /all /quiet +Dism /online /enable-feature /featurename:ActiveDirectory-PowerShell /all /quiet +sc config dhcpserver start= auto +echo * Promote to DC +echo * Promote to DC >> c:\buildlog.txt +copy \\192.168.199.7\Build\Automate\DC\dcpromo.ps1 c:\ +powershell c:\dcpromo.ps1 +pause +:ver_2K8 +echo ** +echo * Connect to build share +echo * Connect to build share >> c:\buildlog.txt +net use B: \\192.168.199.7\Build +type B:\automate\version.txt >> C:\buildlog.txt +echo ** +echo * Copy PowerShell files +echo * Copy PowerShell files >> c:\buildlog.txt +copy B:\Automate\validate.ps1 C:\ +copy B:\Automate\PSFunctions.ps1 C:\ +copy B:\Automate\PXEMenuConfig.ps1 C:\ +copy B:\Automate\DC\Phase2.ps1 C:\ +regedit -s B:\Automate\_Common\ExecuPol.reg +regedit -s B:\Automate\_Common\NoSCRNSave.reg +regedit -s B:\Automate\_Common\ExplorerView.reg +regedit -s b:\Automate\_Common\Nested.reg +copy B:\automate\_Common\wasp.dll C:\windows\system32 +echo * Activate Windows >> c:\buildlog.txt +cscript //B "%windir%\system32\slmgr.vbs" /ato +echo * Starting PowerShell script for Phase 2 completion +echo * Starting PowerShell script for Phase 2 completion >> C:\buildlog.txt +powershell c:\Phase2.ps1 +if exist C:\phase2.ps1 del c:\phase2.ps1 +if exist c:\phase2.cmd del c:\phase2.cmd \ No newline at end of file diff --git a/Build/Automate/DC/Phase2.ps1 b/Build/Automate/DC/Phase2.ps1 new file mode 100644 index 0000000..6729ea2 --- /dev/null +++ b/Build/Automate/DC/Phase2.ps1 @@ -0,0 +1,631 @@ +if (Test-Path C:\PSFunctions.ps1) { + . "C:\PSFunctions.ps1" +} else { + Write-Host "PSFunctions.ps1 not found. Please copy all PowerShell files from B:\Automate to C:\ and rerun Build.ps1" + Read-Host "Press to exit" + exit +} + +# Start DC configuration process +if (Test-Path B:\Automate\automate.ini) { + $KMSIP = "0.0.0.0" + $KMSIP = ((Select-String -SimpleMatch "KMSIP=" -Path "B:\Automate\automate.ini").line).substring(6) + $AdminPWD = "VMware1!" + $AdminPWD = ((Select-String -SimpleMatch "Adminpwd=" -Path "B:\Automate\automate.ini").line).substring(9) + Write-BuildLog "Setup Users" + NET ACCOUNTS /MAXPWAGE:UNLIMITED >> C:\AD-Users.log 2>> C:\Error.log + net group "Domain Admins" vi-admin /add >> C:\AD-Users.log 2>> C:\Error.log + net user SVC_Veeam $AdminPWD /add /Domain >> C:\AD-Users.log 2>> C:\Error.log + net group "Domain Admins" SVC_Veeam /add >> C:\AD-Users.log 2>> C:\Error.log + net user SVC_SRM $AdminPWD /add /Domain >> C:\AD-Users.log 2>> C:\Error.log + net group "Domain Admins" SVC_SRM /add >> C:\AD-Users.log 2>> C:\Error.log + net user SVC_vCD $AdminPWD /add /Domain >> C:\AD-Users.log 2>> C:\Error.log + net group "Domain Admins" SVC_vCD /add >> C:\AD-Users.log 2>> C:\Error.log + net group "ESX Admins" /add >> C:\AD-Users.log 2>> C:\Error.log + net group "ESX Admins" vi-admin /add >> C:\AD-Users.log 2>> C:\Error.log + net user DomUser $AdminPWD /add /domain >> C:\AD-Users.log 2>> C:\Error.log + net user vi-admin $AdminPWD >> C:\AD-Users.log 2>> C:\Error.log + net user JoinUser VMware1! /add /domain >> C:\AD-Users.log 2>> C:\Error.log + net group "DHCP Administrators" /add >> C:\AD-Users.log 2>> C:\Error.log + net group "DHCP Users" /add >> C:\AD-Users.log 2>> C:\Error.log + dsadd OU "ou=LAB,DC=lab,DC=local" + dsadd OU "ou=Users,ou=LAB,DC=lab,DC=local" + dsadd OU "ou=Groups,ou=LAB,DC=lab,DC=local" + dsadd Group "cn=Lab Staff,ou=Groups,ou=LAB,DC=lab,DC=local" -desc "All staff of the LAB" + dsadd OU "ou=Servers,ou=LAB,DC=lab,DC=local" + dsadd OU "ou=Workstationsou=LAB,DC=lab,DC=local" + dsadd user "cn=grace,ou=Users,ou=LAB,DC=lab,DC=local" -disabled no -pwd $AdminPWD -upn grace@lab.local -fn Grace -ln Hopper -display "Grace Hopper" -email grace@lab.local -memberof "cn=Lab Staff,ou=Groups,ou=LAB,DC=lab,DC=local" + dsadd user "cn=ada,ou=Users,ou=LAB,DC=lab,DC=local" -disabled no -pwd $AdminPWD -upn ada@lab.local -fn Ada -ln Lovelace -display "Ada Lovelace" -email ada@lab.local -memberof "cn=Lab Staff,ou=Groups,ou=LAB,DC=lab,DC=local" + dsadd user "cn=alan,ou=Users,ou=LAB,DC=lab,DC=local" -disabled no -pwd $AdminPWD -upn alan@lab.local -fn Alan -ln Turing -display "Alan Turing" -email alan@lab.local -memberof "cn=Lab Staff,ou=Groups,ou=LAB,DC=lab,DC=local" + dsadd user "cn=charles,ou=Users,ou=LAB,DC=lab,DC=local" -disabled no -pwd $AdminPWD -upn charles@lab.local -fn Charles -ln Babbage -display "Charles Babbage" -email charles@lab.local -memberof "cn=Lab Staff,ou=Groups,ou=LAB,DC=lab,DC=local" + Write-BuildLog "Change default local administrator password" + net user administrator $AdminPWD + B:\automate\_Common\Autologon administrator lab $AdminPWD +} Else { + Write-BuildLog "Cannot find Automate.ini, this isn't a good sign" +} + +Write-BuildLog "Installing 7-zip." +try { + msiexec /qb /i B:\Automate\_Common\7z920-x64.msi + Write-BuildLog "Installation of 7-zip completed." +} +catch { + Write-BuildLog "7-zip installation failed." +} +Write-BuildLog "" +if (Test-Path "b:\VMware-PowerCLI.exe") { + $PowCLIver = (Get-ChildItem B:\VMware-PowerCLI.exe).VersionInfo.ProductVersion.trim() + if ($PowCLIver -eq "5.0.0.3501") {$PowCLIver = "5.0.0-3501"} + Rename-Item B:\VMware-PowerCLI.exe B:\VMware-PowerCLI-$PowCLIver.exe +} + +if (Test-Path "C:\Program Files\Tftpd64_SE\Tftpd64_SVC.exe") { + Write-BuildLog "Found TFTP, not installing." +}Else { + Write-BuildLog "Installing TFTP." + Write-BuildLog "Creating C:\TFTP-Root directory." + $null = $null = New-Item -Path C:\TFTP-Root -ItemType Directory -Force -Confirm:$false + Write-BuildLog "Creating C:\Program Files\Tftpd64_SE directory." + $null = $null = New-Item -Path "C:\Program Files\Tftpd64_SE" -ItemType Directory -Force -Confirm:$false + xcopy B:\Automate\DC\Tftpd64_SE\*.* "C:\Program Files\Tftpd64_SE\" /s /c /y /q + Start-Sleep -Seconds 30 + Start-Process "C:\Program Files\Tftpd64_SE\Tftpd64_SVC.exe" -ArgumentList "-install" -Wait + Write-BuildLog "Setting TFTP service startup type and starting it." + $null = Set-Service -Name "Tftpd32_svc" -StartupType "Automatic" + $null = Start-Service -Name "Tftpd32_svc" + Write-BuildLog "Copying B:\Automate\DC\TFTP-Root\ contents to C:\TFTP-Root." + xcopy B:\Automate\DC\TFTP-Root\*.* C:\TFTP-Root\ /s /c /y /q + Write-BuildLog "Installation of TFTP completed." + Write-BuildLog "" +} + +Write-BuildLog "Set root password for ESXi builds" +$TempContent = Get-Content B:\Automate\Hosts\esx1-4.cfg |%{$_ -replace "VMware1!",$AdminPWD} +$TempContent | Set-Content B:\Automate\Hosts\esx1-4.cfg +$TempContent = Get-Content B:\Automate\Hosts\esx1-5.cfg |%{$_ -replace "VMware1!",$AdminPWD} +$TempContent | Set-Content B:\Automate\Hosts\esx1-5.cfg +$TempContent = Get-Content B:\Automate\Hosts\esx2-4.cfg |%{$_ -replace "VMware1!",$AdminPWD} +$TempContent | Set-Content B:\Automate\Hosts\esx2-4.cfg +$TempContent = Get-Content B:\Automate\Hosts\esx2-4c.cfg |%{$_ -replace "VMware1!",$AdminPWD} +$TempContent | Set-Content B:\Automate\Hosts\esx2-4c.cfg +$TempContent = Get-Content B:\Automate\Hosts\esx2-5.cfg |%{$_ -replace "VMware1!",$AdminPWD} +$TempContent | Set-Content B:\Automate\Hosts\esx2-5.cfg +$TempContent = Get-Content B:\Automate\Hosts\esx3-5.cfg |%{$_ -replace "VMware1!",$AdminPWD} +$TempContent | Set-Content B:\Automate\Hosts\esx3-5.cfg +$TempContent = Get-Content B:\Automate\Hosts\esx4-5.cfg |%{$_ -replace "VMware1!",$AdminPWD} +$TempContent | Set-Content B:\Automate\Hosts\esx4-5.cfg +$TempContent = Get-Content B:\Automate\Hosts\esx11-5.cfg |%{$_ -replace "VMware1!",$AdminPWD} +$TempContent | Set-Content B:\Automate\Hosts\esx11-5.cfg +$TempContent = Get-Content B:\Automate\Hosts\esx12-5.cfg |%{$_ -replace "VMware1!",$AdminPWD} +$TempContent | Set-Content B:\Automate\Hosts\esx12-5.cfg + +Write-BuildLog "Checking for vSphere files..." +if (Test-Path "B:\ESXi60\*") { + if (Test-Path "B:\ESXi60\*.iso") { + Write-BuildLog "Extracting ESXi 6.0 installer from ISO." + . "C:\Program Files\7-Zip\7z.exe" x -r -y -aoa -oB:\ESXi60\ B:\ESXi60\*.iso >> C:\ExtractLog.txt + } + Write-BuildLog "ESXi 6.0 found; creating C:\TFTP-Root\ESXi60 and copying ESXi 6.0 boot files." + $null = $null = New-Item -Path C:\TFTP-Root\ESXi60 -ItemType Directory -Force -Confirm:$false + xcopy B:\ESXi60\*.* C:\TFTP-Root\ESXi60 /s /c /y /q + Get-Content C:\TFTP-Root\ESXi60\BOOT.CFG | %{$_ -replace "/","/ESXi60/"} | Set-Content C:\TFTP-Root\ESXi60\Besx1-60.cfg + Add-Content C:\TFTP-Root\ESXi60\\Besx1-60.cfg "kernelopt=ks=nfs://192.168.199.7/mnt/LABVOL/Build/Automate/Hosts/esx1-5.cfg" + Get-Content C:\TFTP-Root\ESXi60\BOOT.CFG | %{$_ -replace "/","/ESXi60/"} | Set-Content C:\TFTP-Root\ESXi60\Besx2-60.cfg + Add-Content C:\TFTP-Root\ESXi60\\Besx2-60.cfg "kernelopt=ks=nfs://192.168.199.7/mnt/LABVOL/Build/Automate/Hosts/esx2-5.cfg" + Get-Content C:\TFTP-Root\ESXi60\BOOT.CFG | %{$_ -replace "/","/ESXi60/"} | Set-Content C:\TFTP-Root\ESXi60\Besx3-60.cfg + Add-Content C:\TFTP-Root\ESXi60\Besx3-60.cfg "kernelopt=ks=nfs://192.168.199.7/mnt/LABVOL/Build/Automate/Hosts/esx3-5.cfg" + Get-Content C:\TFTP-Root\ESXi60\BOOT.CFG | %{$_ -replace "/","/ESXi60/"} | Set-Content C:\TFTP-Root\ESXi60\Besx4-60.cfg + Add-Content C:\TFTP-Root\ESXi60\\Besx4-60.cfg "kernelopt=ks=nfs://192.168.199.7/mnt/LABVOL/Build/Automate/Hosts/esx4-5.cfg" + powershell C:\PXEMenuConfig.ps1 ESXi60 + Write-BuildLog "ESXi 6.0 added to TFTP and PXE menu." + Write-BuildLog "" + $esxi60 = $true +} else { + $esxi60 = $false +} + +if (Test-Path "B:\ESXi55\*") { + if (Test-Path "B:\ESXi55\*.iso") { + Write-BuildLog "Extracting ESXi 5.5 installer from ISO." + . "C:\Program Files\7-Zip\7z.exe" x -r -y -aoa -oB:\ESXi55\ B:\ESXi55\*.iso >> C:\ExtractLog.txt + } + Write-BuildLog "ESXi 5.5 found; creating C:\TFTP-Root\ESXi55 and copying ESXi 5.5 boot files." + $null = $null = New-Item -Path C:\TFTP-Root\ESXi55 -ItemType Directory -Force -Confirm:$false + xcopy B:\ESXi55\*.* C:\TFTP-Root\ESXi55 /s /c /y /q + Get-Content C:\TFTP-Root\ESXi55\BOOT.CFG | %{$_ -replace "/","/ESXi55/"} | Set-Content C:\TFTP-Root\ESXi55\Besx1-55.cfg + Add-Content C:\TFTP-Root\ESXi55\\Besx1-55.cfg "kernelopt=ks=nfs://192.168.199.7/mnt/LABVOL/Build/Automate/Hosts/esx1-5.cfg" + Get-Content C:\TFTP-Root\ESXi55\BOOT.CFG | %{$_ -replace "/","/ESXi55/"} | Set-Content C:\TFTP-Root\ESXi55\Besx2-55.cfg + Add-Content C:\TFTP-Root\ESXi55\\Besx2-55.cfg "kernelopt=ks=nfs://192.168.199.7/mnt/LABVOL/Build/Automate/Hosts/esx2-5.cfg" + Get-Content C:\TFTP-Root\ESXi55\BOOT.CFG | %{$_ -replace "/","/ESXi55/"} | Set-Content C:\TFTP-Root\ESXi55\Besx3-55.cfg + Add-Content C:\TFTP-Root\ESXi55\Besx3-55.cfg "kernelopt=ks=nfs://192.168.199.7/mnt/LABVOL/Build/Automate/Hosts/esx3-5.cfg" + Get-Content C:\TFTP-Root\ESXi55\BOOT.CFG | %{$_ -replace "/","/ESXi55/"} | Set-Content C:\TFTP-Root\ESXi55\Besx4-55.cfg + Add-Content C:\TFTP-Root\ESXi55\\Besx4-55.cfg "kernelopt=ks=nfs://192.168.199.7/mnt/LABVOL/Build/Automate/Hosts/esx4-5.cfg" + powershell C:\PXEMenuConfig.ps1 ESXi55 + Write-BuildLog "ESXi 5.5 added to TFTP and PXE menu." + Write-BuildLog "" + $esxi55 = $true +} else { + $esxi55 = $false +} + +if (Test-Path "B:\ESXi51\*") { + if (Test-Path "B:\ESXi51\*.iso") { + Write-BuildLog "Extracting ESXi 5.1 installer from ISO." + . "C:\Program Files\7-Zip\7z.exe" x -r -y -aoa -oB:\ESXi51\ B:\ESXi51\*.iso >> C:\ExtractLog.txt + } + Write-BuildLog "ESXi 5.1 found; creating C:\TFTP-Root\ESXi51 and copying ESXi 5.1 boot files." + $null = $null = New-Item -Path C:\TFTP-Root\ESXi51 -ItemType Directory -Force -Confirm:$false + xcopy B:\ESXi51\*.* C:\TFTP-Root\ESXi51 /s /c /y /q + Get-Content C:\TFTP-Root\ESXi51\BOOT.CFG | %{$_ -replace "/","/ESXi51/"} | Set-Content C:\TFTP-Root\ESXi51\Besx1-5.cfg + Add-Content C:\TFTP-Root\ESXi51\Besx1-5.cfg "kernelopt=ks=nfs://192.168.199.7/mnt/LABVOL/Build/Automate/Hosts/esx1-5.cfg" + Get-Content C:\TFTP-Root\ESXi51\BOOT.CFG | %{$_ -replace "/","/ESXi51/"} | Set-Content C:\TFTP-Root\ESXi51\Besx2-5.cfg + Add-Content C:\TFTP-Root\ESXi51\Besx2-5.cfg "kernelopt=ks=nfs://192.168.199.7/mnt/LABVOL/Build/Automate/Hosts/esx2-5.cfg" + Get-Content C:\TFTP-Root\ESXi51\BOOT.CFG | %{$_ -replace "/","/ESXi51/"} | Set-Content C:\TFTP-Root\ESXi51\Besx3-5.cfg + Add-Content C:\TFTP-Root\ESXi51\Besx3-5.cfg "kernelopt=ks=nfs://192.168.199.7/mnt/LABVOL/Build/Automate/Hosts/esx3-5.cfg" + Get-Content C:\TFTP-Root\ESXi51\BOOT.CFG | %{$_ -replace "/","/ESXi51/"} | Set-Content C:\TFTP-Root\ESXi51\Besx4-5.cfg + Add-Content C:\TFTP-Root\ESXi51\Besx4-5.cfg "kernelopt=ks=nfs://192.168.199.7/mnt/LABVOL/Build/Automate/Hosts/esx4-5.cfg" + powershell C:\PXEMenuConfig.ps1 ESXi51 + Write-BuildLog "ESXi 5.1 added to TFTP and PXE menu." + Write-BuildLog "" + $esxi51 = $true +} else { + $esxi51 = $false +} + +if (Test-Path "B:\ESXi50\*") { + if (Test-Path "B:\ESXi50\*.iso") { + Write-BuildLog "Extracting ESXi 5.0 installer from ISO." + . "C:\Program Files\7-Zip\7z.exe" x -r -y -aoa -oB:\ESXi50\ B:\ESXi50\*.iso >> C:\ExtractLog.txt + } + Write-BuildLog "ESXi 5.0 found; creating C:\TFTP-Root\ESXi50 and copying ESXi 5.0 boot files." + $null = $null = New-Item -Path C:\TFTP-Root\ESXi50 -ItemType Directory -Force -Confirm:$false + xcopy B:\ESXi50\*.* C:\TFTP-Root\ESXi50 /s /c /y /q + Get-Content C:\TFTP-Root\ESXi50\BOOT.CFG | %{$_ -replace "/","/ESXi50/"} | Set-Content C:\TFTP-Root\ESXi50\Besx1-5.cfg + Add-Content C:\TFTP-Root\ESXi50\Besx1-5.cfg "kernelopt=ks=nfs://192.168.199.7/mnt/LABVOL/Build/Automate/Hosts/esx1-5.cfg" + Get-Content C:\TFTP-Root\ESXi50\BOOT.CFG | %{$_ -replace "/","/ESXi50/"} | Set-Content C:\TFTP-Root\ESXi50\Besx2-5.cfg + Add-Content C:\TFTP-Root\ESXi50\Besx2-5.cfg "kernelopt=ks=nfs://192.168.199.7/mnt/LABVOL/Build/Automate/Hosts/esx2-5.cfg" + Get-Content C:\TFTP-Root\ESXi50\BOOT.CFG | %{$_ -replace "/","/ESXi50/"} | Set-Content C:\TFTP-Root\ESXi50\Besx3-5.cfg + Add-Content C:\TFTP-Root\ESXi50\Besx3-5.cfg "kernelopt=ks=nfs://192.168.199.7/mnt/LABVOL/Build/Automate/Hosts/esx3-5.cfg" + Get-Content C:\TFTP-Root\ESXi50\BOOT.CFG | %{$_ -replace "/","/ESXi50/"} | Set-Content C:\TFTP-Root\ESXi50\Besx4-5.cfg + Add-Content C:\TFTP-Root\ESXi50\Besx4-5.cfg "kernelopt=ks=nfs://192.168.199.7/mnt/LABVOL/Build/Automate/Hosts/esx4-5.cfg" + powershell C:\PXEMenuConfig.ps1 ESXi50 + Write-BuildLog "ESXi 5.0 added to TFTP and PXE menu." + Write-BuildLog "" + $esxi50 = $true +} else { + $esxi50 = $false +} + +if (Test-Path "B:\ESXi41\*") { + if (Test-Path "B:\ESXi41\*.iso") { + Write-BuildLog "Extracting ESXi 4.1 installer from ISO." + . "C:\Program Files\7-Zip\7z.exe" x -r -y -aoa -oB:\ESXi41\ B:\ESXi41\*.iso >> C:\ExtractLog.txt + } + Write-BuildLog "ESXi 4.1 found; creating C:\TFTP-Root\ESXi41 and copying ESXi 4.1 boot files." + $null = $null = New-Item -Path C:\TFTP-Root\ESXi41 -ItemType Directory -Force -Confirm:$false + xcopy B:\ESXi41\vmkboot.gz C:\TFTP-Root\ESXi41 /s /c /y /q + xcopy B:\ESXi41\vmkernel.gz C:\TFTP-Root\ESXi41 /s /c /y /q + xcopy B:\ESXi41\sys.vgz C:\TFTP-Root\ESXi41 /s /c /y /q + xcopy B:\ESXi41\cim.vgz C:\TFTP-Root\ESXi41 /s /c /y /q + xcopy B:\ESXi41\ienviron.vgz C:\TFTP-Root\ESXi41 /s /c /y /q + xcopy B:\ESXi41\install.vgz C:\TFTP-Root\ESXi41 /s /c /y /q + xcopy B:\ESXi41\mboot.c32 C:\TFTP-Root\ESXi41 /s /c /y /q + powershell C:\PXEMenuConfig.ps1 ESXi41 + Write-BuildLog "ESXi 4.1 added to TFTP and PXE menu." + Write-BuildLog "" + $esxi41 = $true +} else { + $esxi41 = $false +} + +if (Test-Path "B:\ESX41\*") { + if (Test-Path "B:\ESX41\*.iso") { + Write-BuildLog "Extracting ESX 4.1 installer from ISO." + . "C:\Program Files\7-Zip\7z.exe" x -r -y -aoa -oB:\ESX41\ B:\ESX41\*.iso >> C:\ExtractLog.txt + } + Write-BuildLog "ESX 4.1 found; creating C:\TFTP-Root\ESX41 and copying ESX 4.1 boot files." + $null = $null = New-Item -Path C:\TFTP-Root\ESX41 -ItemType Directory -Force -Confirm:$false + xcopy B:\ESX41\isolinux\vmlinuz C:\TFTP-Root\ESX41 /s /c /y /q + xcopy B:\ESX41\isolinux\initrd.img C:\TFTP-Root\ESX41 /s /c /y /q + powershell C:\PXEMenuConfig.ps1 ESX41 + Write-BuildLog "ESX 4.1 added to TFTP and PXE menu." + Write-BuildLog "" + $esx41 = $true +} else { + $esx41 = $false +} + +if (!($esx41 -or $esxi41 -or $esxi50 -or $esxi51 -or $esxi55 -or $esxi60)) { + Write-BuildLog "No ESX or ESXi files found." + Write-BuildLog "Is the NAS VM running? If so, make sure the Build share is available and populated." + Write-BuildLog "Restart this machine when Build share is available; build will proceed after restart." + exit +} +Write-BuildLog "Checking for vCenter files..." +if (Test-Path "B:\VIM_60\*") { + if (Test-Path "B:\VIM_60\*.iso") { + Write-BuildLog "Extracting vCenter 6.0 installer from ISO." + . "C:\Program Files\7-Zip\7z.exe" x -r -y -aoa -oB:\VIM_60\ B:\VIM_60\*.iso >> C:\ExtractLog.txt + } + Write-BuildLog "vCenter 6.0 found." + $vCenter60 = $true +} else { + $vCenter60 = $false +} +if (Test-Path "B:\VIM_55\*") { + if (Test-Path "B:\VIM_55\*.iso") { + Write-BuildLog "Extracting vCenter 5.5 installer from ISO." + . "C:\Program Files\7-Zip\7z.exe" x -r -y -aoa -oB:\VIM_55\ B:\VIM_55\*.iso >> C:\ExtractLog.txt + } + Write-BuildLog "vCenter 5.5 found." + $vCenter55 = $true +} else { + $vCenter55 = $false +} +if (Test-Path "B:\VIM_51\*") { + if (Test-Path "B:\VIM_51\*.iso") { + Write-BuildLog "Extracting vCenter 5.1 installer from ISO." + . "C:\Program Files\7-Zip\7z.exe" x -r -y -aoa -oB:\VIM_51\ B:\VIM_51\*.iso >> C:\ExtractLog.txt + } + Write-BuildLog "vCenter 5.1 found." + $vCenter51 = $true +} else { + $vCenter51 = $false +} + +if (Test-Path "B:\VIM_50\*") { + if (Test-Path "B:\VIM_50\*.iso") { + Write-BuildLog "Extracting vCenter 5.0 installer from ISO." + . "C:\Program Files\7-Zip\7z.exe" x -r -y -aoa -oB:\VIM_50\ B:\VIM_50\*.iso >> C:\ExtractLog.txt + } + Write-BuildLog "vCenter 5.0 found." + $vCenter50 = $true +} else { + $vCenter50 = $false +} + +if (Test-Path "B:\VIM_41\*") { + if (Test-Path "B:\VIM_41\*.iso") { + Write-BuildLog "Extracting vCenter 4.1 installer from ISO." + . "C:\Program Files\7-Zip\7z.exe" x -r -y -aoa -oB:\VIM_41\ B:\VIM_41\*.iso >> C:\ExtractLog.txt + } + Write-BuildLog "vCenter 4.1 found." + $vCenter41 = $true +} else { + $vCenter41 = $false +} + +if (!($vCenter41 -or $vCenter50 -or $vCenter51 -or $vCenter55 -or $vCenter60)) { + Write-BuildLog "No vCenter installation files found on Build share." + Write-BuildLog "Is the NAS VM running? If so, make sure the Build share is available and populated." + Write-BuildLog "Restart this machine when Build share is available; build will proceed after restart." + exit +} + +if (!($vCenter60 -and $esxi60)) { + Write-BuildLog "vSphere 6.0 installation requirements not met. Please verify that both vCenter 6.0 & ESXi 6.0 exist on Build share." + $vSphere60 = $false +} else { + $vSphere60 = $true +} +if (!($vCenter55 -and $esxi55)) { + Write-BuildLog "vSphere 5.5 installation requirements not met. Please verify that both vCenter 5.5 & ESXi 5.5 exist on Build share." + $vSphere55 = $false +} else { + $vSphere55 = $true +} +if (!($vCenter51 -and $esxi51)) { + Write-BuildLog "vSphere 5.1 installation requirements not met. Please verify that both vCenter 5.1 & ESXi 5.1 exist on Build share." + $vSphere51 = $false +} else { + $vSphere51 = $true +} +if (!($vCenter50 -and $esxi50)) { + Write-BuildLog "vSphere 5.0 installation requirements not met. Please verify that both vCenter 5.0 & ESXi 5.0 exist on Build share." + $vSphere50 = $false +} else { + $vSphere50 = $true +} +if (!($vCenter41 -and ($esxi41 -or $esx41))) { + Write-BuildLog "vSphere 4.1 installation requirements not met. Please verify that both vCenter 4.1 & ESXi 4.1 exist on Build share." + $vSphere41 = $false +} else { + $vSphere41 = $true +} + +if (!($vSphere41 -or $vSphere50 -or $vSphere51 -or $vSphere55 -or $vSphere60)) { + Write-BuildLog "Matching vCenter & ESXi distributions not found. Please check the Build share." +} + +Write-BuildLog "" +Write-BuildLog "Checking for vCloud files..." +if (Test-Path "B:\vCD_51\vmware-vcloud-director-5.1*.bin") { + Write-BuildLog "vCloud Director 5.1 found." + $vcd51 = $true +} else { + $vcd51 = $false +} + +if (Test-Path "B:\vCD_51\VMware-vShield-Manager-5.1*.ova") { + Write-BuildLog "vShield Manager 5.1 for vCloud Director 5.1 found." + $vcd51vsm = $true +} else { + $vcd51vsm = $false +} + +if ($vcd51 -and $vcd51vsm) { + powershell C:\PXEMenuConfig.ps1 vCloud + powershell C:\PXEMenuConfig.ps1 vCD51 + Write-BuildLog "Added vCloud Director 5.1 to PXE menu." +} elseif ($vcd51 -or $vcd51vsm) { + Write-BuildLog "vCloud 5.1 installation requirements not met. Please verify that both vCloud 5.1 & vShield Manager 5.1 exist on the Build share." +} + +if (Test-Path "B:\vCD_15\vmware-vcloud-director-1.5*.bin") { + Write-BuildLog "vCloud Director 1.5 found." + $vcd15 = $true +} else { + $vcd15 = $false +} + +if (Test-Path "B:\vCD_15\VMware-vShield-Manager-5.0*.ova") { + Write-BuildLog "vShield Manager 5.0 for vCloud Director 1.5 found." + $vcd15vsm = $true +} else { + $vcd15vsm = $false +} + +if ($vcd15 -and $vcd15vsm) { + powershell C:\PXEMenuConfig.ps1 vCloud + powershell C:\PXEMenuConfig.ps1 vCD15 + Write-BuildLog "Added vCloud Director 1.5 to PXE menu." +} elseif ($vcd15 -or $vcd15vsm) { + Write-BuildLog "vCloud 1.5 installation requirements not met. Please verify that both vCloud 1.5 & vShield Manager 5.0 exist on the Build share." +} + +Write-BuildLog "" +Write-BuildLog "Authorise and configure DHCP" +netsh dhcp server 192.168.199.4 set dnscredentials administrator lab.local $AdminPWD +netsh dhcp add server dc.lab.local 192.168.199.4 >> C:\DNS.log +netsh dhcp server 192.168.199.4 add scope 192.168.199.0 255.255.255.0 "Lab scope" "Scope for lab.local" >> C:\DNS.log +netsh dhcp server 192.168.199.4 scope 192.168.199.0 add iprange 192.168.199.100 192.168.199.199 >> C:\DNS.log +netsh dhcp server 192.168.199.4 scope 192.168.199.0 set optionvalue 003 IPADDRESS 192.168.199.2 >> C:\DNS.log +netsh dhcp server 192.168.199.4 scope 192.168.199.0 set optionvalue 005 IPADDRESS 192.168.199.4 >> C:\DNS.log +netsh dhcp server 192.168.199.4 scope 192.168.199.0 set optionvalue 006 IPADDRESS 192.168.199.4 >> C:\DNS.log +netsh dhcp server 192.168.199.4 scope 192.168.199.0 set optionvalue 015 STRING lab.local >> C:\DNS.log +netsh dhcp server 192.168.199.4 scope 192.168.199.0 set optionvalue 066 STRING 192.168.199.4 >> C:\DNS.log +netsh dhcp server 192.168.199.4 scope 192.168.199.0 set optionvalue 067 STRING pxelinux.0 >> C:\DNS.log +netsh dhcp server 192.168.199.4 scope 192.168.199.0 set state 1 >> C:\DNS.log +Write-BuildLog "Create DNS Records" +dnscmd localhost /config /UpdateOptions 0x0 >> C:\DNS.log +dnscmd localhost /config lab.local /allowupdate 1 >> C:\DNS.log +dnscmd localhost /zoneadd 199.168.192.in-addr.arpa /DsPrimary >> C:\DNS.log +dnscmd localhost /zoneadd 201.168.192.in-addr.arpa /DsPrimary >> C:\DNS.log +dnscmd localhost /config 199.168.192.in-addr.arpa /allowupdate 1 >> C:\DNS.log +dnscmd localhost /config 201.168.192.in-addr.arpa /allowupdate 1 >> C:\DNS.log +dnscmd localhost /resetforwarders 192.168.199.2 /slave >> C:\DNS.log +dnscmd localhost /RecordAdd lab.local GW A 192.168.199.2 >> C:\DNS.log +dnscmd localhost /RecordAdd lab.local VC A 192.168.199.5 >> C:\DNS.log +dnscmd localhost /RecordAdd lab.local VMA A 192.168.199.6 >> C:\DNS.log +dnscmd localhost /RecordAdd lab.local NAS A 192.168.199.7 >> C:\DNS.log +dnscmd localhost /RecordAdd lab.local Host1 A 192.168.199.11 >> C:\DNS.log +dnscmd localhost /RecordAdd lab.local Host2 A 192.168.199.12 >> C:\DNS.log +dnscmd localhost /RecordAdd lab.local Host3 A 192.168.199.13 >> C:\DNS.log +dnscmd localhost /RecordAdd lab.local Host4 A 192.168.199.14 >> C:\DNS.log +dnscmd localhost /RecordAdd lab.local CS1 A 192.168.199.33 >> C:\DNS.log +dnscmd localhost /RecordAdd lab.local CS2 A 192.168.199.34 >> C:\DNS.log +dnscmd localhost /RecordAdd lab.local SS A 192.168.199.35 >> C:\DNS.log +dnscmd localhost /RecordAdd lab.local V1 A 192.168.199.36 >> C:\DNS.log +dnscmd localhost /RecordAdd lab.local VBR A 192.168.199.37 >> C:\DNS.log +dnscmd localhost /RecordAdd lab.local vcd A 192.168.199.38 >> C:\DNS.log +dnscmd localhost /RecordAdd lab.local vcd-proxy A 192.168.199.39 >> C:\DNS.log +dnscmd localhost /RecordAdd lab.local vshield A 192.168.199.40 >> C:\DNS.log +dnscmd localhost /RecordAdd lab.local DC2 A 192.168.201.4 >> C:\DNS.log +dnscmd localhost /RecordAdd lab.local VC2 A 192.168.201.5 >> C:\DNS.log +dnscmd localhost /RecordAdd lab.local Host11 A 192.168.201.11 >> C:\DNS.log +dnscmd localhost /RecordAdd lab.local Host12 A 192.168.201.12 >> C:\DNS.log +dnscmd localhost /RecordAdd 199.168.192.in-addr.arpa 2 PTR GW.lab.local >> C:\DNS.log +dnscmd localhost /RecordAdd 199.168.192.in-addr.arpa 5 PTR VC.lab.local >> C:\DNS.log +dnscmd localhost /RecordAdd 199.168.192.in-addr.arpa 6 PTR VMA.lab.local >> C:\DNS.log +dnscmd localhost /RecordAdd 199.168.192.in-addr.arpa 7 PTR NAS.lab.local >> C:\DNS.log +dnscmd localhost /RecordAdd 199.168.192.in-addr.arpa 11 PTR Host1.lab.local >> C:\DNS.log +dnscmd localhost /RecordAdd 199.168.192.in-addr.arpa 12 PTR Host2.lab.local >> C:\DNS.log +dnscmd localhost /RecordAdd 199.168.192.in-addr.arpa 13 PTR Host3.lab.local >> C:\DNS.log +dnscmd localhost /RecordAdd 199.168.192.in-addr.arpa 14 PTR Host4.lab.local >> C:\DNS.log +dnscmd localhost /RecordAdd 199.168.192.in-addr.arpa 33 PTR cs1.lab.local >> C:\DNS.log +dnscmd localhost /RecordAdd 199.168.192.in-addr.arpa 34 PTR cs2.lab.local >> C:\DNS.log +dnscmd localhost /RecordAdd 199.168.192.in-addr.arpa 35 PTR SS.lab.local >> C:\DNS.log +dnscmd localhost /RecordAdd 199.168.192.in-addr.arpa 36 PTR V1.lab.local >> C:\DNS.log +dnscmd localhost /RecordAdd 199.168.192.in-addr.arpa 37 PTR VBR.lab.local >> C:\DNS.log +dnscmd localhost /RecordAdd 199.168.192.in-addr.arpa 38 PTR vcd.lab.local >> C:\DNS.log +dnscmd localhost /RecordAdd 199.168.192.in-addr.arpa 39 PTR vcd-proxy.lab.local >> C:\DNS.log +dnscmd localhost /RecordAdd 199.168.192.in-addr.arpa 40 PTR vshield.lab.local >> C:\DNS.log +dnscmd localhost /RecordAdd 201.168.192.in-addr.arpa 4 PTR DC2.lab.local >> C:\DNS.log +dnscmd localhost /RecordAdd 201.168.192.in-addr.arpa 5 PTR VC2.lab.local >> C:\DNS.log +dnscmd localhost /RecordAdd 201.168.192.in-addr.arpa 11 PTR Host11.lab.local >> C:\DNS.log +dnscmd localhost /RecordAdd 201.168.192.in-addr.arpa 12 PTR Host12.lab.local >> C:\DNS.log +If (($KMSIP.Split("."))[0] -ne "0") { + Write-BuildLog "Setting DNS record for external KMS server IP address to $KMSIP according to automate.ini." + dnscmd DC /RecordAdd lab.local _vlmcs._tcp SRV 0 10 1688 $KMSIP >> C:\DNS.log +} + +Write-BuildLog "" +Write-BuildLog "Checking available SQL Express versions." +$null = New-Item -Path C:\temp -ItemType Directory -Force -Confirm:$false +if (Test-Path "C:\Program Files\Microsoft SQL Server\100\Tools\Binn\sqlcmd.exe") { + Write-BuildLog "SQL Server Install found, not installing" +}Else { + if (Test-Path "B:\VIM_60\redist\SQLEXPR\SQLEXPR_x64_ENU.exe") { + $vc6SQL = $true + Write-BuildLog "SQL Server 2012 Express SP1 for vCenter 6.0 found; installing." + copy B:\VIM_60\redist\SQLEXPR\SQLEXPR_x64_ENU.exe C:\temp + $Arguments = '/IACCEPTSQLSERVERLICENSETERMS /action=Install /FEATURES=SQL,Tools /SQLSYSADMINACCOUNTS="Lab\Domain Admins" /SQLSVCACCOUNT="Lab\vi-admin" /SQLSVCPASSWORD="' + $AdminPWD + '" /AGTSVCACCOUNT="Lab\vi-admin" /AGTSVCPASSWORD="' + $AdminPWD + '" /ADDCURRENTUSERASSQLADMIN /SECURITYMODE=SQL /SAPWD="VMware1!" /INSTANCENAME=SQLExpress /BROWSERSVCSTARTUPTYPE="Automatic" /TCPENABLED=1 /NPENABLED=1 /SQLSVCSTARTUPTYPE=Automatic /q' + Start-Process C:\temp\SQLEXPR_x64_ENU.exe -ArgumentList $Arguments -Wait + del c:\TEMP\SQLEXPR_x64_ENU.EXE + Write-BuildLog "Creating Databases." + Start-Process "C:\Program Files\Microsoft SQL Server\110\Tools\Binn\sqlcmd.exe" -ArgumentList "-S dc\SQLEXPRESS -i B:\Automate\DC\MakeDB.txt" -RedirectStandardOutput c:\sqllog.txt -Wait + Start-Process "C:\Program Files\Microsoft SQL Server\110\Tools\Binn\sqlcmd.exe" -ArgumentList "-S dc\SQLEXPRESS -i B:\Automate\DC\MakeDBvCD51.txt" -RedirectStandardOutput c:\sqllog.txt -Wait + Start-Process "C:\Program Files\Microsoft SQL Server\110\Tools\Binn\sqlcmd.exe" -ArgumentList "-S dc\SQLEXPRESS -i B:\Automate\DC\MakeDBvCD15.txt" -RedirectStandardOutput c:\sqllog.txt -Wait + regedit -s B:\Automate\DC\SQLTCP.reg + } elseif (Test-Path "B:\VIM_55\redist\SQLEXPR\SQLEXPR_x64_ENU.exe") { + $vc5SQL = $true + Write-BuildLog "SQL Server 2008 R2 Express SP1 for vCenter 5.5 found; installing." + copy B:\VIM_55\redist\SQLEXPR\SQLEXPR_x64_ENU.exe C:\temp + $Arguments = '/IACCEPTSQLSERVERLICENSETERMS /action=Install /FEATURES=SQL,Tools /SQLSYSADMINACCOUNTS="Lab\Domain Admins" /SQLSVCACCOUNT="Lab\vi-admin" /SQLSVCPASSWORD="' + $AdminPWD + '" /AGTSVCACCOUNT="Lab\vi-admin" /AGTSVCPASSWORD="' + $AdminPWD + '" /ADDCURRENTUSERASSQLADMIN /SECURITYMODE=SQL /SAPWD="VMware1!" /INSTANCENAME=SQLExpress /BROWSERSVCSTARTUPTYPE="Automatic" /TCPENABLED=1 /NPENABLED=1 /SQLSVCSTARTUPTYPE=Automatic /q' + Start-Process C:\temp\SQLEXPR_x64_ENU.exe -ArgumentList $Arguments -Wait + del c:\TEMP\SQLEXPR_x64_ENU.EXE + Write-BuildLog "Creating Databases." + Start-Process "C:\Program Files\Microsoft SQL Server\100\Tools\Binn\sqlcmd.exe" -ArgumentList "-S dc\SQLEXPRESS -i B:\Automate\DC\MakeDB.txt" -RedirectStandardOutput c:\sqllog.txt -Wait + Start-Process "C:\Program Files\Microsoft SQL Server\100\Tools\Binn\sqlcmd.exe" -ArgumentList "-S dc\SQLEXPRESS -i B:\Automate\DC\MakeDBvCD51.txt" -RedirectStandardOutput c:\sqllog.txt -Wait + Start-Process "C:\Program Files\Microsoft SQL Server\100\Tools\Binn\sqlcmd.exe" -ArgumentList "-S dc\SQLEXPRESS -i B:\Automate\DC\MakeDBvCD15.txt" -RedirectStandardOutput c:\sqllog.txt -Wait + regedit -s B:\Automate\DC\SQLTCP.reg + } elseif (Test-Path "B:\VIM_51\redist\SQLEXPR\SQLEXPR_x64_ENU.exe") { + $vc5SQL = $true + Write-BuildLog "SQL Server 2008 R2 Express SP1 for vCenter 5.1 found; installing." + copy B:\VIM_51\redist\SQLEXPR\SQLEXPR_x64_ENU.exe C:\temp + $Arguments = '/IACCEPTSQLSERVERLICENSETERMS /action=Install /FEATURES=SQL,Tools /SQLSYSADMINACCOUNTS="Lab\Domain Admins" /SQLSVCACCOUNT="Lab\vi-admin" /SQLSVCPASSWORD="' + $AdminPWD + '" /AGTSVCACCOUNT="Lab\vi-admin" /AGTSVCPASSWORD="' + $AdminPWD + '" /ADDCURRENTUSERASSQLADMIN /SECURITYMODE=SQL /SAPWD="VMware1!" /INSTANCENAME=SQLExpress /BROWSERSVCSTARTUPTYPE="Automatic" /TCPENABLED=1 /NPENABLED=1 /SQLSVCSTARTUPTYPE=Automatic /q' + Start-Process C:\temp\SQLEXPR_x64_ENU.exe -ArgumentList $Arguments -Wait + Write-BuildLog "Creating Databases." + Start-Process "C:\Program Files\Microsoft SQL Server\100\Tools\Binn\sqlcmd.exe" -ArgumentList "-S dc\SQLEXPRESS -i B:\Automate\DC\MakeDB.txt" -RedirectStandardOutput c:\sqllog.txt -Wait + Start-Process "C:\Program Files\Microsoft SQL Server\100\Tools\Binn\sqlcmd.exe" -ArgumentList "-S dc\SQLEXPRESS -i B:\Automate\DC\MakeDBvCD51.txt" -RedirectStandardOutput c:\sqllog.txt -Wait + Start-Process "C:\Program Files\Microsoft SQL Server\100\Tools\Binn\sqlcmd.exe" -ArgumentList "-S dc\SQLEXPRESS -i B:\Automate\DC\MakeDBvCD15.txt" -RedirectStandardOutput c:\sqllog.txt -Wait + regedit -s B:\Automate\DC\SQLTCP.reg + } elseif (Test-Path "B:\VIM_50\redist\SQLEXPR\SQLEXPR_x64_ENU.exe") { + $vc5SQL = $true + Write-BuildLog "SQL Server 2008 R2 Express SP1 for vCenter 5.0 found; installing." + copy B:\VIM_50\redist\SQLEXPR\SQLEXPR_x64_ENU.exe C:\temp + $Arguments = '/IACCEPTSQLSERVERLICENSETERMS /action=Install /FEATURES=SQL,Tools /SQLSYSADMINACCOUNTS="Lab\Domain Admins" /SQLSVCACCOUNT="Lab\vi-admin" /SQLSVCPASSWORD="' + $AdminPWD + '" /AGTSVCACCOUNT="Lab\vi-admin" /AGTSVCPASSWORD="' + $AdminPWD + '" /ADDCURRENTUSERASSQLADMIN /SECURITYMODE=SQL /SAPWD="VMware1!" /INSTANCENAME=SQLExpress /BROWSERSVCSTARTUPTYPE="Automatic" /TCPENABLED=1 /NPENABLED=1 /SQLSVCSTARTUPTYPE=Automatic /q' + Start-Process C:\temp\SQLEXPR_x64_ENU.exe -ArgumentList $Arguments -Wait + Write-BuildLog "Creating Databases." + Start-Process "C:\Program Files\Microsoft SQL Server\100\Tools\Binn\sqlcmd.exe" -ArgumentList "-S dc\SQLEXPRESS -i B:\Automate\DC\MakeDB.txt" -RedirectStandardOutput c:\sqllog.txt -Wait + Start-Process "C:\Program Files\Microsoft SQL Server\100\Tools\Binn\sqlcmd.exe" -ArgumentList "-S dc\SQLEXPRESS -i B:\Automate\DC\MakeDBvCD15.txt" -RedirectStandardOutput c:\sqllog.txt -Wait + regedit -s B:\Automate\DC\SQLTCP.reg + } elseif (Test-Path "B:\VIM_41\redist\SQLEXPR\x64\SQLEXPR.EXE") { + copy B:\VIM_41\redist\SQLEXPR\x64\SQLEXPR.EXE C:\temp + Write-BuildLog "SQL Server 2005 Express for vCenter 4.1 found; installing." + $Arguments = '/qb INSTANCENAME=SQLExpress ADDLOCAL=ALL SAPWD="VMware1!" SQLACCOUNT="Lab\vi-admin" SQLPASSWORD="' + $AdminPWD + '" AGTACCOUNT="Lab\vi-admin" AGTPASSWORD="' + $AdminPWD + '" SQLBROWSERACCOUNT="Lab\vi-admin" SQLBROWSERPASSWORD="' + $AdminPWD + '" DISABLENETWORKPROTOCOLS=0' + Start-Process C:\temp\SQLEXPR_x64_ENU.exe -ArgumentList $Arguments -Wait + Write-BuildLog "Creating Databases." + Start-Process "C:\Program Files (x86)\Microsoft SQL Server\90\Tools\Binn\sqlcmd.exe" -ArgumentList "-S dc\SQLEXPRESS -i B:\Automate\DC\MakeDB41.txt" -RedirectStandardOutput c:\sqllog.txt -Wait; type C:\sqllog.txt | add-content C:\buildlog.txt + regedit -s B:\Automate\DC\SQLTCP.reg + } else { + $vc6SQL = $false + $vc5SQL = $false + $vc4SQL = $false + Write-BuildLog "No SQL Express installers found. Please verify that all contents of vCenter ISO are copied into the correct folder on the Build share." + Read-Host "Press to exit" + exit + } +} +If (((([System.Environment]::OSVersion.Version.Major *10) +[System.Environment]::OSVersion.Version.Minor) -le 62)) { + if (Test-Path B:\sqlmsssetup.exe) { + Rename-Item B:\sqlmsssetup.exe SQLManagementStudio_x64_ENU.exe + } + + if (Test-Path B:\SQLManagementStudio_x64_ENU.exe) { + if ( (!(Get-ChildItem B:\SQLManagementStudio_x64_ENU.exe).VersionInfo.ProductVersion -like "10.50.2500*") -and ($vc6SQL -or $vc5SQL -or $vc4SQL)) { + 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." + 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)."} + + Write-BuildLog "Setup IIS on Windows 2008" + Start-Process pkgmgr -ArgumentList '/quiet /l:C:\IIS_Install_Log.txt /iu:IIS-WebServerRole;IIS-WebServer;IIS-CommonHttpFeatures;IIS-StaticContent;IIS-DefaultDocument;IIS-DirectoryBrowsing;IIS-HttpErrors;IIS-HttpRedirect;IIS-ApplicationDevelopment;IIS-ASPNET;IIS-NetFxExtensibility;IIS-ASP;IIS-CGI;IIS-ISAPIExtensions;IIS-ISAPIFilter;IIS-ServerSideIncludes;IIS-HealthAndDiagnostics;IIS-HttpLogging;IIS-LoggingLibraries;IIS-RequestMonitor;IIS-HttpTracing;IIS-CustomLogging;IIS-ODBCLogging;IIS-Security;IIS-BasicAuthentication;IIS-WindowsAuthentication;IIS-DigestAuthentication;IIS-ClientCertificateMappingAuthentication;IIS-IISCertificateMappingAuthentication;IIS-URLAuthorization;IIS-RequestFiltering;IIS-IPSecurity;IIS-Performance;IIS-HttpCompressionStatic;IIS-HttpCompressionDynamic;IIS-WebServerManagementTools;IIS-ManagementConsole;IIS-ManagementScriptingTools;IIS-ManagementService;IIS-IIS6ManagementCompatibility;IIS-Metabase;IIS-WMICompatibility;IIS-LegacyScripts;IIS-LegacySnapIn;IIS-FTPPublishingService;IIS-FTPServer;IIS-FTPManagement;WAS-WindowsActivationService;WAS-ProcessModel;WAS-NetFxEnvironment;WAS-ConfigurationAPI' -Wait + Write-BuildLog "Setup Certificate Authority & web enrollment." + if (Test-Path B:\Automate\DC\setupca.vbs) { + copy B:\Automate\DC\setupca.vbs C:\temp + #Cscript C:\temp\setupca.vbs /ie /iw /sn LabCA /sk 4096 /sp "RSA#Microsoft Software Key Storage Provider" /sa SHA256 >> c:\SetupCA.log + Cscript C:\temp\setupca.vbs /ie /sn LabCA /sk 4096 /sp "RSA#Microsoft Software Key Storage Provider" /sa SHA256 >> c:\SetupCA.log + } +} +If (((([System.Environment]::OSVersion.Version.Major *10) +[System.Environment]::OSVersion.Version.Minor) -ge 62)) { + Write-BuildLog "Disabling autorun of ServerManager at logon." + Start-Process schtasks -ArgumentList ' /Change /TN "\Microsoft\Windows\Server Manager\ServerManager" /DISABLE' -Wait -Verb RunAs + Write-BuildLog "Disabling screen saver" + set-ItemProperty -path 'HKCU:\Control Panel\Desktop' -name ScreenSaveActive -value 0 + Write-BuildLog "Installing Administration tools." + Install-WindowsFeature –Name RSAT-DHCP,RSAT-DNS-Server + Write-BuildLog "Setup IIS on Windows 2012" + import-module servermanager + If (Test-Path "D:\Sources\sxs\*") {$null = add-windowsfeature web-server -includeallsubfeature -source D:\Sources\sxs} + If (Test-Path "E:\Sources\sxs\*") {$null = add-windowsfeature web-server -includeallsubfeature -source E:\Sources\sxs} + Import-Module WebAdministration + New-WebBinding -Name "Default Web Site" -IP "*" -Port 443 -Protocol https + Write-BuildLog "Setup Certificate Authority & web enrollment." + Import-Module ServerManager + Add-WindowsFeature AD-Certificate, Adcs-Cert-Authority, Adcs-Enroll-Web-Pol, Adcs-Enroll-Web-Svc, Adcs-Web-Enrollment , Adcs-Device-Enrollment , Adcs-Online-Cert -IncludeManagementTools + copy B:\Automate\DC\setupca.vbs C:\temp + Cscript C:\temp\setupca.vbs /is /iw /sn LabCA /sk 4096 /sp "RSA#Microsoft Software Key Storage Provider" /sa SHA256 >> c:\SetupCA.log + import-module webadministration + $Thumb = (dir cert:\localmachine\my | where {$_.Subject -eq "CN=LabCA"} | Select Thumbprint).Thumbprint + get-item cert:\localmachine\my\$Thumb | new-item IIS:\SslBindings\0.0.0.0!443 + certutil -dsaddtemplate b:\automate\DC\VMware-SSL.txt +} +Write-BuildLog "Make Win32Time authoritative for NTP time." +reg add HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Config /v AnnounceFlags /t REG_DWORD /d 0x05 /f +w32tm /config /manualpeerlist:pool.ntp.org /syncfromflags:manual /reliable:yes /update + +Write-BuildLog "Clear System eventlog, erors to here are spurious" +Clear-EventLog -LogName System -confirm:$False + +Write-BuildLog "Setup Default web page." +xcopy B:\Automate\DC\WWWRoot\*.* C:\inetpub\wwwroot\ /s /c /y /q + +Write-BuildLog "Cleanup and creating Desktop shortcuts." +reg delete HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /v Build /f +wscript B:\Automate\DC\Shortcuts.vbs + +if (Test-Path B:\Automate\automate.ini) { + $timezone = ((Select-String -SimpleMatch "TZ=" -Path "B:\Automate\automate.ini").line).substring(3) + Write-BuildLog "Setting time zone to $timezone according to automate.ini." + tzutil /s "$timezone" +} +Write-BuildLog "Checking for VMware Tools..." +if (Test-Path -Path "B:\VMTools\setup*") { + Write-BuildLog "VMware Tools found." + $vmtools = $true +} else { + if (Test-Path "B:\VMTools\windows.iso") { + Write-BuildLog "Extracting VMware Tools from ISO." + . "C:\Program Files\7-Zip\7z.exe" x -r -y -aoa -oB:\VMtools\ B:\VMTools\windows.iso >> C:\ExtractLog.txt + $vmtools = $true + } + Else { + cd c:\temp + $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 + . "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 + . "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 + . "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 + . "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." + } + } + } + if (Test-Path -Path "B:\VMTools\setup*") { + Write-BuildLog "VMware Tools found." + $vmtools = $true +} + Write-BuildLog "" +} +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." + Start-Process B:\VMTools\setup64.exe -ArgumentList '/s /v "/qn"' -verb RunAs -Wait + Start-Sleep -Seconds 5 +} +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 new file mode 100644 index 0000000..13e112a Binary files /dev/null and b/Build/Automate/DC/SQLTCP.reg differ diff --git a/Build/Automate/DC/SetupCA.ps1 b/Build/Automate/DC/SetupCA.ps1 new file mode 100644 index 0000000..b618c9f --- /dev/null +++ b/Build/Automate/DC/SetupCA.ps1 @@ -0,0 +1,525 @@ +function Install-CertificationAuthority { +<# +.Synopsis + Installs Active Directory Certificate Services role on local computer. +.Description + Installs Active Directory Certificate Services (AD CS) role on local computer. A user can choose different options, such + Certification Authority (CA) type, key pair parameters, CA certificate validity and so on. + + The command supports Windows Server 2008 R2 Server Core installations. +.Parameter CAName + Specifies a custom CA certificate name/subject (what you see in the certificate display UI). If not passed, a '-CA' + form is used for workgroup CAs and '-' form is used for domain CAs. The parameter supports Unicode names. +.Parameter CADNSuffix + Specifies a DN suffix to specify some additional information. For example, company name, country, city, etc. DN suffix is empty for + workgroup CAs and includes current domain distinguished name (for example, DC=domain,DC=com). The parameter accepts suffixes in a + X500 form, for example: OU=Information Systems, O=Sysadmins LV, C=LV. +.Parameter CAType + Specifies CA type: + + Standalone Root, + Standalone Subordinate, + Enterprise Root, + Enterprise Subordinate. + + If not passed, for non-domain environments or if you don't have Enterprise Admins rights, Standalone Root is used. If you have + Enterprise Admins rights and your forest already has installed CAs, Enterprise Subordinate is used. If no Enterprise CAs installed + in the forest, Enterprise Root is used. +.Parameter ParentCA + This parameter allows you to specify parent CA location only if you install Enterprise Subordinate CA. For other CA types, the + parameter is ignored. Parent CA information must be passed in the following form: CAComputerName\CASanitizedName. Sanitized name + is a sanitized form of CA name (subject). Mostly sanitized name is the same as CA name (unless you use Unicode and/or special + characters, that are disallowed in X500). If the parameter is not specified, a certificate request will be generated on the root + of system drive. I've decided to not implement this parameter for Standalone Subordinate CAs, because mostly they are installed + in a workgroup environments and direct request submission to other CAs is likely unavailable (due of computer authentication + complexity in the non-domain environments). However, if you need it — contact me. +.Parameter CSP + Specifies custom cryptographic service provider. By default 'RSA#Microsoft Software Key Storage Provider' is used (in most cases + you will use default CSP). You need to explicitly specify custom CSP only when you setup completely CNG authority (CSPs with ECDSA + prefix) or you use HSM. Each HSM uses it's own custom CSP. You must install HSM middleware before CA installation. + + The full list of supportable and available "by default" CSPs for Windows Server 2008+ is: + + Microsoft Base Cryptographic Provider v1.0 + Microsoft Base DSS Cryptographic Provider + Microsoft Base Smart Card Crypto Provider + Microsoft Enhanced Cryptographic Provider v1.0 + Microsoft Strong Cryptographic Provider + RSA#Microsoft Software Key Storage Provider + DSA#Microsoft Software Key Storage Provider + ECDSA_P256#Microsoft Software Key Storage Provider + ECDSA_P384#Microsoft Software Key Storage Provider + ECDSA_P521#Microsoft Software Key Storage Provider + RSA#Microsoft Smart Card Key Storage Provider + ECDSA_P256#Microsoft Smart Card Key Storage Provider + ECDSA_P384#Microsoft Smart Card Key Storage Provider + ECDSA_P521#Microsoft Smart Card Key Storage Provider +.Parameter KeyLength + This parameter specifies the key length. If not specified, a 2048-bit key will be generated. There is a little trick: if you look to + a CSP list (above), you will see that key length is specified for each ECDSA* provider. I've developed a script logic in that way, + so the script ignores this parameter if one of ECDSA* CSP is explicitly chosen and uses key length that is supported by the CSP. + Therefore you will not receive an error if you select 'ECDSA_P256#Microsoft Smart Card Key Storage Provider' CSP with 2048 key length. + 256-bit key will be selected automatically +.Parameter HashAlgorithm + This parameter specifies hash algorithm that will be used for CA certificate/request hashing. Note that this is important for root + CA installations. Subordinate CA certificates are hashed and signed by the parent CA with it's own settings. By default 'SHA1' is + used (though this parameter is applicable for all CA installation types). +.Parameter ValidForYears + Specifies the validity for root CA installations. By default root CA certificates are valid for 5 years. You can increase this value + to 10, 20, 50, whatever you need. For any subordinate CA types this parameter is silently ignored. This is because subordinate CA + validity is determined by the parent CA. This parameter accepts integer values, assuming that the value is specified in years. +.Parameter RequestFileName + If you setup any sort of subordinate (not root) CAs you can specify custom path to a request file. By default request file is + generated on the root of system drive. +.Parameter CACertFile + Specifies the path to a PFX file with CA certificate. Relative paths are allowed. Setup API performs additional checks for the certificate. + Therefore you must ensure if: this is CA certificate (but not EFS encryption ;)), CA certificate is trusted (for non-root certificates) + and chains to trusted CA and CA certificate revocation checking can be performed. Otherwise you will unable to setup CA with that CA certificate. +.Parameter Password + Specifies the password to open PFX file. The parameter supports only securestrings! You can't type a password as a simple text. This is made for + security reasons. There are few ways to pass a password in a securestring form: + + $Password = Read-Host –a + + or + + ConvertTo-SecureString –a –f + + You can enclose last command in parentheses and pass directly as a parameter value. +.Parameter Thumbprint + specifies a thumbprint of the certificate to use. The certificate must be installed in Local Machine\Personal store and must be trusted + (for non-root certificates) and must not be revoked (the issuer revocation information must be available). +.Parameter DBDirectory + Specifies the path to a folder to store CA database. If not specified, the default path: %windir%\System32\CertLog folder is used. If you + need to specify custom path (for example, shared storage for CA clusters), you need to specify the next parameter too. The path must be valid. +.Parameter LogDirectory + Specifies the path to a folderto store CA database log files. By default %windir%\System32\CertLog folder is used. If you use custom path for + either database or log folders, you must explicitly specify both paths. +.Parameter OverwriteExisting + Specifies, whether to overwrite any existing database files in the specified directories. +.Parameter AllowCSPInteraction + Specifies, whether the cryptographic service provider (CSP) is allowed to interact with the desktop. This parameter should be used only if you + use custom hardware-based CSP (HSM or smart card CSP). In other cases you don't need to allow CSP interactions. +.Parameter Force + By default, the script explicitly prompts you whether you want to install Certification Authority with selected values. If you want to implement + silent (quiet) installations — specify this parameter to suppress any prompts during role installation +.EXAMPLE + PS > Install-CertificationAuthority -CAName "My Root CA" -CADNSuffix "OU=Information Systems, O=Sysadmins LV, C=LV" ` + -CAType "Standalone Root" -ValidForYears 10 + + + In this scenario you setup new Standalone Root CA with "CN=My Root CA, OU=Information Systems, O=Sysadmins LV, C=LV" subject, that will be valid + for 10 years. The CA will use default paths to CA database and log files and certificate will use 'RSA#Microsoft Software Key Storage Provider' + CSP with 2048-bit key and SHA1 hashing algorithm. +.EXAMPLE + PS > Install-CertificationAuthority -CAName "My Root CA" -CADNSuffix "OU=Information Systems, O=Sysadmins LV, C=LV" ` + -CAType "Standalone Root" -ValidForYears 20 -CSP "ECDSA_P256#Microsoft Smart Card Key Storage Provider" ` + -HashAlgorithm SHA512 + + This example is similar to previous, with the exception that this CA will be completely CNG/SHA2 root. CA certificate will use CNG (not RSA) + keys and hashing algorithm will be SHA512. +.EXAMPLE + PS > Install-CertificationAuthority -CAName "Clustered CA" -CADNSuffix "OU=Information Systems, O=Sysadmins LV, C=LV" ` + -CAType "Enterprise Subordinate" -KeyLength 4096 -DBDirectory "S:\CertDB" -LogDirectory "S:\CertLog" ` + -RequestFileName "S:\Clustered CA.req" + + This example assumes that you setup CA cluster first node (but not necessary). CA database will be stored on a shared storage (attached with S: drive letter). + CA certificate will use default 'RSA#Microsoft Software Key Storage Provider' with 4096-bit key and default SHA1 hashing algorithm. CA certificate validity + will be determined by the parent CA. In addition, CA certificate request will be stored on the shared storage. +.EXAMPLE + PS > $Password = Read-Host -AsSecureString + PS > Install-CertificationAuthority -CACertFile .\ClusteredCA.pfx -Password $Password ` + -DBDirectory "S:\CertDB" -LogDirectory "S:\CertLog" -OverwriteExisting + + This is two-line example. Say, you have successfully installed CA cluster first node and have exported CA certificate to a PFX, and moved it to the second + node (to the current directory). At first you will be prompted for a password. Since you type password to a securestring prompt, no characters will be displayed. + After that you will specify relative path to a PFX file and specify shared storage to store CA database and log files. You overwrite database files that was + created during first node installation. Actually this command installs CA cluster second node. +.EXAMPLE + PS > Install-CertificationAuthority -CAName "Company Enterprise CA-2" -CADNSuffix "O=Company, E=companypky@company.com" ` + -CAType "Enterprise Subordinate" -ParentCA "ca01.company.com\Company Enterprise CA-1" + + From best-practices perspective this is not a very good example, because it assumes at least 2 tiers of Enterprise CAs. However, it is still common. In a given + example, Enterprise Subordinate CA will be installed and certificate request will be sent directly to existing Enterprise CA — 'Company Enterprise CA-1' that is + hosted on 'ca01.company.com'. Note that existing CA must be online and must issue 'Subordinate Certification Authority' template. +.Inputs + None. +.Outputs + None. +.NOTES + Author: Vadims Podans + Blog : http://en-us.sysadmins.lv +#> +[CmdletBinding( + DefaultParameterSetName = 'NewKeySet', + ConfirmImpact = 'High', + SupportsShouldProcess = $true +)] + param( + [Parameter(ParameterSetName = 'NewKeySet')] + [string]$CAName, + [Parameter(ParameterSetName = 'NewKeySet')] + [string]$CADNSuffix, + [Parameter(ParameterSetName = 'NewKeySet')] + [ValidateSet("Standalone Root","Standalone Subordinate","Enterprise Root","Enterprise Subordinate")] + [string]$CAType, + [Parameter(ParameterSetName = 'NewKeySet')] + [string]$ParentCA, + [Parameter(ParameterSetName = 'NewKeySet')] + [string]$CSP, + [Parameter(ParameterSetName = 'NewKeySet')] + [int]$KeyLength, + [Parameter(ParameterSetName = 'NewKeySet')] + [string]$HashAlgorithm, + [Parameter(ParameterSetName = 'NewKeySet')] + [int]$ValidForYears = 5, + [Parameter(ParameterSetName = 'NewKeySet')] + [string]$RequestFileName, + [Parameter(Mandatory = $true, ParameterSetName = 'PFXKeySet')] + [IO.FileInfo]$CACertFile, + [Parameter(Mandatory = $true, ParameterSetName = 'PFXKeySet')] + [Security.SecureString]$Password, + [Parameter(Mandatory = $true, ParameterSetName = 'ExistingKeySet')] + [string]$Thumbprint, + [string]$DBDirectory, + [string]$LogDirectory, + [switch]$OverwriteExisting, + [switch]$AllowCSPInteraction, + [switch]$Force + ) + +#region OS and existing CA checking + # check if script running on Windows Server 2008 or Windows Server 2008 R2 + $OS = Get-WmiObject Win32_OperatingSystem -Property ProductType + if ([Environment]::OSVersion.Version.Major -lt 6) { + Write-Error -Category NotImplemented -ErrorId "NotSupportedException" ` + -Message "Windows XP, Windows Server 2003 and Windows Server 2003 R2 are not supported!" + return + } + if ($OS.ProductType -eq 1) { + Write-Error -Category NotImplemented -ErrorId "NotSupportedException" ` + -Message "Client operating systems are not supported!" + return + } + $CertConfig = New-Object -ComObject CertificateAuthority.Config + try {$ExistingDetected = $CertConfig.GetConfig(3)} + catch {} + if ($ExistingDetected) { + Write-Error -Category ResourceExists -ErrorId "ResourceExistsException" ` + -Message "Certificate Services are already installed on this computer. Only one Certification Authority instance per computer is supported." + return + } + +#endregion + +#region Binaries checking and installation if necessary + if ([Environment]::OSVersion.Version.Major -eq 6 -and [Environment]::OSVersion.Version.Minor -eq 0) { + cmd /c "servermanagercmd -install AD-Certificate 2> null" | Out-Null + } else { + try {Import-Module ServerManager -ErrorAction Stop} + catch { + ocsetup 'ServerManager-PSH-Cmdlets' /quiet | Out-Null + Start-Sleep 1 + Import-Module ServerManager -ErrorAction Stop + } + $status = (Get-WindowsFeature -Name AD-Certificate).Installed + # if still no, install binaries, otherwise do nothing + if (!$status) {$retn = Add-WindowsFeature -Name AD-Certificate -ErrorAction Stop + if (!$retn.Success) { + Write-Error -Category NotInstalled -ErrorId "NotInstalledException" ` + -Message "Unable to install ADCS installation packages due of the following error: $($retn.breakCode)" + return + } + } + } + try {$CASetup = New-Object -ComObject CertOCM.CertSrvSetup.1} + catch { + Write-Error -Category NotImplemented -ErrorId "NotImplementedException" ` + -Message "Unable to load necessary interfaces. Your Windows Server operating system is not supported!" + return + } + # initialize setup binaries + try {$CASetup.InitializeDefaults($true, $false)} + catch { + Write-Error -Category InvalidArgument -ErrorId ParameterIncorrectException ` + -ErrorAction Stop -Message "Cannot initialize setup binaries!" + } +#endregion + +#region Property enums + $CATypesByName = @{"Enterprise Root" = 0; "Enterprise Subordinate" = 1; "Standalone Root" = 3; "Standalone Subordinate" = 4} + $CATypesByVal = @{} + $CATypesByName.keys | ForEach-Object {$CATypesByVal.Add($CATypesByName[$_],$_)} + $CAPRopertyByName = @{"CAType"=0;"CAKeyInfo"=1;"Interactive"=2;"ValidityPeriodUnits"=5; + "ValidityPeriod"=6;"ExpirationDate"=7;"PreserveDataBase"=8;"DBDirectory"=9;"Logdirectory"=10; + "ParentCAMachine"=12;"ParentCAName"=13;"RequestFile"=14;"WebCAMachine"=15;"WebCAName"=16 + } + $CAPRopertyByVal = @{} + $CAPRopertyByName.keys | ForEach-Object {$CAPRopertyByVal.Add($CAPRopertyByName[$_],$_)} + $ValidityUnitsByName = @{"years" = 6} + $ValidityUnitsByVal = @{6 = "years"} +#endregion + $ofs = ", " +#region Key set processing functions + +#region NewKeySet +function NewKeySet ($CAName, $CADNSuffix, $CAType, $ParentCA, $CSP, $KeyLength, $HashAlgorithm, $ValidForYears, $RequestFileName) { + +#region CSP, key length and hashing algorithm verification + $CAKey = $CASetup.GetCASetupProperty(1) + if ($CSP -ne "") { + if ($CASetup.GetProviderNameList() -notcontains $CSP) { + # TODO add available CSP list + Write-Error -Category InvalidArgument -ErrorId "InvalidCryptographicServiceProviderException" ` + -ErrorAction Stop -Message "Specified CSP '$CSP' is not valid!" + } else { + $CAKey.ProviderName = $CSP + } + } else { + $CAKey.ProviderName = "RSA#Microsoft Software Key Storage Provider" + } + if ($KeyLength -ne 0) { + if ($CASetup.GetKeyLengthList($CSP).Length -eq 1) { + $CAKey.Length = $CASetup.GetKeyLengthList($CSP)[0] + } else { + if ($CASetup.GetKeyLengthList($CSP) -notcontains $KeyLength) { + Write-Error -Category InvalidArgument -ErrorId "InvalidKeyLengthException" ` + -ErrorAction Stop -Message @" +The specified key length '$KeyLength' is not supported by the selected CSP '$CSP' The following +key lengths are supported by this CSP: $($CASetup.GetKeyLengthList($CSP)) +"@ + } + $CAKey.Length = $KeyLength + } + } + if ($HashAlgorithm -ne "") { + if ($CASetup.GetHashAlgorithmList($CSP) -notcontains $HashAlgorithm) { + Write-Error -Category InvalidArgument -ErrorId "InvalidHashAlgorithmException" ` + -ErrorAction Stop -Message @" +The specified hash algorithm is not supported by the selected CSP '$CSP' The following +hash algorithms are supported by this CSP: $($CASetup.GetHashAlgorithmList($CSP)) +"@ + } + $CAKey.HashAlgorithm = $HashAlgorithm + } + $CASetup.SetCASetupProperty(1,$CAKey) +#endregion + +#region Setting CA type + if ($CAType) { + $SupportedTypes = $CASetup.GetSupportedCATypes() + $SelectedType = $CATypesByName[$CAType] + if ($SupportedTypes -notcontains $CATypesByName[$CAType]) { + Write-Error -Category InvalidArgument -ErrorId "InvalidCATypeException" ` + -ErrorAction Stop -Message @" +Selected CA type: '$CAType' is not supported by current Windows Server installation. +The following CA types are supported by this installation: $([int[]]$CASetup.GetSupportedCATypes() | %{$CATypesByVal[$_]}) +"@ + } else {$CASetup.SetCASetupProperty($CAPRopertyByName.CAType,$SelectedType)} + } +#endregion + +#region setting CA certificate validity + if ($SelectedType -eq 0 -or $SelectedType -eq 3 -and $ValidForYears -ne 0) { + try{$CASetup.SetCASetupProperty(6,$ValidForYears)} + catch { + Write-Error -Category InvalidArgument -ErrorId "InvalidCAValidityException" ` + -ErrorAction Stop -Message "The specified CA certificate validity period '$ValidForYears' is invalid." + } + } +#endregion + +#region setting CA name + if ($CAName -ne "") { + if ($CADNSuffix -ne "") {$Subject = "CN=$CAName" + ",$CADNSuffix"} else {$Subject = "CN=$CAName"} + $DN = New-Object -ComObject X509Enrollment.CX500DistinguishedName + # validate X500 name format + try {$DN.Encode($Subject,0x0)} + catch { + Write-Error -Category InvalidArgument -ErrorId "InvalidX500NameException" ` + -ErrorAction Stop -Message "Specified CA name or CA name suffix is not correct X.500 Distinguished Name." + } + $CASetup.SetCADistinguishedName($Subject, $true, $true, $true) + } +#endregion + +#region set parent CA/request file properties + if ($CASetup.GetCASetupProperty(0) -eq 1 -and $ParentCA) { + [void]($ParentCA -match "^(.+)\\(.+)$") + try {$CASetup.SetParentCAInformation($ParentCA)} + catch { + Write-Error -Category ObjectNotFound -ErrorId "ObjectNotFoundException" ` + -ErrorAction Stop -Message @" +The specified parent CA information '$ParentCA' is incorrect. Make sure if parent CA +information is correct (you must specify existing CA) and is supplied in a 'CAComputerName\CASanitizedName' form. +"@ + } + } elseif ($CASetup.GetCASetupProperty(0) -eq 1 -or $CASetup.GetCASetupProperty(0) -eq 4 -and $RequestFileName -ne "") { + $CASetup.SetCASetupProperty(14,$RequestFileName) + } +#endregion +} + +#endregion + +#region PFXKeySet +function PFXKeySet ($CACertFile, $Password) { + $FilePath = Resolve-Path $CACertFile -ErrorAction Stop + try {[void]$CASetup.CAImportPFX( + $FilePath.Path, + [Runtime.InteropServices.Marshal]::PtrToStringAuto([Runtime.InteropServices.Marshal]::SecureStringToBSTR($Password)), + $true) + } catch {Write-Error $_ -ErrorAction Stop} +} +#endregion + +#region ExistingKeySet +function ExistingKeySet ($Thumbprint) { + $ExKeys = $CASetup.GetExistingCACertificates() | ?{ + ([Security.Cryptography.X509Certificates.X509Certificate2]$_.ExistingCACertificate).Thumbprint -eq $Thumbprint + } + if (!$ExKeys) { + Write-Error -Category ObjectNotFound -ErrorId "ElementNotFoundException" ` + -ErrorAction Stop -Message "The system cannot find a valid CA certificate with thumbprint: $Thumbprint" + } else {$CASetup.SetCASetupProperty(1,@($ExKeys)[0])} +} +#endregion + +#endregion + +#region set database settings + if ($DBDirectory -ne "" -and $LogDirectory -ne "") { + try {$CASetup.SetDatabaseInformation($DBDirectory,$LogDirectory,$null,$OverwriteExisting)} + catch { + Write-Error -Category InvalidArgument -ErrorId "InvalidPathException" ` + -ErrorAction Stop -Message "Specified path to either database directory or log directory is invalid." + } + } elseif ($DBDirectory -ne "" -and $LogDirectory -eq "") { + Write-Error -Category InvalidArgument -ErrorId "InvalidPathException" ` + -ErrorAction Stop -Message "CA Log file directory cannot be empty." + } elseif ($DBDirectory -eq "" -and $LogDirectory -ne "") { + Write-Error -Category InvalidArgument -ErrorId "InvalidPathException" ` + -ErrorAction Stop -Message "CA database directory cannot be empty." + } + +#endregion + # process parametersets. + switch ($PSCmdlet.ParameterSetName) { + "ExistingKeySet" {ExistingKeySet $Thumbprint} + "PFXKeySet" {PFXKeySet $CACertFile $Password} + "NewKeySet" {NewKeySet $CAName $CADNSuffix $CAType $ParentCA $CSP $KeyLength $HashAlgorithm $ValidForYears $RequestFileName} + } + try { + Write-Host "Installing Certification Authority role on $env:computername ..." -ForegroundColor Cyan + if ($Force -or $PSCmdlet.ShouldProcess($env:COMPUTERNAME, "Install Certification Authority")) { + $CASetup.Install() + $PostRequiredMsg = @" +Certification Authority role was successfully installed, but not completed. To complete installation submit +request file '$($CASetup.GetCASetupProperty(14))' to parent Certification Authority +and install issued certificate by running the following command: certutil -installcert 'PathToACertFile' +"@ + if ($CASetup.GetCASetupProperty(0) -eq 1 -and $ParentCA -eq "") { + Write-Host $PostRequiredMsg -ForegroundColor Yellow -BackgroundColor Black + } elseif ($CASetup.GetCASetupProperty(0) -eq 1 -and $PSCmdlet.ParameterSetName -eq "NewKeySet" -and $ParentCA -ne "") { + $CASName = (Get-ItemProperty HKLM:\System\CurrentControlSet\Services\CertSvc\Configuration).Active + $SetupStatus = (Get-ItemProperty HKLM:\System\CurrentControlSet\Services\CertSvc\Configuration\$CASName).SetupStatus + $RequestID = (Get-ItemProperty HKLM:\System\CurrentControlSet\Services\CertSvc\Configuration\$CASName).RequestID + if ($SetupStatus -ne 1) { + Write-Host $PostRequiredMsg -ForegroundColor Yellow -BackgroundColor Black + } + } elseif ($CASetup.GetCASetupProperty(0) -eq 4) { + Write-Host $PostRequiredMsg -ForegroundColor Yellow -BackgroundColor Black + } else {Write-Host "Certification Authority role is successfully installed!" -ForegroundColor Green} + } + } catch {Write-Error $_ -ErrorAction Stop} + Remove-Module ServerManager -ErrorAction SilentlyContinue +} + +function Uninstall-CertificationAuthority { +<# +.Synopsis + Uninstalls Active Directory Certificate Services role from the local computer. +.Description + Uninstalls Active Directory Certificate Services role from the local computer. + + The command supports Windows Server 2008 R2 Server Core installations. +.Parameter AutoRestart + Automatically restarts computer to complete CA role removal. Otherwise you will have to restart the server manually. +.Parameter Force + By default, the commands prompts you whether you want to remove CA role. Use –Force switch to suppress all prompts. +.EXAMPLE + PS > Uninstall-CertificationAuthority -AutoRestart -Force + + The command will uninstall CA role, suppresses all prompts and automatically restarts the server upon completion. +.Inputs + None. +.Outputs + None. +.NOTES + Author: Vadims Podans + Blog : http://en-us.sysadmins.lv +#> +[CmdletBinding( + ConfirmImpact = 'High', + SupportsShouldProcess = $true +)] + param( + [switch]$AutoRestart, + [switch]$Force + ) + +#region OS and existing CA checking + # check if script running on Windows Server 2008 or Windows Server 2008 R2 + $OS = Get-WmiObject Win32_OperatingSystem -Property ProductType + if ([Environment]::OSVersion.Version.Major -lt 6) { + Write-Error -Category NotImplemented -ErrorId "NotSupportedException" ` + -Message "Windows XP, Windows Server 2003 and Windows Server 2003 R2 are not supported!" + return + } + if ($OS.ProductType -eq 1) { + Write-Error -Category NotImplemented -ErrorId "NotSupportedException" ` + -Message "Client operating systems are not supported!" + return + } + $CertConfig = New-Object -ComObject CertificateAuthority.Config + try {$ExistingDetected = $CertConfig.GetConfig(3)} + catch { + Write-Error -Category ObjectNotFound -ErrorId "ElementNotFoundException" ` + -ErrorAction Stop -Message "Certificate Services are not installed on this computer." + } + +#endregion + +#region Binaries checking and removal stuff + try {$CASetup = New-Object -ComObject CertOCM.CertSrvSetup.1} + catch { + Write-Error -Category NotImplemented -ErrorId "NotImplementedException" ` + -Message "Unable to load necessary interfaces. Your Windows Server operating system is not supported!" + return + } + if ([Environment]::OSVersion.Version.Major -eq 6 -and [Environment]::OSVersion.Version.Minor -eq 0) { + cmd /c "servermanagercmd -remove ADCS-Cert-Authority 2> null" | Out-Null + } else { + try {Import-Module ServerManager -ErrorAction Stop} + catch { + ocsetup 'ServerManager-PSH-Cmdlets' /quiet | Out-Null + Start-Sleep 2 + Import-Module ServerManager + } + $status = (Get-WindowsFeature -Name ADCS-Cert-Authority).Installed + if ($status) { + $WarningPreference = "SilentlyContinue" + if ($Force -or $PSCmdlet.ShouldProcess($env:COMPUTERNAME, "Uninstall Certification Authority")) { + $CASetup.PreUninstall($false) + $retn = Remove-WindowsFeature -Name ADCS-Cert-Authority -ErrorAction Stop + } + } + } + if ($AutoRestart) { + #Restart-Computer -Force + } else { + Write-Host "Certification Authority role was removed successfully. You must restart this server to complete role removal." ` + -ForegroundColor Yellow -BackgroundColor Black + } +#endregion +} diff --git a/Build/Automate/DC/Shortcuts.vbs b/Build/Automate/DC/Shortcuts.vbs new file mode 100644 index 0000000..41ab4b2 --- /dev/null +++ b/Build/Automate/DC/Shortcuts.vbs @@ -0,0 +1,14 @@ +set WshShell = WScript.CreateObject("WScript.Shell") + +set oShortCutLink = WshShell.CreateShortcut("C:\Users\Public\Desktop\BuildLog.lnk") +oShortCutLink.TargetPath = "c:\BuildLog.txt" +oShortCutLink.Save + +set oShortCutLink = WshShell.CreateShortcut("C:\Users\Public\Desktop\Validate.lnk") +oShortCutLink.TargetPath = "%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe" +oShortCutLink.Arguments = " c:\validate.ps1" +oShortCutLink.Save + +set oShortCutLink = WshShell.CreateShortcut("C:\Users\Public\Desktop\Upgrade.lnk") +oShortCutLink.TargetPath = "\\nas\Build\Automate\DC\Upgrade.cmd" +oShortCutLink.Save diff --git a/Build/Automate/DC/TFTP-Root/pxelinux.0 b/Build/Automate/DC/TFTP-Root/pxelinux.0 new file mode 100644 index 0000000..6090484 Binary files /dev/null and b/Build/Automate/DC/TFTP-Root/pxelinux.0 differ diff --git a/Build/Automate/DC/TFTP-Root/pxelinux.cfg/CHAIN.C32 b/Build/Automate/DC/TFTP-Root/pxelinux.cfg/CHAIN.C32 new file mode 100644 index 0000000..5c1a970 Binary files /dev/null and b/Build/Automate/DC/TFTP-Root/pxelinux.cfg/CHAIN.C32 differ diff --git a/Build/Automate/DC/TFTP-Root/pxelinux.cfg/ESXi41.menu b/Build/Automate/DC/TFTP-Root/pxelinux.cfg/ESXi41.menu new file mode 100644 index 0000000..5687fa7 --- /dev/null +++ b/Build/Automate/DC/TFTP-Root/pxelinux.cfg/ESXi41.menu @@ -0,0 +1,7 @@ +ENU TITLE ESX 4.1 installs + +LABEL Main Menu + MENU LABEL ^Return to Main Menu + KERNEL pxelinux.cfg/menu.c32 + APPEND pxelinux.cfg/default + diff --git a/Build/Automate/DC/TFTP-Root/pxelinux.cfg/ESXi50.menu b/Build/Automate/DC/TFTP-Root/pxelinux.cfg/ESXi50.menu new file mode 100644 index 0000000..eb0c81f --- /dev/null +++ b/Build/Automate/DC/TFTP-Root/pxelinux.cfg/ESXi50.menu @@ -0,0 +1,23 @@ +MENU TITLE ESXi 5.0 installs + +LABEL Main Menu + MENU LABEL ^Return to Main Menu + KERNEL pxelinux.cfg/menu.c32 + APPEND pxelinux.cfg/default + +label esx50 + KERNEL /esxi50/mboot.c32 + APPEND -c /esxi50/boot.cfg + MENU LABEL ESXi 5.0 Manual Install + +label esx1-5 + KERNEL /esxi50/mboot.c32 + APPEND -c /esxi50/Besx1-5.cfg + MENU LABEL Host1 Automated Install + +Label ESX2-5 + KERNEL /esxi50/mboot.c32 + APPEND -c /esxi50/Besx2-5.cfg + MENU LABEL Host2 Automated Install + + diff --git a/Build/Automate/DC/TFTP-Root/pxelinux.cfg/ESXi51.menu b/Build/Automate/DC/TFTP-Root/pxelinux.cfg/ESXi51.menu new file mode 100644 index 0000000..156576b --- /dev/null +++ b/Build/Automate/DC/TFTP-Root/pxelinux.cfg/ESXi51.menu @@ -0,0 +1,27 @@ +MENU TITLE ESXi 5.1 installs + +LABEL Main Menu + MENU LABEL ^Return to Main Menu + KERNEL pxelinux.cfg/menu.c32 + APPEND pxelinux.cfg/default + +label esx51 + KERNEL /esxi51/mboot.c32 + APPEND -c /esxi51/boot.cfg + MENU LABEL ESXi 5.1 Manual Install + +label ESX1-5 + KERNEL /esxi51/mboot.c32 + APPEND -c /esxi51/Besx1-5.cfg + MENU LABEL Host1 Automated Install + +Label ESX2-5 + KERNEL /esxi51/mboot.c32 + APPEND -c /esxi51/Besx2-5.cfg + MENU LABEL Host2 Automated Install + +Label ESX3-5 + KERNEL /esxi51/mboot.c32 + APPEND -c /esxi51/Besx3-5.cfg + MENU LABEL Host3 Automated Install + diff --git a/Build/Automate/DC/TFTP-Root/pxelinux.cfg/ESXi55.menu b/Build/Automate/DC/TFTP-Root/pxelinux.cfg/ESXi55.menu new file mode 100644 index 0000000..9305063 --- /dev/null +++ b/Build/Automate/DC/TFTP-Root/pxelinux.cfg/ESXi55.menu @@ -0,0 +1,31 @@ +MENU TITLE ESXi 5.5 installs + +LABEL Main Menu + MENU LABEL ^Return to Main Menu + KERNEL pxelinux.cfg/menu.c32 + APPEND pxelinux.cfg/default + +label esx51 + KERNEL /esxi55/mboot.c32 + APPEND -c /esxi55/boot.cfg + MENU LABEL ESXi 5.5 Manual Install + +label ESX1-5 + KERNEL /esxi55/mboot.c32 + APPEND -c /esxi55/Besx1-55.cfg + MENU LABEL Host1 Automated Install + +Label ESX2-5 + KERNEL /esxi55/mboot.c32 + APPEND -c /esxi55/Besx2-55.cfg + MENU LABEL Host2 Automated Install + +Label ESX3-5 + KERNEL /esxi55/mboot.c32 + APPEND -c /esxi55/Besx3-55.cfg + MENU LABEL Host3 Automated Install + +Label ESX4-5 + KERNEL /esxi55/mboot.c32 + APPEND -c /esxi55/Besx4-55.cfg + MENU LABEL Host4 Automated Install \ No newline at end of file diff --git a/Build/Automate/DC/TFTP-Root/pxelinux.cfg/ESXi60.menu b/Build/Automate/DC/TFTP-Root/pxelinux.cfg/ESXi60.menu new file mode 100644 index 0000000..8f3cced --- /dev/null +++ b/Build/Automate/DC/TFTP-Root/pxelinux.cfg/ESXi60.menu @@ -0,0 +1,31 @@ +MENU TITLE ESXi 6.0 installs + +LABEL Main Menu + MENU LABEL ^Return to Main Menu + KERNEL pxelinux.cfg/menu.c32 + APPEND pxelinux.cfg/default + +label esx51 + KERNEL /esxi60/mboot.c32 + APPEND -c /esxi60/boot.cfg + MENU LABEL ESXi 6.0 Manual Install + +label ESX1-5 + KERNEL /esxi60/mboot.c32 + APPEND -c /esxi60/Besx1-60.cfg + MENU LABEL Host1 Automated Install + +Label ESX2-5 + KERNEL /esxi60/mboot.c32 + APPEND -c /esxi60/Besx2-60.cfg + MENU LABEL Host2 Automated Install + +Label ESX3-5 + KERNEL /esxi60/mboot.c32 + APPEND -c /esxi60/Besx3-60.cfg + MENU LABEL Host3 Automated Install + +Label ESX4-5 + KERNEL /esxi60/mboot.c32 + APPEND -c /esxi60/Besx4-60.cfg + MENU LABEL Host4 Automated Install \ No newline at end of file diff --git a/Build/Automate/DC/TFTP-Root/pxelinux.cfg/MENU.C32 b/Build/Automate/DC/TFTP-Root/pxelinux.cfg/MENU.C32 new file mode 100644 index 0000000..1f92a1d Binary files /dev/null and b/Build/Automate/DC/TFTP-Root/pxelinux.cfg/MENU.C32 differ diff --git a/Build/Automate/DC/TFTP-Root/pxelinux.cfg/VESAMENU.C32 b/Build/Automate/DC/TFTP-Root/pxelinux.cfg/VESAMENU.C32 new file mode 100644 index 0000000..e78983d Binary files /dev/null and b/Build/Automate/DC/TFTP-Root/pxelinux.cfg/VESAMENU.C32 differ diff --git a/Build/Automate/DC/TFTP-Root/pxelinux.cfg/default b/Build/Automate/DC/TFTP-Root/pxelinux.cfg/default new file mode 100644 index 0000000..534cc6b --- /dev/null +++ b/Build/Automate/DC/TFTP-Root/pxelinux.cfg/default @@ -0,0 +1,23 @@ +menu title AutoLab PXE Menu +menu tabmsgrow 22 +menu cmdlinerow 22 +menu endrow 24 + +menu color title 1;34;49 #eea0a0ff #cc333355 std +menu color sel 7;37;40 #ff000000 #bb9999aa all +menu color border 30;44 #ffffffff #00000000 std +menu color pwdheader 31;47 #eeff1010 #20ffffff std +menu color hotkey 35;40 #90ffff00 #00000000 std +menu color hotsel 35;40 #90000000 #bb9999aa all +menu color timeout_msg 35;40 #90ffffff #00000000 none +menu color timeout 31;47 #eeff1010 #00000000 none + +prompt 0 +noescape 1 +timeout 300 +default pxelinux.cfg/menu.c32 + +label localboot + menu label Boot local hard disk + kernel pxelinux.cfg/chain.c32 + append hd0 0 diff --git a/Build/Automate/DC/TFTP-Root/pxelinux.cfg/memdisk b/Build/Automate/DC/TFTP-Root/pxelinux.cfg/memdisk new file mode 100644 index 0000000..39a3841 Binary files /dev/null and b/Build/Automate/DC/TFTP-Root/pxelinux.cfg/memdisk differ diff --git a/Build/Automate/DC/TFTP-Root/pxelinux.cfg/reboot.c32 b/Build/Automate/DC/TFTP-Root/pxelinux.cfg/reboot.c32 new file mode 100644 index 0000000..4f35770 Binary files /dev/null and b/Build/Automate/DC/TFTP-Root/pxelinux.cfg/reboot.c32 differ diff --git a/Build/Automate/DC/TFTP-Root/pxelinux.cfg/vCloud.menu b/Build/Automate/DC/TFTP-Root/pxelinux.cfg/vCloud.menu new file mode 100644 index 0000000..f78695e --- /dev/null +++ b/Build/Automate/DC/TFTP-Root/pxelinux.cfg/vCloud.menu @@ -0,0 +1,6 @@ +MENU TITLE vCloud installs + +LABEL Main Menu + MENU LABEL ^Return to Main Menu + KERNEL pxelinux.cfg/vesamenu.c32 + APPEND pxelinux.cfg/default diff --git a/Build/Automate/DC/TFTP-Root/vCloud/TRANS.TBL b/Build/Automate/DC/TFTP-Root/vCloud/TRANS.TBL new file mode 100644 index 0000000..2a22019 --- /dev/null +++ b/Build/Automate/DC/TFTP-Root/vCloud/TRANS.TBL @@ -0,0 +1,2 @@ +F INITRD.IMG;1 initrd.img +F VMLINUZ.;1 vmlinuz diff --git a/Build/Automate/DC/TFTP-Root/vCloud/initrd.img b/Build/Automate/DC/TFTP-Root/vCloud/initrd.img new file mode 100644 index 0000000..7edc9bf Binary files /dev/null and b/Build/Automate/DC/TFTP-Root/vCloud/initrd.img differ diff --git a/Build/Automate/DC/TFTP-Root/vCloud/vmlinuz b/Build/Automate/DC/TFTP-Root/vCloud/vmlinuz new file mode 100644 index 0000000..2c27d6d Binary files /dev/null and b/Build/Automate/DC/TFTP-Root/vCloud/vmlinuz differ diff --git a/Build/Automate/DC/Tftpd64_SE/EUPL-EN.pdf b/Build/Automate/DC/Tftpd64_SE/EUPL-EN.pdf new file mode 100644 index 0000000..51f9b2d Binary files /dev/null and b/Build/Automate/DC/Tftpd64_SE/EUPL-EN.pdf differ diff --git a/Build/Automate/DC/Tftpd64_SE/Tftpd64_SE-uninstall.exe b/Build/Automate/DC/Tftpd64_SE/Tftpd64_SE-uninstall.exe new file mode 100644 index 0000000..3742bdf Binary files /dev/null and b/Build/Automate/DC/Tftpd64_SE/Tftpd64_SE-uninstall.exe differ diff --git a/Build/Automate/DC/Tftpd64_SE/license-tftpd32_SE.txt b/Build/Automate/DC/Tftpd64_SE/license-tftpd32_SE.txt new file mode 100644 index 0000000..6062bd4 --- /dev/null +++ b/Build/Automate/DC/Tftpd64_SE/license-tftpd32_SE.txt @@ -0,0 +1 @@ +TFTPD32 is copyrighted 1998-2011 by Philippe Jounin (philippe@jounin.net) and released under the European Union Public License (see file EUPL-EN.pdf). diff --git a/Build/Automate/DC/Tftpd64_SE/tftpd32.chm b/Build/Automate/DC/Tftpd64_SE/tftpd32.chm new file mode 100644 index 0000000..784ead6 Binary files /dev/null and b/Build/Automate/DC/Tftpd64_SE/tftpd32.chm differ diff --git a/Build/Automate/DC/Tftpd64_SE/tftpd32.ini b/Build/Automate/DC/Tftpd64_SE/tftpd32.ini new file mode 100644 index 0000000..2bde69a --- /dev/null +++ b/Build/Automate/DC/Tftpd64_SE/tftpd32.ini @@ -0,0 +1,37 @@ +[DHCP] +Lease_NumLeases=0 +[TFTPD32] +BaseDirectory=C:\TFTP-Root +TftpPort=69 +Hide=0 +WinSize=0 +Negociate=1 +PXECompatibility=0 +DirText=0 +ShowProgressBar=1 +Timeout=3 +MaxRetransmit=6 +SecurityLevel=1 +UnixStrings=1 +Beep=0 +VirtualRoot=0 +MD5=0 +LocalIP= +Services=1 +TftpLogFile= +SaveSyslogFile= +PipeSyslogMsg=0 +LowestUDPPort=0 +HighestUDPPort=0 +MulticastPort=0 +MulticastAddress= +PersistantLeases=1 +DHCP Ping=1 +DHCP LocalIP= +Max Simultaneous Transfers=100 +UseEventLog=0 +Console Password=tftpd32 +Support for port Option=0 +Keep transfer Gui=5 +Ignore ack for last TFTP packet=0 +Enable IPv6=0 diff --git a/Build/Automate/DC/Tftpd64_SE/tftpd64_gui.exe b/Build/Automate/DC/Tftpd64_SE/tftpd64_gui.exe new file mode 100644 index 0000000..5d5c4ac Binary files /dev/null and b/Build/Automate/DC/Tftpd64_SE/tftpd64_gui.exe differ diff --git a/Build/Automate/DC/Tftpd64_SE/tftpd64_svc.exe b/Build/Automate/DC/Tftpd64_SE/tftpd64_svc.exe new file mode 100644 index 0000000..7abbbe7 Binary files /dev/null and b/Build/Automate/DC/Tftpd64_SE/tftpd64_svc.exe differ diff --git a/Build/Automate/DC/Upgrade.cmd b/Build/Automate/DC/Upgrade.cmd new file mode 100644 index 0000000..e2d539a --- /dev/null +++ b/Build/Automate/DC/Upgrade.cmd @@ -0,0 +1,23 @@ +@echo off +cls +echo * +echo * Resetting and upgrading DC configuration +echo * This is a best effort script, there will be error messages and warnings +echo * +echo * VC will require a rebuild +echo * +echo * This script must be "Run as Administrator" +echo * +pause +echo * Running AutoLab Upgrade/Reset script >> c:\buildlog.txt +if exist C:\validate.ps1 del c:\validate.ps1 +if exist C:\PSFunctions.ps1 del c:\PSFunctions.ps1 +if exist C:\PXEMenuConfig.ps1 del c:\PXEMenuConfig.ps1 +if exist C:\phase2.ps1 del c:\phase2.ps1 +net use B: \\192.168.199.7\Build +copy B:\Automate\validate.ps1 C:\ +copy B:\Automate\PSFunctions.ps1 C:\ +copy B:\Automate\PXEMenuConfig.ps1 C:\ +copy B:\Automate\DC\Phase2.ps1 C:\ +powershell c:\Phase2.ps1 +if exist C:\phase2.ps1 del c:\phase2.ps1 diff --git a/Build/Automate/DC/VMware-SSL.txt b/Build/Automate/DC/VMware-SSL.txt new file mode 100644 index 0000000..fbb039b Binary files /dev/null and b/Build/Automate/DC/VMware-SSL.txt differ diff --git a/Build/Automate/DC/WWWRoot/BusinessView.jpg b/Build/Automate/DC/WWWRoot/BusinessView.jpg new file mode 100644 index 0000000..6838c77 Binary files /dev/null and b/Build/Automate/DC/WWWRoot/BusinessView.jpg differ diff --git a/Build/Automate/DC/WWWRoot/Default.htm b/Build/Automate/DC/WWWRoot/Default.htm new file mode 100644 index 0000000..aac0b6b --- /dev/null +++ b/Build/Automate/DC/WWWRoot/Default.htm @@ -0,0 +1,54 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html><head> +<meta content="text/html; charset=ISO-8859-1" http-equiv="content-type"><title>AutoLab Portal</title></head> +<body> +<h1>AutoLab Portal</h1> +<br> +<table style="text-align: left; width: 100%;" border="1" cellpadding="2" cellspacing="2"> +<tbody> +<tr> +<td colspan="2" rowspan="1"><h2 style="text-align: center;"><span style="font-weight: bold;">AutoLab management</span></h2></td> + +</tr> +<tr> +<td> + <a href="https://vc.lab.local:9443/vsphere-client" target="_blank"><img style="border: 0px solid" alt="vSphere Web Client" title="vSphere Web Client" src="WebClient.png"><br> vSphere Web Client</a> +</td> +<td> +<a href="http://vcd.lab.local" target="_blank"><img style="border: 0px solid" alt="vCloud Director Management" title="vCloud Director Management" src="VCD.png"><br> vCloud Director Management</a> <br><a href="https://vshield.lab.local" target="_blank"> vShield Management</a> +</td> +</tr> +<tr> +<td> +<a href="http://www.freesco.org/"><img style="border: 0px solid ; width: 197px; height: 80px;" alt="FreeSCO Project" title="FreeSCO Project" src="FreeSCO.jpg"></a><a href="http://192.168.199.2:82"><br> Router Admin</a> +</td> +<td> +<a href="http://www.freenas.com"><img style="border: 0px solid ; width: 161px; height: 132px;" alt="FreeNAS" title="FreeNAS" src="FreeNAS.jpg"></a><a href="http://192.168.199.7"><br>NAS Admin</a> +</td> +</tr> +<tr> +<td><h2 style="text-align: center;"><a href="www.veeam.com" target="_blank">Veeam</a></h2> +</td> +<td><h2 style="text-align: center;">VMware View</h2> +</td> +</tr> +<tr> +<td><a href="http://v1.lab.local:1340"><img style="border: 0px solid ; width: 48px; height: 51px;" alt="Business View" title="Business View" src="BusinessView.jpg"></a> <a href="http://v1.lab.local:1340" target="_blank">Veeam +Business View</a><br> +<br> +<a href="http://v1.lab.local:1239/"><img style="border: 0px solid ; width: 47px; height: 51px;" alt="Veeam Reporter" title="Veeam Reporter" src="Reporter.jpg"></a> <a href="http://v1.lab.local:1239/" target="_blank">Veeam +ONE Reporter</a></td> +<td><a href="https://cs1.lab.local/admin"><img style="border: 0px solid ; width: 49px; height: 52px;" alt="View Administrator Portal" title="View Administrator Portal" src="VMView.jpg"></a>&nbsp;<a href="https://cs1.lab.local/admin" target="_blank">View +Administrator Console - CS1</a><br> +<br> +<a href="https://cs1.lab.local/"><img style="border: 0px solid ; width: 49px; height: 52px;" alt="VMware View Portal" title="VMware View Portal" src="VMView.jpg"></a> <a href="https://cs1.lab.local/" target="_blank">View +Portal - CS1</a><br> +</td> +</tr> +<tr> +<td><a href="http://192.168.199.254/WANem/"> WANem managemnet </a> +</td><td></td> +</tr> +</table> +<br> +</body></html> \ No newline at end of file diff --git a/Build/Automate/DC/WWWRoot/FreeNAS.jpg b/Build/Automate/DC/WWWRoot/FreeNAS.jpg new file mode 100644 index 0000000..7608b4c Binary files /dev/null and b/Build/Automate/DC/WWWRoot/FreeNAS.jpg differ diff --git a/Build/Automate/DC/WWWRoot/FreeSCO.jpg b/Build/Automate/DC/WWWRoot/FreeSCO.jpg new file mode 100644 index 0000000..017ad97 Binary files /dev/null and b/Build/Automate/DC/WWWRoot/FreeSCO.jpg differ diff --git a/Build/Automate/DC/WWWRoot/Reporter.jpg b/Build/Automate/DC/WWWRoot/Reporter.jpg new file mode 100644 index 0000000..eabea9a Binary files /dev/null and b/Build/Automate/DC/WWWRoot/Reporter.jpg differ diff --git a/Build/Automate/DC/WWWRoot/VMView.jpg b/Build/Automate/DC/WWWRoot/VMView.jpg new file mode 100644 index 0000000..284faf1 Binary files /dev/null and b/Build/Automate/DC/WWWRoot/VMView.jpg differ diff --git a/Build/Automate/DC/WWWRoot/WebClient.png b/Build/Automate/DC/WWWRoot/WebClient.png new file mode 100644 index 0000000..9eb45ee Binary files /dev/null and b/Build/Automate/DC/WWWRoot/WebClient.png differ diff --git a/Build/Automate/DC/WWWRoot/vcd.png b/Build/Automate/DC/WWWRoot/vcd.png new file mode 100644 index 0000000..bda7273 Binary files /dev/null and b/Build/Automate/DC/WWWRoot/vcd.png differ diff --git a/Build/Automate/DC/ocsetup.exe b/Build/Automate/DC/ocsetup.exe new file mode 100644 index 0000000..65ee9b2 Binary files /dev/null and b/Build/Automate/DC/ocsetup.exe differ diff --git a/Build/Automate/DC/setupca.vbs b/Build/Automate/DC/setupca.vbs new file mode 100644 index 0000000..ef890e0 --- /dev/null +++ b/Build/Automate/DC/setupca.vbs @@ -0,0 +1,1291 @@ +'Copyright (c) Microsoft Corporation. All rights reserved. + +'Disclaimer +' +'This sample script is not supported under any Microsoft standard support +'program or service. This sample script is provided AS IS without warranty of +'any kind. Microsoft further disclaims all implied warranties including, +'without limitation, any implied warranties of merchantability or of fitness +'for a particular purpose. The entire risk arising out of the use or +'performance of the sample scripts and documentation remains with you. In no +'event shall Microsoft, its authors, or anyone else involved in the creation, +'production, or delivery of the scripts be liable for any damages whatsoever +'(including, without limitation, damages for loss of business profits, business +'interruption, loss of business information, or other pecuniary loss) arising +'out of the use of or inability to use this sample script or documentation, +'even if Microsoft has been advised of the possibility of such damages. + + + +' Catch errors at compile time, sort of. +Option Explicit + +'***************************************************************** +'Displays script-understood command line params +' +Sub Usage() + Call OutputLine(ECHOMINIMAL, "SetupCA.vbs - Certificate Services Setup Automation for Microsoft Windows Server 2008/2008 R2") + Call OutputLine(ECHOMINIMAL, "") + Call OutputLine(ECHOMINIMAL, "Parameters:") + Call OutputLine(ECHOMINIMAL, "/SP <Prov> - Specify Provider") + Call OutputLine(ECHOMINIMAL, "/SK <Len> - Specify Key length") + Call OutputLine(ECHOMINIMAL, "/SA <Alg> - Specify Hash algorithm") + Call OutputLine(ECHOMINIMAL, "/SN <Name> - Specify CA Name") + Call OutputLine(ECHOMINIMAL, "/DN <Name> - Specify DN Suffix for CA cert subject") + Call OutputLine(ECHOMINIMAL, "/SR <CA> - Specify Root CA (Required for subordinate CA" & Chr(39) & "s and Web service)") + Call OutputLine(ECHOMINIMAL, "") + Call OutputLine(ECHOMINIMAL, "/OR <File> - Save CA cert request to a file (Required for offline root CA" & Chr(39) & "s)") + Call OutputLine(ECHOMINIMAL, "") + Call OutputLine(ECHOMINIMAL, "/RK <Name> - Reuse Key") + Call OutputLine(ECHOMINIMAL, "/RC <Name> - Reuse Cert and Key") + Call OutputLine(ECHOMINIMAL, "") + Call OutputLine(ECHOMINIMAL, "/interactive - Specifiy whether CA will be set to interact with desktop") + Call OutputLine(ECHOMINIMAL, "") + Call OutputLine(ECHOMINIMAL, "/IE - Install Enterprise Root CA Service") + Call OutputLine(ECHOMINIMAL, "/IS - Install Standalone Root CA Service") + Call OutputLine(ECHOMINIMAL, "/IF - Install Enterprise Subordinate CA Service") + Call OutputLine(ECHOMINIMAL, "/IT - Install Standalone Subordinate CA Service") + Call OutputLine(ECHOMINIMAL, "/IW - Install web CA Service - works with any of the above or by itself") + Call OutputLine(ECHOMINIMAL, " This option is not relevant for server core machines") + Call OutputLine(ECHOMINIMAL, "") + Call OutputLine(ECHOMINIMAL, "/UC - Uninstall CA Service") + Call OutputLine(ECHOMINIMAL, "") + Call OutputLine(ECHOMINIMAL, "/? - Display this usage") + Call OutputLine(ECHOMINIMAL, "") +End Sub ' Usage + +'***************************************************************** +'Define external constant values +' +' CA Role +Const ENTERPRISE_ROOTCA = 0 +Const ENTERPRISE_SUBCA = 1 +Const STANDALONE_ROOTCA = 3 +Const STANDALONE_SUBCA = 4 +Const NO_INSTALL_CA = -1 +Const UNINSTALL_CA = 8 +Const UNINSTALL_WEB_PAGES = 9 + +'FileSystemObject defines +Const FILE_FLAG_READ = 1 +Const FILE_FLAG_WRITE = 2 +Const FILE_FLAG_APPEND = 8 + +'Logging level +Const ECHOMINIMAL = 1 + +'Error codes to handle: +Const RPC_UNAVAILABLE = - 2147023174 '0x800706BA +Const DOMAIN_UNAVAILABLE = - 2147023541 '0x8007054B +Const REG_VALUE_NOT_FOUND = - 2147024894 '0x80070002 +Const IMAGE_TAMPERED = - 2147024319 '0x80070241 +Const VALUE_OUT_OF_RANGE = - 2147016574 '0x80072082 +Const ROOT_CA_NOT_FOUND = 462 + +'Properties that can be set: +Const SETUPPROP_INVALID = - 1 +Const SETUPPROP_CATYPE = 0 +Const SETUPPROP_CAKEYINFORMATION = 1 +Const SETUPPROP_INTERACTIVE = 2 +Const SETUPPROP_CANAME = 3 +Const SETUPPROP_CADSSUFFIX = 4 +Const SETUPPROP_VALIDITYPERIOD = 5 +Const SETUPPROP_VALIDITYPERIODUNIT = 6 +Const SETUPPROP_EXPIRATIONDATE = 7 +Const SETUPPROP_PRESERVEDATABASE = 8 +Const SETUPPROP_DATABASEDIRECTORY = 9 +Const SETUPPROP_LOGDIRECTORY = 10 +Const SETUPPROP_SHAREDFOLDER = 11 +Const SETUPPROP_PARENTCAMACHINE = 12 +Const SETUPPROP_PARENTCANAME = 13 +Const SETUPPROP_REQUESTFILE = 14 +Const SETUPPROP_WEBCAMACHINE = 15 +Const SETUPPROP_WEBCANAME = 16 + +'***************************************************************** +'Define constants and defaults +' +Const CONST_ERROR = 0 +Const CONST_WSCRIPT = 1 +Const CONST_CSCRIPT = 2 +Const CONST_SHOW_USAGE = 3 +Const CONST_PROCEED = 4 + +Const DEFCANAME = "" +Const DEFDNSUFFIX = "" +Const DEFROOTCANAME = "" +Const DEF_SEL_KEY_SIZE = "2048" +Const DEF_SEL_HASH_ALG = "SHA1" +Const DEF_INSTALL_WEB_OPTION = False +Const DEF_INSTALL_SVC_OPTION = False +Const DEF_LOG_FILENAME = "_SetupCA.log" +Const DEF_INTERACTIVE = False + +'example Capi1 Provider: "Microsoft Strong Cryptographic Provider" +'example RSA CNG provider: "RSA#MicrosoftKSP" +'example ECC 256 provider: "ECDSA_P256#Microsoft Software Key Storage Provider" +'example ECC 384 provider: "ECDSA_P384#Microsoft Software Key Storage Provider" +'example ECC 521 provider: "ECDSA_P521#Microsoft Software Key Storage Provider" +Const DEF_SEL_PROVIDER = "RSA#Microsoft Software Key Storage Provider" + +'Cert Server Role +Dim eCARole +eCARole = NO_INSTALL_CA + +'Root CA's name (if this is a subordinate) +Dim strRootCAName +strRootCAName = DEFROOTCANAME + +'This CA's name +Dim strCAName +Dim strDNSuffix +strCAName = DEFCANAME +strDNSuffix = DEFDNSUFFIX + +'Crypto provider to be used to sign certs this CA Issues +Dim strSelectedCSP +strSelectedCSP = "" ' DEF_SEL_PROVIDER + +'Hash algorithm to be used to sign certs this CA Issues +Dim strSelectedHashAlg +strSelectedHashAlg = "" ' DEF_SEL_HASH_ALG + +'Signing key length +Dim iSelectedKeySize +iSelectedKeySize = "" ' DEF_SEL_KEY_SIZE + +'Save request to file, for submitting to offline root +Dim strRequestFile +strRequestFile = "" + +'Key/Cert Re-use flags +Dim bReuseKey +Dim bReuseCert +Dim bReuseDB +bReuseKey = False +bReuseCert = False +bReuseDB = False + +'Interactive Flag +Dim bInteractive +bInteractive = DEF_INTERACTIVE + +'Default to install or uninstall +Dim bInstall +bInstall = True + +'Install the Web interface +Dim bWebPages +bWebPages = DEF_INSTALL_WEB_OPTION + +' Install the Cert Server service. +Dim bInstallService +bInstallService = DEF_INSTALL_SVC_OPTION + +'Log file +Dim OutputFile +Dim OutputFile2 + +'Needs to differentiate which package needs to be installed +Dim PKGCA +Dim PKGIIS +Dim PKGWEB +PKGCA = True +PKGIIS = True +PKGWEB = True + +'Set if installing on core build +Dim bIsCore +bIsCore = False + +'For the 'retry once' implementation +Dim bRecursed +bRecursed = False + + +'Begin script logic + +'Ensure the output won't become hundreds of popup windows +Call VerifyStandardStreams() + +'Set up Local logging +Set OutputFile = CreateLogFile(DEF_LOG_FILENAME) + +Dim g_oCASetup + +'Start the script +Call Main() + +'******************************************************************** +'* +'* Sub InstallPackages() +'* +'* Purpose: Install all required packagemanager packages +'* +'********************************************************************' +Sub InstallPackages(Install) + + 'Get shell object to determine system drive value + Dim WshShell + Set WshShell = WScript.CreateObject("WScript.Shell") + + If (Install = True) Then + + If (PKGCA = True) Then + Call OutputLine(ECHOMINIMAL, "Installing CA Packages, this will take several minutes...") + Call WshShell.Run ("cmd /c servermanagercmd -install ADCS-Cert-Authority -resultPath installResult.xml", 0 , True) + End If + + If (PKGWEB = True) Then + Call OutputLine(ECHOMINIMAL, "Installing Web Page Packages, this will take several minutes...") + Call WshShell.Run ("cmd /c servermanagercmd -install ADCS-Web-Enrollment -resultPath installResult.xml", 0 , True) + End If + + Else + + If (PKGWEB = True) Then + Call OutputLine(ECHOMINIMAL, "Removing Web Page Packages, this will take several minutes...") + Call WshShell.Run ("cmd /c servermanagercmd -remove ADCS-Web-Enrollment -resultPath installResult.xml", 0 , True) + End If + + If (PKGCA = True) Then + Call OutputLine(ECHOMINIMAL, "Removing CA Packages, this will take several minutes...") + Call WshShell.Run ("cmd /c servermanagercmd -remove ADCS-Cert-Authority -resultPath installResult.xml", 0 , True) + End If + + End If + + Call OutputLine(ECHOMINIMAL, "Installing Packages, this will take several minutes...") + + Set WShShell = Nothing +End Sub 'InstallPackage + +'******************************************************************** +'* +'* Sub Main() +'* +'* Purpose: Executes the main script logic +'* Input: +'* +'* Output: +'* +'******************************************************************** +Sub Main () + Dim intOpMode + + 'Parse the command line + intOpMode = intParseCmdLine() + + Select Case intOpMode + + Case CONST_SHOW_USAGE + Call Usage() + Exit Sub + + Case CONST_PROCEED + 'Do Nothing + + Case CONST_ERROR + Call OutputLine(ECHOMINIMAL,"Error occurred in passing parameters.") + Exit Sub + + Case Else 'Default -- should never happen + Call OutputLine(ECHOMINIMAL,"Error occurred in passing parameters.") + Exit Sub + + End Select + + 'Check if certocm.dll is present, if not we are most likely running on core and need + 'to use ocsetup to install CA package to get certocm.dll + Dim FSO + Set FSO = CreateObject("Scripting.FileSystemObject") + + Dim WshShell + Dim envVars + Dim strWinDir + Set WshShell = WScript.CreateObject("WScript.Shell") + Set envVars = WshShell.Environment("process") + + strWinDir = envVars("windir") + + wscript.echo "Checking if certocm.dll is present..." + + If Not FSO.FileExists(strWinDir + "\system32\certocm.dll") Then + bisCore = True + wscript.echo "Certocm.dll is not present installing CA package..." + Call WshShell.Run ("cmd /c start /w ocsetup CertificateServices /norestart /quiet", 0 , True) + wscript.echo "CA package installed..." + Else + wscript.echo "Certocm.dll is present not installing CA package" + End If + + Set WshShell = Nothing + Set envVars = Nothing + + Set g_oCASetup = CreateObject("certocm.CertSrvSetup") + + 'Install Packages + Call OutputLine(ECHOMINIMAL,"Proceeding to update packages ...") + Call InstallPackages(bInstall) + wscript.echo "bInstallService: " & bInstallService + wscript.echo "eCARole: " & eCARole + wscript.echo "bWebPages: " & bWebPages + If ((eCARole <> NO_INSTALL_CA) And (eCARole <> UNINSTALL_CA) And (eCARole <> UNINSTALL_WEB_PAGES)) or (bWebPages <> False) Then + Call OutputLine(ECHOMINIMAL, "Main: Info collection complete. Starting install phase..." ) + ' got the info we needed, now install.. + Call OutputFile.WriteLine("Main: Installing...") + + If (True = InstallAndVerifyCA(eCARole, bInstallService, bWebPages)) Then + Call OutputFile.WriteLine("Main: Install complete! Passed") + Else + Call OutputFile.WriteLine("Main: Install complete! Failed") + Call WScript.Quit (1) + End If 'Installed without errors + Else + If (eCARole = UNINSTALL_CA or eCARole = UNINSTALL_WEB_PAGES) Then + If (eCARole = UNINSTALL_WEB_PAGES) Then + Call OutputLine(ECHOMINIMAL, "Main: Uninstalling Web pages only...") + 'Uninstall web pages only + Call UninstallCA(True) + Call OutputLine(ECHOMINIMAL, "Main: web pages Uninstalled!") + Else + Call OutputLine(ECHOMINIMAL, "Main: Uninstalling CA...") + 'Uninstall web pages only + Call UninstallCA(False) + Call OutputLine(ECHOMINIMAL, "Main: Uninstalled!") + End If + End If + End If + + ' Clean Up + Call OutputFile.Close() + +End Sub 'Main + + + +'******************************************************************** +'* +'* Sub VerifyStandardStreams() +'* +'* Purpose: verify CScript.exe was used to launch this script. +'* +'******************************************************************** +Sub VerifyStandardStreams() + On Error Resume Next + + 'Attempt to write to the error stream + Call WScript.StdOut.WriteLine() + + 'If couldn't display the error because cscript wasn't used, + + If (Err.Number <> 0) Then + + 'Report problem + Call WScript.Echo("Please run this script from cscript.") + + 'Exit the script + Call WScript.Quit (1) + End If + + On Error Goto 0 +End Sub 'VerifyStandardStreams + +'******************************************************************** +'* +'* Sub OutputLine() +'* +'* Purpose: Control the debug output at one location +'* +'* Input: Level compare to verbosity - if lower, don't display +'* string String to output. +'* +'******************************************************************** +Sub OutputLine(ByVal level, ByVal String) + + Call OutputFile.WriteLine(String) + WScript.StdOut.WriteLine String + +End Sub ' OutputLine + +'******************************************************************** +'* +'* Sub PrintErrorInfo() +'* +'* Purpose: Control the debug output at one location +'* +'* Input: Message Message to log +'* Err Error obejct to get info from +'* +'******************************************************************** +Sub PrintErrorInfo(ByVal Message, ByVal oErr) + Call OutputLine(ECHOMINIMAL, Message) + Call OutputLine(ECHOMINIMAL, "Error Info: " & oErr.Number & ": " & oErr.Description) + Call OutputLine(ECHOMINIMAL, "Error Source: " & oErr.Source) +End Sub ' OutputLine + +'******************************************************************** +'* +'* Function intParseCmdLine() +'* +'* Purpose: Parses the command line. +'* +'* Input: none +'* +'* Output: none +'* +'******************************************************************** +Function intParseCmdLine() + On Error Resume Next + + Dim strFlag + Dim intState + Dim ArgTemp + Dim intArgIter + Dim objFileSystem + + If Wscript.Arguments.Count > 0 Then + Call OutputFile.WriteLine("parsing arguments: ") + + For Each ArgTemp in WScript.Arguments + + If (InStr(ArgTemp," ") > 0) Then + Call OutputFile.Write(Chr(34) & ArgTemp & Chr(34) & " ") + Else + Call OutputFile.Write(ArgTemp & " ") + End If + + Next ' ArgTemp + + Call OutputFile.WriteLine + strFlag = Wscript.arguments.Item(0) + End If + + 'No arguments have been received + + If IsEmpty(strFlag) Then + intParseCmdLine = CONST_SHOW_USAGE + Exit Function ' intParseCmdLine + End If + + 'Check if the user is asking for help or is just confused + + If (strFlag = "help") Or (strFlag = "/h") Or (strFlag = "\h") Or (strFlag = "-h") _ + Or (strFlag = "\?") Or (strFlag = "/?") Or (strFlag = "?") _ + Or (strFlag = "h") Then + intParseCmdLine = CONST_SHOW_USAGE + Exit Function ' intParseCmdLine + End If + + 'Retrieve the command line and set appropriate variables + intArgIter = 0 + + Do While intArgIter <= Wscript.arguments.Count - 1 + + Select Case Left(LCase(Wscript.arguments.Item(intArgIter)),4) + Case "/int" + bInteractive = True + intArgIter = intArgIter + 1 + + Case "/sp" + + If Not blnGetArg("Crypto Provider", strSelectedCSP, intArgIter) Then + intParseCmdLine = CONST_ERROR + Exit Function ' intParseCmdLine + End If + + intArgIter = intArgIter + 1 + + Case "/sk" + + If Not blnGetArg("Key length", iSelectedKeySize, intArgIter) Then + intParseCmdLine = CONST_ERROR + Exit Function ' intParseCmdLine + End If + + intArgIter = intArgIter + 1 + + Case "/sa" + + If Not blnGetArg("Hash algorithm",strSelectedHashAlg, intArgIter) Then + intParseCmdLine = CONST_ERROR + Exit Function ' intParseCmdLine + End If + + intArgIter = intArgIter + 1 + + Case "/sn" + + If Not blnGetArg("CA Name", strCAName, intArgIter) Then + intParseCmdLine = CONST_ERROR + Exit Function ' intParseCmdLine + End If + + intArgIter = intArgIter + 1 + + Case "/dn" + + If Not blnGetArg("DN Suffix", strDNSuffix, intArgIter) Then + intParseCmdLine = CONST_ERROR + Exit Function ' intParseCmdLine + End If + + intArgIter = intArgIter + 1 + + + Case "/sr" + + If Not blnGetArg("Root CA", strRootCAName, intArgIter) Then + intParseCmdLine = CONST_ERROR + Exit Function ' intParseCmdLine + End If + + intArgIter = intArgIter + 1 + + Case "/or" + + If Not blnGetArg("Request File", strRequestFile, intArgIter) Then + intParseCmdLine = CONST_ERROR + Exit Function ' intParseCmdLine + End If + + intArgIter = intArgIter + 1 + + Case "/iw" + + If bIsCore = False Then + bWebPages = True + End If + + intArgIter = intArgIter + 1 + + Case "/ie" + + If (eCARole <> NO_INSTALL_CA) Then + intParseCmdLine = CONST_ERROR + Exit Function ' intParseCmdLine + End If + + intParseCmdLine = CONST_PROCEED + bInstallService = True + eCARole = ENTERPRISE_ROOTCA + intArgIter = intArgIter + 1 + + Case "/is" + + If (eCARole <> NO_INSTALL_CA) Then + intParseCmdLine = CONST_ERROR + Exit Function ' intParseCmdLine + End If + + intParseCmdLine = CONST_PROCEED + bInstallService = True + eCARole = STANDALONE_ROOTCA + intArgIter = intArgIter + 1 + + Case "/if" + + If (eCARole <> NO_INSTALL_CA) Then + intParseCmdLine = CONST_ERROR + Exit Function ' intParseCmdLine + End If + + intParseCmdLine = CONST_PROCEED + bInstallService = True + eCARole = ENTERPRISE_SUBCA + intArgIter = intArgIter + 1 + + Case "/it" + + If (eCARole <> NO_INSTALL_CA) Then + intParseCmdLine = CONST_ERROR + Exit Function ' intParseCmdLine + End If + + intParseCmdLine = CONST_PROCEED + bInstallService = True + eCARole = STANDALONE_SUBCA + intArgIter = intArgIter + 1 + + Case "/uc" + + If (eCARole <> NO_INSTALL_CA) And (eCARole <> UNINSTALL_CA) Then + intParseCmdLine = CONST_ERROR + Exit Function ' intParseCmdLine + End If + + bInstallService = False + bWebPages = False + bInstall = False + eCARole = UNINSTALL_CA + intParseCmdLine = CONST_PROCEED + intArgIter = intArgIter + 1 + + Case "/uw" + + If (eCARole <> NO_INSTALL_CA) And (eCARole <> UNINSTALL_CA) Then + intParseCmdLine = CONST_ERROR + Exit Function ' intParseCmdLine + End If + + bWebPages = False + bInstall = False + eCARole = UNINSTALL_WEB_PAGES + intParseCmdLine = CONST_PROCEED + intArgIter = intArgIter + 1 + + Case "/rk" + bReuseKey = True + intArgIter = intArgIter + 1 + + Case "/rc" + bReuseCert = True + intArgIter = intArgIter + 1 + + Case "/rcd" + bReuseCert = True + bReuseDB = True + intArgIter = intArgIter + 1 + + 'Depricated switches kept to prevent automation from failing + Case "/sl" + intArgIter = intArgIter + 2 + Case "/sc" + intArgIter = intArgIter + 2 + Case "/si" + intArgIter = intArgIter + 2 + + Case Else 'We shouldn't get here + Call OutputLine(ECHOMINIMAL, "Invalid or misplaced parameter: " & Wscript.arguments.Item(intArgIter)) + Call OutputLine(ECHOMINIMAL, "Please check the input and try again") + Call OutputLine(ECHOMINIMAL, "or invoke with " & Chr(39) & "/?" & Chr(39) & " for help with the syntax.") + Wscript.Quit + + End Select + + Loop '** intArgIter <= Wscript.arguments.Count - 1 + + intParseCmdLine = CONST_PROCEED + +End Function + +'******************************************************************** +'* +'* Function blnGetArg() +'* +'* Purpose: Helper to intParseCmdLine() +'* +'* Usage: +'* +'* Case "/s" +'* blnGetArg ("server name", strServer, intArgIter) +'* +'******************************************************************** + +Private Function blnGetArg (ByVal StrVarName, _ + ByRef strVar, _ + ByRef intArgIter) + + blnGetArg = False 'failure, changed to True upon successful completion + Err.Clear + + If Len(Wscript.Arguments(intArgIter)) > 3 Then + + If Mid(Wscript.Arguments(intArgIter),4,1) = ":" Then + + If Len(Wscript.Arguments(intArgIter)) > 4 Then + strVar = Right(Wscript.Arguments(intArgIter), _ + Len(Wscript.Arguments(intArgIter)) - 4) + blnGetArg = True + Exit Function + Else + intArgIter = intArgIter + 1 + + If intArgIter > (Wscript.Arguments.Count - 1) Then + Call OutputLine(ECHOMINIMAL, "Parameter Missing: " & StrVarName & ".") + Call OutputLine(ECHOMINIMAL, "Invalid " & StrVarName & ".") + Call OutputLine(ECHOMINIMAL, "Please check the input and try again.") + Exit Function + End If + + strVar = Wscript.Arguments.Item(intArgIter) + + If Err.Number Then + Call OutputLine(ECHOMINIMAL, "Error: " & Err.Number & ": " & Err.Description & ".") + Call OutputLine(ECHOMINIMAL, "Invalid " & StrVarName & ".") + Call OutputLine(ECHOMINIMAL, "Please check the input and try again.") + Exit Function + End If + + If InStr(strVar, "/") Then + Call OutputLine(ECHOMINIMAL, "Invalid " & StrVarName) + Call OutputLine(ECHOMINIMAL, "Invalid Parameter was:" & StrVar) + Call OutputLine(ECHOMINIMAL, "Please check the input and try again.") + Exit Function + End If + + blnGetArg = True 'success + End If + + Else + strVar = Right(Wscript.Arguments(intArgIter), _ + Len(Wscript.Arguments(intArgIter)) - 4) + blnGetArg = True 'success + Exit Function + End If + + Else + intArgIter = intArgIter + 1 + + If intArgIter > (Wscript.Arguments.Count - 1) Then + Call OutputLine(ECHOMINIMAL, "Parameter Missing: " & StrVarName & ".") + Call OutputLine(ECHOMINIMAL, "Invalid " & StrVarName & ".") + Call OutputLine(ECHOMINIMAL, "Please check the input and try again.") + Exit Function + End If + + strVar = Wscript.Arguments.Item(intArgIter) + + If Err.Number Then + Call OutputLine(ECHOMINIMAL, "Error: " & Err.Number & ": " & Err.Description & ".") + Call OutputLine(ECHOMINIMAL, "Invalid " & StrVarName & ".") + Call OutputLine(ECHOMINIMAL, "Please check the input and try again.") + Exit Function + End If + + If InStr(strVar, "/") Then + Call OutputLine(ECHOMINIMAL, "Invalid " & StrVarName) + Call OutputLine(ECHOMINIMAL, "Invalid Parameter was:" & StrVar) + Call OutputLine(ECHOMINIMAL, "Please check the input and try again.") + Exit Function + End If + + blnGetArg = True 'success + End If + +End Function + +'******************************************************************** +'* +'* Function CreateLogFile() +'* +'* Purpose: Creates the local log file of all of the script output +'* +'* Input: strLogFileName +'* +'******************************************************************** +Function CreateLogFile(ByVal strLogFileName) + Dim FileSystem + Set FileSystem = CreateObject("Scripting.FileSystemObject") + + 'Get the actual path + Dim strFileName + strFileName = FileSystem.GetAbsolutePathName(strLogFileName) + + Call WScript.StdOut.WriteLine ("Log file = " & strFileName) + + On Error Resume Next + + ' just append to + + If FileSystem.FileExists(strFileName) Then + 'Open Existing log + Set CreateLogFile = FileSystem.OpenTextFile(strFileName, FILE_FLAG_APPEND, True) + Else + 'Open new log + Set CreateLogFile = FileSystem.CreateTextFile(strFileName, True) + End If + + Set FileSystem = Nothing + + If Err.Number <> 0 Then + Call WScript.StdErr.WriteLine ("Error creating the log file " & strFileName) + Call WScript.StdErr.WriteLine ("Error " & Err.Number & " - " & Err.Description) + Call WScript.Quit (1) + End If + + On Error Goto 0 +End Function ' CreateLogFile + +'******************************************************************** +'* +'* Function SetProvider() +'* +'* Purpose: +'* +'* Input: ProviderString +'* HashAlg +'* KeyLen +'* +'******************************************************************** +Function SetProvider(ByRef oCASetup, ByVal ProviderString, ByVal HashAlg, ByVal KeyLen) + Call OutputLine(ECHOMINIMAL, _ + "SetProvider called with " & _ + Chr(34) & ProviderString & Chr(34) & ", " & _ + Chr(34) & HashAlg & Chr(34) & ", " & _ + Chr(34) & KeyLen & Chr(34)) + + 'Declare variable to store KeyInfo object + Dim oCAKeyInfo + Dim retVal + + retVal = False + + Call OutputLine(ECHOMINIMAL, "SetProvider: Creating oCAKeyInfo by calling oCASetup.GetCASetupProperty(SETUPPROP_CAKEYINFORMATION )") + ' Create CA KeyInfo object + Set oCAKeyInfo = oCASetup.GetCASetupProperty(SETUPPROP_CAKEYINFORMATION) + + If ("" <> ProviderString) Then + Call OutputLine(ECHOMINIMAL, "SetProvider: Changing oCAKeyInfo.ProviderName to " & ProviderString) + oCAKeyInfo.ProviderName = ProviderString + End If + + ' only modify key length if it was specified + + If ("" <> KeyLen) Then + Call OutputLine(ECHOMINIMAL, "SetProvider: Changing oCAKeyInfo.Length to " & KeyLen) + oCAKeyInfo.Length = KeyLen + End If + + ' Only modify hash algorithm if it was specified + + If ("" <> HashAlg) Then + Call OutputLine(ECHOMINIMAL, "SetProvider: Changing oCAKeyInfo.HashAlgorithm to " & HashAlg) + oCAKeyInfo.HashAlgorithm = HashAlg + End If + + Call OutputLine(ECHOMINIMAL, "SetProvider: Calling oCASetup.SetCASetupProperty(SETUPPROP_CAKEYINFORMATION, oCAKeyInfo) ") + + On Error Resume Next + Call Err.Clear() + + ' Set the keyInfo property + Call oCASetup.SetCASetupProperty(SETUPPROP_CAKEYINFORMATION, oCAKeyInfo) + + If (Err.Number <> 0) Then + Call OutputLine(ECHOMINIMAL, "SetProvider1: Error " & Err.Number & ": " & Err.Description) + Call OutputLine(ECHOMINIMAL, "Error Source: " & Err.Source) + 'Exit the script + Call WScript.Quit (1) + End If ' error occurred + + SetProvider = True +End Function 'SetProvider + +'******************************************************************** +'* +'* Function InstallAndVerifyCA() +'* +'* Purpose: runs setup on CA object with specified params +'* +'* Input: CAType +'* CAService +'* WebPages +'* +'********************************************************************' +Function InstallAndVerifyCA(ByVal CAType, ByVal CAService, ByVal WebPages) + Dim LocalCAConfig + Dim CADBPath + + ' Default to failed + InstallAndVerifyCA = False + + On Error Resume Next + + Call Err.Clear() + + Call OutputLine(ECHOMINIMAL, "InstallAndVerifyCA: InitializeDefaults") + Call OutputLine(ECHOMINIMAL, "CAService: " & CAService) + Call OutputLine(ECHOMINIMAL, "WebPages: " & WebPages) + + Err.Number = 0 + + ' Call this function with an error handling wrapper, or vbscript equivalent.. + Call g_oCASetup.InitializeDefaults(CAService, WebPages) + + If (0 <> Err.Number) Then + + If (5 = Err.Number) Then + ' uninstall + + If(bRecursed = False) Then + bRecursed = True + Call UninstallCA(False) + InstallAndVerifyCA = InstallAndVerifyCA( CAType, CAService, WebPages) + Exit Function + End If + + End If 'error is already installed + + Call PrintErrorInfo("CA Already install and cannot uninstall", Err) + Call OutputLine(ECHOMINIMAL, "") + Exit Function 'InstallAndVerifyCA + End If 'error occurred + + 'CA Service setup section + If (CAService = True) then + 'Specify CA role + Call OutputLine(ECHOMINIMAL, "InstallAndVerifyCA: SetCASetupProperty - CAType = " & CAType) + Call g_oCASetup.SetCASetupProperty(SETUPPROP_CATYPE, CAType) + + If (0 <> Err.Number) And (VALUE_OUT_OF_RANGE <> Err.Number) Then + Call PrintErrorInfo("InstallAndVerifyCA3:unable to set SETUPPROP_CATYPE!", Err) + Exit Function 'InstallAndVerifyCA + End If 'not a domain admin and error occurred + + + If (VALUE_OUT_OF_RANGE = Err.Number) Then + Call OutputLine(ECHOMINIMAL, "InstallAndVerifyCA: Error! Must be a domain administrator to create Enterprise CA") + Exit Function 'InstallAndVerifyCA + End If ' not a domain admin + + Call Err.Clear() + + if (bInteractive <> FALSE) then + Call OutputLine(ECHOMINIMAL, "InstallAndVerifyCA: SetCASetupProperty - Interactive = " & bInteractive) + Call g_oCASetup.SetCASetupProperty(SETUPPROP_INTERACTIVE, bInteractive) + + If (0 <> Err.Number) Then + Call PrintErrorInfo("InstallAndVerifyCA:unable to set Interactive!", Err) + Call OutputLine(ECHOMINIMAL, "") + Exit Function 'InstallAndVerifyCA + End If + end if + + If (False <> bReuseKey) Or (False <> bReuseCert) Then + + If (False = SetupKeyReuse(bReuseKey, bReuseCert, strCAName)) Then + Call PrintErrorInfo("InstallAndVerifyCA: SetupKeyReuse failed.", Err) + Exit Function + End If + + Else + If "" <> strCAName then + Call OutputLine(ECHOMINIMAL, "InstallAndVerifyCA: SetCADistinguishedName") + 'CAName, ignore UTF8, overwrite existing key, overwrite CA in DS + Dim strCAFullDN + strCAFullDN = "CN=" & strCAName + If "" <> strDNSuffix then strCAFullDN = strCAFullDN & "," & strDNSuffix + + Call g_oCASetup.SetCADistinguishedName(strCAFullDN, True, True, True) + 'Display errors + + If (g_oCASetup.CAErrorId <> 0) Then + Call PrintErrorInfo("InstallAndVerifyCA:SetCADistinguishedName failed. ", Err) + End If + + End If + + End If + + Call Err.Clear() + + If (CAType <> ENTERPRISE_ROOTCA) And (CAType <> STANDALONE_ROOTCA) And (bReuseCert <> True) Then + If (strRequestFile = "") Then + Call OutputLine(ECHOMINIMAL, "InstallAndVerifyCA: SetParentCAInformation") + 'Set parent CA information if it is a subordinate + Call g_oCASetup.SetParentCAInformation(strRootCAName) + + If (0 <> Err.Number) And (ROOT_CA_NOT_FOUND <> Err.Number) Then + Call PrintErrorInfo("InstallAndVerifyCA:unable to set ParentCAInformation!", Err) + Call OutputLine(ECHOMINIMAL, "") + Exit Function 'InstallAndVerifyCA + End If ' root ca not found + + If (ROOT_CA_NOT_FOUND = Err.Number) Then + Call OutputLine(ECHOMINIMAL, "InstallAndVerifyCA: Root CA (to Subordinate to) could not be found!") + Exit Function 'InstallAndVerifyCA + End If ' root ca not found + Else + Call g_oCASetup.SetCASetupProperty(SETUPPROP_REQUESTFILE, strRequestFile) + End If + End If ' not root + + If (bReuseCert = False) Then + Dim bProviderSet + bProviderSet = SetProvider(g_oCASetup, strSelectedCSP, strSelectedHashAlg, iSelectedKeySize) + + If (False = bProviderSet) Then + Call OutputLine(ECHOMINIMAL, "InstallAndVerifyCA:unable to set key properties!") + Exit Function 'InstallAndVerifyCA + End If 'error occurred + End If + + Call Err.Clear() + End If + + If (True = WebPages) And (CAType = NO_INSTALL_CA) Then + Call OutputLine(ECHOMINIMAL, "InstallAndVerifyCA: SetWebCAInformation") + 'Set web CA information if it is a web pages + Call g_oCASetup.SetWebCAInformation(strRootCAName) + + If (0 <> Err.Number) Then + + If ( REG_VALUE_NOT_FOUND <> Err.Number) Then + Call PrintErrorInfo("InstallAndVerifyCA:unable to set SetWebCAInformation!", Err) + Call OutputLine(ECHOMINIMAL, "") + Else + Call OutputLine(ECHOMINIMAL, "InstallAndVerifyCA: install failed, registry key not present!") + End If + + Exit Function 'InstallAndVerifyCA + End If ' error + + End If ' web pages should be installed + + Call OutputLine(ECHOMINIMAL, "InstallAndVerifyCA: Setting Key Properties") + + Call Err.Clear() + + Call OutputLine(ECHOMINIMAL, "InstallAndVerifyCA: calling SetProvider") + + 'Dim KeyLenVar + 'KeyLenVar = ProviderKeyLength(strSelectedCSP) + + 'If ("" <> KeyLenVar) Then + ' iSelectedKeySize = KeyLenVar + 'End If + + Call Err.Clear() + + Call OutputLine(ECHOMINIMAL, "InstallAndVerifyCA: BeforeInstall!") + + Call g_oCASetup.Install() + + If (0 <> Err.Number) Then + + If ( REG_VALUE_NOT_FOUND <> Err.Number) Then + Call PrintErrorInfo("InstallAndVerifyCA:Install failed!", Err) + Call OutputLine(ECHOMINIMAL, "") + Else + Call OutputLine(ECHOMINIMAL, "InstallAndVerifyCA: install failed, registry key not present!") + Call OutputLine(ECHOMINIMAL, "InstallAndVerifyCA: " & Err.Number & ": " & Err.Description) + End If + + Exit Function 'InstallAndVerifyCA + End If 'error occurred + + Call OutputLine(ECHOMINIMAL, "InstallAndVerifyCA: AfterInstall!") + + On Error GoTo 0 + + Call OutputLine(ECHOMINIMAL, "InstallAndVerifyCA: calling GetLocalCAConfig") + + LocalCAConfig = GetLocalCAConfig() + + If (LocalCAConfig = "") Then + Call OutputLine(ECHOMINIMAL, "InstallAndVerifyCA: CA Reg entry not present!") + Exit Function 'InstallAndVerifyCA + End If ' getlocalcaconfig failed + + WScript.Sleep 30000 + + If (CAService = True) Then + + If (0 <> PingCA(LocalCAConfig)) Then + Call OutputLine(ECHOMINIMAL, "InstallAndVerifyCA: Service not started!") + Exit Function 'InstallAndVerifyCA + End If ' can't ping service + + End If ' ca set to install as a service + + InstallAndVerifyCA = True +End Function 'InstallAndVerifyCA + +'******************************************************************** +'* +'* Function UninstallCA() +'* +'* Purpose: Uninstalls all of the CA server components or optionally just the pages +'* +'* Input: +'* +'********************************************************************' +Function UninstallCA(ByVal WebPagesOnly) + Dim LocalCAConfig + + Call OutputLine(ECHOMINIMAL, "UninstallCA: calling GetLocalCAConfig") + + ' See where the server is at currently + LocalCAConfig = GetLocalCAConfig() + + if (WebPagesOnly = False) Then + If ("" = LocalCAConfig) Then + Call OutputLine(ECHOMINIMAL, "UninstallCA: CA not installed!") + UninstallCA = True + Exit Function 'UninstallCA + End If ' getlocalcaconfig failed + End If + + Call OutputLine(ECHOMINIMAL, "UninstallCA: calling .PreUninstall") + + ' Clean up the web pages + On Error Resume Next + Call g_oCASetup.PreUninstall(WebPagesOnly) + + If Err.Number <> 0 Then + Call PrintErrorInfo("UninstallCA: ", Err) + End If + + Call OutputLine(ECHOMINIMAL, "UninstallCA: calling .PostUninstall") + + Call g_oCASetup.PostUninstall() + + Call OutputLine(ECHOMINIMAL, "UninstallCA: calling .GetLocalCAConfig") + + ' Check registry to see if CA is still installed + LocalCAConfig = GetLocalCAConfig() + + If ("" = LocalCAConfig) Then + 'Not installed! + Call OutputLine(ECHOMINIMAL, "UninstallCA: Uninstall completed Successfully!") + UninstallCA = True + Exit Function 'UninstallCA + End If 'getlocalcaconfig failed + + Call OutputLine(ECHOMINIMAL, "UninstallCA: calling PingCA") + + ' If the registry is still there, it might just be slow. + ' Try pinging the CA + + If (0 <> PingCA("")) Then + UninstallCA = True + Exit Function 'UninstallCA + End If ' can't ping service + + ' Default to error + UninstallCA = False +End Function 'UninstallCA + +'******************************************************************** +'* +'* Function GetLocalCAConfig() +'* +'* Purpose: Determine role of CA if installed +'* +'* Input: +'* +'********************************************************************' +Function GetLocalCAConfig() + Dim WshShell + Dim ActiveConfig + Dim CAName + Dim CAServer + + On Error Resume Next + + Set WshShell = WScript.CreateObject("WScript.Shell") + ActiveConfig = WshShell.RegRead("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\CertSvc\Configuration\Active") + + If (Err.Number <> 0) Then + + If (REG_VALUE_NOT_FOUND <> Err.Number) Then + GetLocalCAConfig = "" + Call PrintErrorInfo("GetLocalCAConfig: ", Err) + Exit Function 'GetLocalCAConfig + Else ' reg value not found + GetLocalCAConfig = "" + Call OutputLine(ECHOMINIMAL, "GetLocalCAConfig: CA Not Installed!") + Call OutputLine(ECHOMINIMAL, "") + Exit Function 'GetLocalCAConfig + End If ' reg value found + + End If ' error occurred + + Call OutputLine(ECHOMINIMAL," Reading HKLM\SYSTEM\CurrentControlSet\Services\CertSvc\Configuration\" & ActiveConfig & "\CommonName") + CAName = WshShell.RegRead("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\CertSvc\Configuration\" & ActiveConfig & "\CommonName") + Call OutputLine(ECHOMINIMAL, "CAName: " & CAName) + + Call OutputLine(ECHOMINIMAL," Reading HKLM\SYSTEM\CurrentControlSet\Services\CertSvc\Configuration\" & ActiveConfig & "\CAServerName") + CAServer = WshShell.RegRead("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\CertSvc\Configuration\" & ActiveConfig & "\CAServerName") + Call OutputLine(ECHOMINIMAL, "CAServer: " & CAServer) + + ' Cleanup + Set WShShell = Nothing + + 'Set Return value + GetLocalCAConfig = CAServer & "\" & CAName +End Function 'GetLocalCAConfig + +'******************************************************************** +'* +'* Function PingCA() +'* +'* Purpose: use CertUtil to ping the CA +'* +'* Input: +'* +'********************************************************************' +Function PingCA(ByVal CAConfig) + Dim WshShell + Dim command + Dim RunRet + + Set WshShell = WScript.CreateObject("WScript.Shell") + + If ("" <> CAConfig) Then + command = "certutil -config " & CAConfig & " -ping" + Else 'caconfig param null + command = "certutil -ping" + End If ' caconfig param passed + + RunRet = WshShell.Run(command, 1, False) + + Set WShShell = Nothing + PingCA = RunRet +End Function ' PingCA + +'******************************************************************** +'* +'* Function SetUpKeyReuse() +'* +'* Purpose: use CertUtil to ping the CA +'* +'* Input: +'* +'********************************************************************' +Function SetUpKeyReuse(ByVal bReuseKey, ByVal bReuseCert, ByVal KeyName) + + Dim oCAKeyInfo + Dim oExistingCerts + Dim CertInfo + + On Error Resume Next + + Set oCAKeyInfo = g_oCASetup.GetCASetupProperty(SETUPPROP_CAKEYINFORMATION) + Set oExistingCerts = g_oCASetup.GetExistingCACertificates() + + Call OutputLine(ECHOMINIMAL,"Searching Existing Machine Keys") + + For Each CertInfo in oExistingCerts + wscript.echo "Existing Cert: " & certinfo.ContainerName + + If (KeyName = certinfo.ContainerName) Then + wscript.echo "Found cert!" + oCAKeyInfo.Existing = True + If (Err.Number <> 0) Then Call PrintErrorInfo("SetUpKeyReuse: oCAKeyInfo.Existing", Err) + oCAKeyInfo.ContainerName = CertInfo.ContainerName + If (Err.Number <> 0) Then Call PrintErrorInfo("SetUpKeyReuse: oCAKeyInfo.ContainerName", Err) + oCAKeyInfo.HashAlgorithm = CertInfo.HashAlgorithm + If (Err.Number <> 0) Then Call PrintErrorInfo("SetUpKeyReuse: oCAKeyInfo.HashAlgorithm", Err) + oCAKeyInfo.Length = CertInfo.Length + If (Err.Number <> 0) Then Call PrintErrorInfo("SetUpKeyReuse: oCAKeyInfo.Length", Err) + oCAKeyInfo.ProviderName = CertInfo.ProviderName + If (Err.Number <> 0) Then Call PrintErrorInfo("SetUpKeyReuse: oCAKeyInfo.ProviderName", Err) + + If (bReuseCert = True) Then + oCAKeyInfo.ExistingCACertificate = CertInfo.ExistingCACertificate + If (Err.Number <> 0) Then Call PrintErrorInfo("SetUpKeyReuse: oCAKeyInfo.ExistingCACertificate", Err) + End If + + Call g_oCASetup.SetCASetupProperty(SETUPPROP_CAKEYINFORMATION, oCAKeyInfo) + If (Err.Number <> 0) Then Call PrintErrorInfo("SetUpKeyReuse: g_oCASetup.SetCASetupProperty(1, oCAKeyInfo)", Err) + wscript.echo g_oCASetup.GetCASetupProperty(SETUPPROP_CANAME) + wscript.echo g_oCASetup.GetCASetupProperty(SETUPPROP_CADSSUFFIX) + End If + + Next + + SetupKeyReuse = True + +End Function ' SetKeyReuse diff --git a/Build/Automate/DC2/DCPromo.ps1 b/Build/Automate/DC2/DCPromo.ps1 new file mode 100644 index 0000000..051bb8d --- /dev/null +++ b/Build/Automate/DC2/DCPromo.ps1 @@ -0,0 +1,8 @@ +$null = Add-WindowsFeature -name ad-domain-services -IncludeManagementTools +$AdminPWD = ((Select-String -SimpleMatch "Adminpwd=" -Path "B:\Automate\automate.ini").line).substring(9) +$safemodeadminpwd = ConvertTo-SecureString -String $AdminPWD -asplaintext -force +$Cred = New-Object System.Management.Automation.PsCredential "lab\administrator", $safemodeadminpwd +Write-Host "Add to domain" +Add-Computer -DomainName "Lab.local" -Credential $Cred +Write-Host "Promote to domain controller" +Install-ADDSDomainController diff --git a/Build/Automate/DC2/DCpromo.txt b/Build/Automate/DC2/DCpromo.txt new file mode 100644 index 0000000..3522dfa --- /dev/null +++ b/Build/Automate/DC2/DCpromo.txt @@ -0,0 +1,11 @@ +[DCInstall] +UserName=administrator +UserDomain=lab.local +Password=VMware1! +SiteName = "Lab" +ReplicaOrNewDomain=replica +ReplicaDomainDNSName=lab.local +InstallDNS=yes +ConfirmGC=yes +RebootOnCompletion=yes +SafeModeAdminPassword="VMware1!" diff --git a/Build/Automate/DC2/DropDBs.txt b/Build/Automate/DC2/DropDBs.txt new file mode 100644 index 0000000..ef9b77f --- /dev/null +++ b/Build/Automate/DC2/DropDBs.txt @@ -0,0 +1,8 @@ +drop database vCenter +go +drop database SRM +go +drop database SRMRep +go +drop database RSA +go diff --git a/Build/Automate/DC2/MakeDB.txt b/Build/Automate/DC2/MakeDB.txt new file mode 100644 index 0000000..22fec61 --- /dev/null +++ b/Build/Automate/DC2/MakeDB.txt @@ -0,0 +1,61 @@ +Create Login vpx WITH PASSWORD = 'VMware1!' +Go +create Database vCenter +Go +ALTER AUTHORIZATION ON DATABASE::vCenter TO vpx +ALTER AUTHORIZATION ON DATABASE::msdb TO vpx +Go +Create Login VMSRM WITH PASSWORD = 'VMware1!' +Go +create database SRM +GO +create database SRMRep +GO +ALTER AUTHORIZATION ON DATABASE::SRM TO VMSRM +ALTER AUTHORIZATION ON DATABASE::SRMRep TO VMSRM +Go +EXEC master..sp_addsrvrolemember @loginame = 'lab\VI-admin', @rolename = 'sysadmin' +Go +EXEC master..sp_addsrvrolemember @loginame = 'lab\SVC_Veeam', @rolename = 'sysadmin' +Go +USE MASTER +GO +CREATE DATABASE RSA ON PRIMARY( +NAME='RSA_DATA', +FILENAME='C:\Program Files\Microsoft SQL Server\MSSQL10_50.SQLEXPRESS\MSSQL\DATA\RSA_DATA.mdf', +SIZE=10MB, +MAXSIZE=UNLIMITED, +FILEGROWTH=10%), +FILEGROUP RSA_INDEX( +NAME='RSA_INDEX', +FILENAME='C:\Program Files\Microsoft SQL Server\MSSQL10_50.SQLEXPRESS\MSSQL\DATA\RSA_INDEX.ndf', +SIZE=10MB, +MAXSIZE=UNLIMITED, +FILEGROWTH=10%) +LOG ON( +NAME='translog', +FILENAME='C:\Program Files\Microsoft SQL Server\MSSQL10_50.SQLEXPRESS\MSSQL\DATA\translog.ldf', +SIZE=10MB, +MAXSIZE=UNLIMITED, +FILEGROWTH=10% ) +GO +SP_DBOPTION 'RSA', 'autoshrink', true +GO +EXEC SP_DBOPTION 'RSA', 'trunc. log on chkpt.', true +GO +CHECKPOINT +GO +USE MASTER +GO +CREATE LOGIN RSA_DBA WITH PASSWORD = 'VMware1!', DEFAULT_DATABASE = RSA +GO +CREATE LOGIN RSA_USER WITH PASSWORD = 'VMware1!', DEFAULT_DATABASE = RSA +GO +USE RSA +GO +ALTER AUTHORIZATION ON DATABASE::RSA TO [RSA_DBA] +GO +CREATE USER RSA_USER FOR LOGIN [RSA_USER] +GO +CHECKPOINT +GO diff --git a/Build/Automate/DC2/Phase2.cmd b/Build/Automate/DC2/Phase2.cmd new file mode 100644 index 0000000..a00ba5b --- /dev/null +++ b/Build/Automate/DC2/Phase2.cmd @@ -0,0 +1,24 @@ +@echo off +echo ** +echo * Connect to build share +net use B: \\192.168.199.7\Build +type B:\automate\version.txt >> C:\buildlog.txt +echo ** +echo * Copy PowerShell files +echo * Copy PowerShell files +copy B:\Automate\validate.ps1 C:\ +copy B:\Automate\PSFunctions.ps1 C:\ +copy B:\Automate\PXEMenuConfig.ps1 C:\ +copy B:\Automate\DC2\Phase2.ps1 C:\ +regedit -s B:\Automate\_Common\ExecuPol.reg +regedit -s B:\Automate\_Common\NoSCRNSave.reg +regedit -s B:\Automate\_Common\ExplorerView.reg +regedit -s B:\Automate\_Common\Nested.reg +copy B:\automate\_Common\wasp.dll C:\windows\system32 +echo * Activate Windows >> c:\buildlog.txt +cscript //B "%windir%\system32\slmgr.vbs" /ato +echo * Starting PowerShell script for Phase 2 completion +echo * Starting PowerShell script for Phase 2 completion >> C:\buildlog.txt +powershell c:\Phase2.ps1 +if exist C:\phase2.ps1 del c:\phase2.ps1 +if exist c:\phase2.cmd del c:\phase2.cmd \ No newline at end of file diff --git a/Build/Automate/DC2/Phase2.ps1 b/Build/Automate/DC2/Phase2.ps1 new file mode 100644 index 0000000..09b27b9 --- /dev/null +++ b/Build/Automate/DC2/Phase2.ps1 @@ -0,0 +1,292 @@ +if (Test-Path C:\PSFunctions.ps1) { + . "C:\PSFunctions.ps1" +} else { + Write-Host "PSFunctions.ps1 not found. Please copy all PowerShell files from B:\Automate to C:\ and rerun Build.ps1" + Read-Host "Press <Enter> to exit" + exit +} + +# Start DC configuration process + +if (Test-Path B:\Automate\automate.ini) { + $AdminPWD = "VMware1!" + $AdminPWD = ((Select-String -SimpleMatch "Adminpwd=" -Path "B:\Automate\automate.ini").line).substring(9) + B:\automate\_Common\Autologon administrator lab $AdminPWD +} +Write-BuildLog "Correct DNS client settings" +$wmi = Get-WmiObject win32_networkadapterconfiguration -filter "ipenabled = 'true'" +$null = $wmi.SetDNSServerSearchOrder("192.160.201.4") + +Write-BuildLog "Installing 7-zip." +try { + msiexec /qb /i B:\Automate\_Common\7z920-x64.msi + Write-BuildLog "Installation of 7-zip completed." +} +catch { + Write-BuildLog "7-zip installation failed." +} +Write-BuildLog "" + +Write-BuildLog "Installing TFTP." +Write-BuildLog "Creating C:\TFTP-Root directory." +$null = $null = New-Item -Path C:\TFTP-Root -ItemType Directory -Force -Confirm:$false +Write-BuildLog "Creating C:\Program Files\Tftpd64_SE directory." +$null = $null = New-Item -Path "C:\Program Files\Tftpd64_SE" -ItemType Directory -Force -Confirm:$false +xcopy B:\Automate\DC2\Tftpd64_SE\*.* "C:\Program Files\Tftpd64_SE\" /s /c /y /q +Start-Sleep -Seconds 30 +Start-Process "C:\Program Files\Tftpd64_SE\Tftpd64_SVC.exe" -ArgumentList "-install" -Wait +Write-BuildLog "Setting TFTP service startup type and starting it." +$null = Set-Service -Name "Tftpd32_svc" -StartupType "Automatic" +$null = Start-Service -Name "Tftpd32_svc" +Write-BuildLog "Copying B:\Automate\DC2\TFTP-Root\ contents to C:\TFTP-Root." +xcopy B:\Automate\DC2\TFTP-Root\*.* C:\TFTP-Root\ /s /c /y /q +Write-BuildLog "Installation of TFTP completed." +Write-BuildLog "" + +Write-BuildLog "Checking for VMware Tools..." +if (Test-Path -Path "B:\VMTools\setup*") { + Write-BuildLog "VMware Tools found." + $vmtools = $true +} else { + if (Test-Path "B:\VMTools\windows.iso") { + Write-BuildLog "Extracting VMware Tools from ISO." + . "C:\Program Files\7-Zip\7z.exe" x -r -y -aoa -oB:\VMtools\ B:\VMTools\windows.iso >> C:\BuildLog.txt + $vmtools = $true + } + Else {Write-BuildLog "VMware Tools not found on Build share."} + Write-BuildLog "" +} + +Write-BuildLog "Checking for vSphere files..." + +if (Test-Path "B:\ESXi55\*") { + if (Test-Path "B:\ESXi55\*.iso") { + Write-BuildLog "Extracting ESXi 5.5 installer from ISO." + . "C:\Program Files\7-Zip\7z.exe" x -r -y -aoa -oB:\ESXi55\ B:\ESXi55\*.iso >> C:\ExtractLog.txt + } + Write-BuildLog "ESXi 5.5 found; creating C:\TFTP-Root\ESXi55 and copying ESXi 5.5 boot files." + $null = $null = New-Item -Path C:\TFTP-Root\ESXi55 -ItemType Directory -Force -Confirm:$false + xcopy B:\ESXi55\*.* C:\TFTP-Root\ESXi55 /s /c /y /q + Get-Content C:\TFTP-Root\ESXi55\BOOT.CFG | %{$_ -replace "/","/ESXi55/"} | Set-Content C:\TFTP-Root\ESXi55\Besx11-55.cfg + Add-Content C:\TFTP-Root\ESXi55\\Besx11-55.cfg "kernelopt=ks=nfs://192.168.199.7/mnt/LABVOL/Build/Automate/Hosts/esx11-5.cfg" + Get-Content C:\TFTP-Root\ESXi55\BOOT.CFG | %{$_ -replace "/","/ESXi55/"} | Set-Content C:\TFTP-Root\ESXi55\Besx12-55.cfg + Add-Content C:\TFTP-Root\ESXi55\\Besx12-55.cfg "kernelopt=ks=nfs://192.168.199.7/mnt/LABVOL/Build/Automate/Hosts/esx12-5.cfg" + + powershell C:\PXEMenuConfig.ps1 ESXi55 + Write-BuildLog "ESXi 5.5 added to TFTP and PXE menu." + Write-BuildLog "" + $esxi55 = $true +} else { + $esxi55 = $false +} + +if (Test-Path "B:\ESXi51\*") { + if (Test-Path "B:\ESXi51\*.iso") { + Write-BuildLog "Extracting ESXi 5.1 installer from ISO." + . "C:\Program Files\7-Zip\7z.exe" x -r -y -aoa -oB:\ESXi51\ B:\ESXi51\*.iso >> C:\ExtractLog.txt + } + Write-BuildLog "ESXi 5.1 found; creating C:\TFTP-Root\ESXi51 and copying ESXi 5.1 boot files." + $null = $null = New-Item -Path C:\TFTP-Root\ESXi51 -ItemType Directory -Force -Confirm:$false + xcopy B:\ESXi51\*.* C:\TFTP-Root\ESXi51 /s /c /y /q + Get-Content C:\TFTP-Root\ESXi51\BOOT.CFG | %{$_ -replace "/","/ESXi51/"} | Set-Content C:\TFTP-Root\ESXi51\Besx1-5.cfg + Add-Content C:\TFTP-Root\ESXi51\Besx1-5.cfg "kernelopt=ks=nfs://192.168.199.7/mnt/LABVOL/Build/Automate/Hosts/esx1-5.cfg" + Get-Content C:\TFTP-Root\ESXi51\BOOT.CFG | %{$_ -replace "/","/ESXi51/"} | Set-Content C:\TFTP-Root\ESXi51\Besx2-5.cfg + Add-Content C:\TFTP-Root\ESXi51\Besx2-5.cfg "kernelopt=ks=nfs://192.168.199.7/mnt/LABVOL/Build/Automate/Hosts/esx2-5.cfg" + Get-Content C:\TFTP-Root\ESXi51\BOOT.CFG | %{$_ -replace "/","/ESXi51/"} | Set-Content C:\TFTP-Root\ESXi51\Besx3-5.cfg + Add-Content C:\TFTP-Root\ESXi51\Besx3-5.cfg "kernelopt=ks=nfs://192.168.199.7/mnt/LABVOL/Build/Automate/Hosts/esx3-5.cfg" + Get-Content C:\TFTP-Root\ESXi51\BOOT.CFG | %{$_ -replace "/","/ESXi51/"} | Set-Content C:\TFTP-Root\ESXi51\Besx4-5.cfg + Add-Content C:\TFTP-Root\ESXi51\Besx4-5.cfg "kernelopt=ks=nfs://192.168.199.7/mnt/LABVOL/Build/Automate/Hosts/esx4-5.cfg" + powershell C:\PXEMenuConfig.ps1 ESXi51 + Write-BuildLog "ESXi 5.1 added to TFTP and PXE menu." + Write-BuildLog "" + $esxi51 = $true +} else { + $esxi51 = $false +} + +if (Test-Path "B:\ESXi50\*") { + if (Test-Path "B:\ESXi50\*.iso") { + Write-BuildLog "Extracting ESXi 5.0 installer from ISO." + . "C:\Program Files\7-Zip\7z.exe" x -r -y -aoa -oB:\ESXi50\ B:\ESXi50\*.iso >> C:\ExtractLog.txt + } + Write-BuildLog "ESXi 5.0 found; creating C:\TFTP-Root\ESXi50 and copying ESXi 5.0 boot files." + $null = $null = New-Item -Path C:\TFTP-Root\ESXi50 -ItemType Directory -Force -Confirm:$false + xcopy B:\ESXi50\*.* C:\TFTP-Root\ESXi50 /s /c /y /q + Get-Content C:\TFTP-Root\ESXi50\BOOT.CFG | %{$_ -replace "/","/ESXi50/"} | Set-Content C:\TFTP-Root\ESXi50\Besx1-5.cfg + Add-Content C:\TFTP-Root\ESXi50\Besx1-5.cfg "kernelopt=ks=nfs://192.168.199.7/mnt/LABVOL/Build/Automate/Hosts/esx1-5.cfg" + Get-Content C:\TFTP-Root\ESXi50\BOOT.CFG | %{$_ -replace "/","/ESXi50/"} | Set-Content C:\TFTP-Root\ESXi50\Besx2-5.cfg + Add-Content C:\TFTP-Root\ESXi50\Besx2-5.cfg "kernelopt=ks=nfs://192.168.199.7/mnt/LABVOL/Build/Automate/Hosts/esx2-5.cfg" + Get-Content C:\TFTP-Root\ESXi50\BOOT.CFG | %{$_ -replace "/","/ESXi50/"} | Set-Content C:\TFTP-Root\ESXi50\Besx3-5.cfg + Add-Content C:\TFTP-Root\ESXi50\Besx3-5.cfg "kernelopt=ks=nfs://192.168.199.7/mnt/LABVOL/Build/Automate/Hosts/esx3-5.cfg" + Get-Content C:\TFTP-Root\ESXi50\BOOT.CFG | %{$_ -replace "/","/ESXi50/"} | Set-Content C:\TFTP-Root\ESXi50\Besx4-5.cfg + Add-Content C:\TFTP-Root\ESXi50\Besx4-5.cfg "kernelopt=ks=nfs://192.168.199.7/mnt/LABVOL/Build/Automate/Hosts/esx4-5.cfg" + powershell C:\PXEMenuConfig.ps1 ESXi50 + Write-BuildLog "ESXi 5.0 added to TFTP and PXE menu." + Write-BuildLog "" + $esxi50 = $true +} else { + $esxi50 = $false +} + +if (Test-Path "B:\ESXi41\*") { + if (Test-Path "B:\ESXi41\*.iso") { + Write-BuildLog "Extracting ESXi 4.1 installer from ISO." + . "C:\Program Files\7-Zip\7z.exe" x -r -y -aoa -oB:\ESXi41\ B:\ESXi41\*.iso >> C:\ExtractLog.txt + } + Write-BuildLog "ESXi 4.1 found; creating C:\TFTP-Root\ESXi41 and copying ESXi 4.1 boot files." + $null = $null = New-Item -Path C:\TFTP-Root\ESXi41 -ItemType Directory -Force -Confirm:$false + xcopy B:\ESXi41\vmkboot.gz C:\TFTP-Root\ESXi41 /s /c /y /q + xcopy B:\ESXi41\vmkernel.gz C:\TFTP-Root\ESXi41 /s /c /y /q + xcopy B:\ESXi41\sys.vgz C:\TFTP-Root\ESXi41 /s /c /y /q + xcopy B:\ESXi41\cim.vgz C:\TFTP-Root\ESXi41 /s /c /y /q + xcopy B:\ESXi41\ienviron.vgz C:\TFTP-Root\ESXi41 /s /c /y /q + xcopy B:\ESXi41\install.vgz C:\TFTP-Root\ESXi41 /s /c /y /q + xcopy B:\ESXi41\mboot.c32 C:\TFTP-Root\ESXi41 /s /c /y /q + powershell C:\PXEMenuConfig.ps1 ESXi41 + Write-BuildLog "ESXi 4.1 added to TFTP and PXE menu." + Write-BuildLog "" + $esxi41 = $true +} else { + $esxi41 = $false +} + +if (Test-Path "B:\ESX41\*") { + if (Test-Path "B:\ESX41\*.iso") { + Write-BuildLog "Extracting ESX 4.1 installer from ISO." + . "C:\Program Files\7-Zip\7z.exe" x -r -y -aoa -oB:\ESX41\ B:\ESX41\*.iso >> C:\ExtractLog.txt + } + Write-BuildLog "ESX 4.1 found; creating C:\TFTP-Root\ESX41 and copying ESX 4.1 boot files." + $null = $null = New-Item -Path C:\TFTP-Root\ESX41 -ItemType Directory -Force -Confirm:$false + xcopy B:\ESX41\isolinux\vmlinuz C:\TFTP-Root\ESX41 /s /c /y /q + xcopy B:\ESX41\isolinux\initrd.img C:\TFTP-Root\ESX41 /s /c /y /q + powershell C:\PXEMenuConfig.ps1 ESX41 + Write-BuildLog "ESX 4.1 added to TFTP and PXE menu." + Write-BuildLog "" + $esx41 = $true +} else { + $esx41 = $false +} + +if (!($esx41 -or $esxi41 -or $esxi50 -or $esxi51 -or $esxi55)) { + Write-BuildLog "No ESX or ESXi files found." + Write-BuildLog "Is the NAS VM running? If so, make sure the Build share is available and populated." + Write-BuildLog "Restart this machine when Build share is available; build will proceed after restart." + exit +} + +Write-BuildLog "" +Write-BuildLog "Authorise and configure DHCP" +netsh dhcp add server dc2.lab.local 192.168.201.4 +netsh dhcp server 192.168.201.4 add scope 192.168.201.0 255.255.255.0 "Lab scope" "Scope for lab.local" +netsh dhcp server 192.168.201.4 scope 192.168.201.0 add iprange 192.168.201.100 192.168.201.199 +netsh dhcp server 192.168.201.4 scope 192.168.201.0 set optionvalue 003 IPADDRESS 192.168.201.2 +netsh dhcp server 192.168.201.4 scope 192.168.201.0 set optionvalue 005 IPADDRESS 192.168.201.4 +netsh dhcp server 192.168.201.4 scope 192.168.201.0 set optionvalue 006 IPADDRESS 192.168.201.4 +netsh dhcp server 192.168.201.4 scope 192.168.201.0 set optionvalue 015 STRING lab.local +netsh dhcp server 192.168.201.4 scope 192.168.201.0 set optionvalue 066 STRING 192.168.201.4 +netsh dhcp server 192.168.201.4 scope 192.168.201.0 set optionvalue 067 STRING pxelinux.0 +netsh dhcp server 192.168.201.4 scope 192.168.201.0 set state 1 + +Write-BuildLog "" +Write-BuildLog "Checking available SQL Express versions." +$null = $null = New-Item -Path C:\temp -ItemType Directory -Force -Confirm:$false +Write-BuildLog "" +Write-BuildLog "Checking available SQL Express versions." +$null = New-Item -Path C:\temp -ItemType Directory -Force -Confirm:$false +if (Test-Path "C:\Program Files\Microsoft SQL Server\100\Tools\Binn\sqlcmd.exe") { + Write-BuildLog "SQL Server Install found, not installing" +}Else { + if (Test-Path "B:\VIM_55\redist\SQLEXPR\SQLEXPR_x64_ENU.exe") { + $vc5SQL = $true + Write-BuildLog "SQL Server 2008 R2 Express SP1 for vCenter 5.5 found; installing." + copy B:\VIM_55\redist\SQLEXPR\SQLEXPR_x64_ENU.exe C:\temp + $Arguments = '/IACCEPTSQLSERVERLICENSETERMS /action=Install /FEATURES=SQL,Tools /SQLSYSADMINACCOUNTS="Lab\Domain Admins" /SQLSVCACCOUNT="Lab\vi-admin" /SQLSVCPASSWORD="' + $AdminPWD + '" /AGTSVCACCOUNT="Lab\vi-admin" /AGTSVCPASSWORD="' + $AdminPWD + '" /ADDCURRENTUSERASSQLADMIN /SECURITYMODE=SQL /SAPWD="VMware1!" /INSTANCENAME=SQLExpress /BROWSERSVCSTARTUPTYPE="Automatic" /TCPENABLED=1 /NPENABLED=1 /SQLSVCSTARTUPTYPE=Automatic /q' + Start-Process C:\temp\SQLEXPR_x64_ENU.exe -ArgumentList $Arguments -Wait + del c:\TEMP\SQLEXPR_x64_ENU.EXE + Write-BuildLog "Creating Databases." + Start-Process "C:\Program Files\Microsoft SQL Server\100\Tools\Binn\sqlcmd.exe" -ArgumentList "-S dc2\SQLEXPRESS -i B:\Automate\DC2\MakeDB.txt" -RedirectStandardOutput c:\sqllog.txt -Wait + Start-Process "C:\Program Files\Microsoft SQL Server\100\Tools\Binn\sqlcmd.exe" -ArgumentList "-S dc2\SQLEXPRESS -i B:\Automate\DC2\MakeDBvCD51.txt" -RedirectStandardOutput c:\sqllog.txt -Wait + Start-Process "C:\Program Files\Microsoft SQL Server\100\Tools\Binn\sqlcmd.exe" -ArgumentList "-S dc2\SQLEXPRESS -i B:\Automate\DC2\MakeDBvCD15.txt" -RedirectStandardOutput c:\sqllog.txt -Wait + regedit -s B:\Automate\DC2\SQLTCP.reg + } elseif (Test-Path "B:\VIM_51\redist\SQLEXPR\SQLEXPR_x64_ENU.exe") { + $vc5SQL = $true + Write-BuildLog "SQL Server 2008 R2 Express SP1 for vCenter 5.1 found; installing." + copy B:\VIM_51\redist\SQLEXPR\SQLEXPR_x64_ENU.exe C:\temp + $Arguments = '/IACCEPTSQLSERVERLICENSETERMS /action=Install /FEATURES=SQL,Tools /SQLSYSADMINACCOUNTS="Lab\Domain Admins" /SQLSVCACCOUNT="Lab\vi-admin" /SQLSVCPASSWORD="' + $AdminPWD + '" /AGTSVCACCOUNT="Lab\vi-admin" /AGTSVCPASSWORD="' + $AdminPWD + '" /ADDCURRENTUSERASSQLADMIN /SECURITYMODE=SQL /SAPWD="VMware1!" /INSTANCENAME=SQLExpress /BROWSERSVCSTARTUPTYPE="Automatic" /TCPENABLED=1 /NPENABLED=1 /SQLSVCSTARTUPTYPE=Automatic /q' + Start-Process C:\temp\SQLEXPR_x64_ENU.exe -ArgumentList $Arguments -Wait + Write-BuildLog "Creating Databases." + Start-Process "C:\Program Files\Microsoft SQL Server\100\Tools\Binn\sqlcmd.exe" -ArgumentList "-S dc2\SQLEXPRESS -i B:\Automate\DC2\MakeDB.txt" -RedirectStandardOutput c:\sqllog.txt -Wait + Start-Process "C:\Program Files\Microsoft SQL Server\100\Tools\Binn\sqlcmd.exe" -ArgumentList "-S dc2\SQLEXPRESS -i B:\Automate\DC2\MakeDBvCD51.txt" -RedirectStandardOutput c:\sqllog.txt -Wait + Start-Process "C:\Program Files\Microsoft SQL Server\100\Tools\Binn\sqlcmd.exe" -ArgumentList "-S dc2\SQLEXPRESS -i B:\Automate\DC2\MakeDBvCD15.txt" -RedirectStandardOutput c:\sqllog.txt -Wait + regedit -s B:\Automate\DC2\SQLTCP.reg + } elseif (Test-Path "B:\VIM_50\redist\SQLEXPR\SQLEXPR_x64_ENU.exe") { + $vc5SQL = $true + Write-BuildLog "SQL Server 2008 R2 Express SP1 for vCenter 5.0 found; installing." + copy B:\VIM_50\redist\SQLEXPR\SQLEXPR_x64_ENU.exe C:\temp + $Arguments = '/IACCEPTSQLSERVERLICENSETERMS /action=Install /FEATURES=SQL,Tools /SQLSYSADMINACCOUNTS="Lab\Domain Admins" /SQLSVCACCOUNT="Lab\vi-admin" /SQLSVCPASSWORD="' + $AdminPWD + '" /AGTSVCACCOUNT="Lab\vi-admin" /AGTSVCPASSWORD="' + $AdminPWD + '" /ADDCURRENTUSERASSQLADMIN /SECURITYMODE=SQL /SAPWD="VMware1!" /INSTANCENAME=SQLExpress /BROWSERSVCSTARTUPTYPE="Automatic" /TCPENABLED=1 /NPENABLED=1 /SQLSVCSTARTUPTYPE=Automatic /q' + Start-Process C:\temp\SQLEXPR_x64_ENU.exe -ArgumentList $Arguments -Wait + Write-BuildLog "Creating Databases." + Start-Process "C:\Program Files\Microsoft SQL Server\100\Tools\Binn\sqlcmd.exe" -ArgumentList "-S dc2\SQLEXPRESS -i B:\Automate\DC2\MakeDB.txt" -RedirectStandardOutput c:\sqllog.txt -Wait + Start-Process "C:\Program Files\Microsoft SQL Server\100\Tools\Binn\sqlcmd.exe" -ArgumentList "-S dc2\SQLEXPRESS -i B:\Automate\DC2\MakeDBvCD15.txt" -RedirectStandardOutput c:\sqllog.txt -Wait + regedit -s B:\Automate\DC2\SQLTCP.reg + } elseif (Test-Path "B:\VIM_41\redist\SQLEXPR\x64\SQLEXPR.EXE") { + copy B:\VIM_41\redist\SQLEXPR\x64\SQLEXPR.EXE C:\temp + Write-BuildLog "SQL Server 2005 Express for vCenter 4.1 found; installing." + $Arguments = '/qb INSTANCENAME=SQLExpress ADDLOCAL=ALL SAPWD="VMware1!" SQLACCOUNT="Lab\vi-admin" SQLPASSWORD="' + $AdminPWD + '" AGTACCOUNT="Lab\vi-admin" AGTPASSWORD="' + $AdminPWD + '" SQLBROWSERACCOUNT="Lab\vi-admin" SQLBROWSERPASSWORD="' + $AdminPWD + '" DISABLENETWORKPROTOCOLS=0' + Start-Process C:\temp\SQLEXPR_x64_ENU.exe -ArgumentList $Arguments -Wait + Write-BuildLog "Creating Databases." + Start-Process "C:\Program Files (x86)\Microsoft SQL Server\90\Tools\Binn\sqlcmd.exe" -ArgumentList "-S dc2\SQLEXPRESS -i B:\Automate\DC2\MakeDB41.txt" -RedirectStandardOutput c:\sqllog.txt -Wait; type C:\sqllog.txt | add-content C:\buildlog.txt + regedit -s B:\Automate\DC2\SQLTCP.reg + } else { + $vc5SQL = $false + $vc4SQL = $false + Write-BuildLog "No SQL Express installers found. Please verify that all contents of vCenter ISO are copied into the correct folder on the Build share." + Read-Host "Press <ENTER> to exit" + exit + } +} + +If (([System.Environment]::OSVersion.Version.Major -eq 6) -and ([System.Environment]::OSVersion.Version.Minor -lt 2)) { + Write-BuildLog "Setup IIS on Windows 2008" + Start-Process pkgmgr -ArgumentList '/quiet /l:C:\IIS_Install_Log.txt /iu:IIS-WebServerRole;IIS-WebServer;IIS-CommonHttpFeatures;IIS-StaticContent;IIS-DefaultDocument;IIS-DirectoryBrowsing;IIS-HttpErrors;IIS-HttpRedirect;IIS-ApplicationDevelopment;IIS-ASPNET;IIS-NetFxExtensibility;IIS-ASP;IIS-CGI;IIS-ISAPIExtensions;IIS-ISAPIFilter;IIS-ServerSideIncludes;IIS-HealthAndDiagnostics;IIS-HttpLogging;IIS-LoggingLibraries;IIS-RequestMonitor;IIS-HttpTracing;IIS-CustomLogging;IIS-ODBCLogging;IIS-Security;IIS-BasicAuthentication;IIS-WindowsAuthentication;IIS-DigestAuthentication;IIS-ClientCertificateMappingAuthentication;IIS-IISCertificateMappingAuthentication;IIS-URLAuthorization;IIS-RequestFiltering;IIS-IPSecurity;IIS-Performance;IIS-HttpCompressionStatic;IIS-HttpCompressionDynamic;IIS-WebServerManagementTools;IIS-ManagementConsole;IIS-ManagementScriptingTools;IIS-ManagementService;IIS-IIS6ManagementCompatibility;IIS-Metabase;IIS-WMICompatibility;IIS-LegacyScripts;IIS-LegacySnapIn;IIS-FTPPublishingService;IIS-FTPServer;IIS-FTPManagement;WAS-WindowsActivationService;WAS-ProcessModel;WAS-NetFxEnvironment;WAS-ConfigurationAPI' -Wait + +} +If (([System.Environment]::OSVersion.Version.Major -eq 6) -and ([System.Environment]::OSVersion.Version.Minor -ge 2)) { + Write-BuildLog "Setup IIS on Windows 2012" + import-module servermanager + $null = add-windowsfeature web-server -includeallsubfeature -source D:\Sources\sxs + Import-Module WebAdministration + New-WebBinding -Name "Default Web Site" -IP "*" -Port 443 -Protocol https +} +if (Test-Path B:\sqlmsssetup.exe) { + Rename-Item B:\sqlmsssetup.exe SQLManagementStudio_x64_ENU.exe +} +if (Test-Path B:\SQLManagementStudio_x64_ENU.exe) { + if ( (!(Get-ChildItem B:\SQLManagementStudio_x64_ENU.exe).VersionInfo.ProductVersion -like "10.50.2500*") -and ($vc5SQL -or $vc4SQL)) { + 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." + 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)."} + +Write-BuildLog "Make Win32Time authoritative for NTP time." +reg add HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Config /v AnnounceFlags /t REG_DWORD /d 0x05 /f + +Write-BuildLog "Cleanup and creating Desktop shortcuts." +reg delete HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /v Build /f +wscript B:\Automate\DC2\Shortcuts.vbs + +if (Test-Path B:\Automate\automate.ini) { + $timezone = ((Select-String -SimpleMatch "TZ=" -Path "B:\Automate\automate.ini").line).substring(3) + Write-BuildLog "Setting time zone to $timezone according to automate.ini." + tzutil /s "$timezone" +} + +Write-BuildLog "Installing VMware tools, build complete after reboot." +Write-BuildLog "(Re)build vCenter next." +if ($vmtools) { + Start-Process B:\VMTools\setup64.exe -ArgumentList '/s /v "/qn"' -Verb RunAs -Wait + Start-Sleep -Seconds 30 +} +Read-Host "Press <ENTER> to exit" \ No newline at end of file diff --git a/Build/Automate/DC2/SQLTCP.reg b/Build/Automate/DC2/SQLTCP.reg new file mode 100644 index 0000000..13e112a Binary files /dev/null and b/Build/Automate/DC2/SQLTCP.reg differ diff --git a/Build/Automate/DC2/Shortcuts.vbs b/Build/Automate/DC2/Shortcuts.vbs new file mode 100644 index 0000000..bad884f --- /dev/null +++ b/Build/Automate/DC2/Shortcuts.vbs @@ -0,0 +1,14 @@ +set WshShell = WScript.CreateObject("WScript.Shell") + +set oShortCutLink = WshShell.CreateShortcut("C:\Users\Public\Desktop\BuildLog.lnk") +oShortCutLink.TargetPath = "c:\BuildLog.txt" +oShortCutLink.Save + +set oShortCutLink = WshShell.CreateShortcut("C:\Users\Public\Desktop\Validate.lnk") +oShortCutLink.TargetPath = "%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe" +oShortCutLink.Arguments = " c:\validate.ps1" +oShortCutLink.Save + +set oShortCutLink = WshShell.CreateShortcut("C:\Users\Public\Desktop\Upgrade.lnk") +oShortCutLink.TargetPath = "\\nas\Build\Automate\DC2\Upgrade.cmd" +oShortCutLink.Save diff --git a/Build/Automate/DC2/TFTP-Root/pxelinux.0 b/Build/Automate/DC2/TFTP-Root/pxelinux.0 new file mode 100644 index 0000000..6090484 Binary files /dev/null and b/Build/Automate/DC2/TFTP-Root/pxelinux.0 differ diff --git a/Build/Automate/DC2/TFTP-Root/pxelinux.cfg/CHAIN.C32 b/Build/Automate/DC2/TFTP-Root/pxelinux.cfg/CHAIN.C32 new file mode 100644 index 0000000..5c1a970 Binary files /dev/null and b/Build/Automate/DC2/TFTP-Root/pxelinux.cfg/CHAIN.C32 differ diff --git a/Build/Automate/DC2/TFTP-Root/pxelinux.cfg/ESXi50.menu b/Build/Automate/DC2/TFTP-Root/pxelinux.cfg/ESXi50.menu new file mode 100644 index 0000000..e2d53eb --- /dev/null +++ b/Build/Automate/DC2/TFTP-Root/pxelinux.cfg/ESXi50.menu @@ -0,0 +1,23 @@ +MENU TITLE ESXi 5.0 installs + +LABEL Main Menu + MENU LABEL ^Return to Main Menu + KERNEL pxelinux.cfg/vesamenu.c32 + APPEND pxelinux.cfg/default + +label esx50 + KERNEL /esxi50/mboot.c32 + APPEND -c /esxi50/boot.cfg + MENU LABEL ESXi 5.0 Manual Install + +label esx1-5 + KERNEL /esxi50/mboot.c32 + APPEND -c /esxi50/Besx11-5.cfg + MENU LABEL Host11 Automated Install + +Label ESX2-5 + KERNEL /esxi50/mboot.c32 + APPEND -c /esxi50/Besx12-5.cfg + MENU LABEL Host12 Automated Install + + diff --git a/Build/Automate/DC2/TFTP-Root/pxelinux.cfg/ESXi51.menu b/Build/Automate/DC2/TFTP-Root/pxelinux.cfg/ESXi51.menu new file mode 100644 index 0000000..2aa26f7 --- /dev/null +++ b/Build/Automate/DC2/TFTP-Root/pxelinux.cfg/ESXi51.menu @@ -0,0 +1,22 @@ +MENU TITLE ESXi 5.1 installs + +LABEL Main Menu + MENU LABEL ^Return to Main Menu + KERNEL pxelinux.cfg/vesamenu.c32 + APPEND pxelinux.cfg/default + +label esx51 + KERNEL /esxi51/mboot.c32 + APPEND -c /esxi51/boot.cfg + MENU LABEL ESXi 5.1 Manual Install + +label ESX1-5 + KERNEL /esxi51/mboot.c32 + APPEND -c /esxi51/Besx11-5.cfg + MENU LABEL Host11 Automated Install + +Label ESX2-5 + KERNEL /esxi51/mboot.c32 + APPEND -c /esxi51/Besx12-5.cfg + MENU LABEL Host12 Automated Install + diff --git a/Build/Automate/DC2/TFTP-Root/pxelinux.cfg/ESXi55.menu b/Build/Automate/DC2/TFTP-Root/pxelinux.cfg/ESXi55.menu new file mode 100644 index 0000000..e4fb5e5 --- /dev/null +++ b/Build/Automate/DC2/TFTP-Root/pxelinux.cfg/ESXi55.menu @@ -0,0 +1,22 @@ +MENU TITLE ESXi 5.5 installs + +LABEL Main Menu + MENU LABEL ^Return to Main Menu + KERNEL pxelinux.cfg/vesamenu.c32 + APPEND pxelinux.cfg/default + +label esx55 + KERNEL /esxi55/mboot.c32 + APPEND -c /esxi55/boot.cfg + MENU LABEL ESXi 5.5 Manual Install + +label ESX1-5 + KERNEL /esxi55/mboot.c32 + APPEND -c /esxi55/Besx11-55.cfg + MENU LABEL Host11 Automated Install + +Label ESX2-5 + KERNEL /esxi55/mboot.c32 + APPEND -c /esxi55/Besx12-55.cfg + MENU LABEL Host12 Automated Install + diff --git a/Build/Automate/DC2/TFTP-Root/pxelinux.cfg/VESAMENU.C32 b/Build/Automate/DC2/TFTP-Root/pxelinux.cfg/VESAMENU.C32 new file mode 100644 index 0000000..e78983d Binary files /dev/null and b/Build/Automate/DC2/TFTP-Root/pxelinux.cfg/VESAMENU.C32 differ diff --git a/Build/Automate/DC2/TFTP-Root/pxelinux.cfg/default b/Build/Automate/DC2/TFTP-Root/pxelinux.cfg/default new file mode 100644 index 0000000..6c88ab2 --- /dev/null +++ b/Build/Automate/DC2/TFTP-Root/pxelinux.cfg/default @@ -0,0 +1,23 @@ +menu title AutoLab PXE Menu +menu tabmsgrow 22 +menu cmdlinerow 22 +menu endrow 24 + +menu color title 1;34;49 #eea0a0ff #cc333355 std +menu color sel 7;37;40 #ff000000 #bb9999aa all +menu color border 30;44 #ffffffff #00000000 std +menu color pwdheader 31;47 #eeff1010 #20ffffff std +menu color hotkey 35;40 #90ffff00 #00000000 std +menu color hotsel 35;40 #90000000 #bb9999aa all +menu color timeout_msg 35;40 #90ffffff #00000000 none +menu color timeout 31;47 #eeff1010 #00000000 none + +prompt 0 +noescape 1 +timeout 300 +default pxelinux.cfg/vesamenu.c32 + +label localboot + menu label Boot local hard disk + kernel pxelinux.cfg/chain.c32 + append hd0 0 diff --git a/Build/Automate/DC2/TFTP-Root/pxelinux.cfg/memdisk b/Build/Automate/DC2/TFTP-Root/pxelinux.cfg/memdisk new file mode 100644 index 0000000..39a3841 Binary files /dev/null and b/Build/Automate/DC2/TFTP-Root/pxelinux.cfg/memdisk differ diff --git a/Build/Automate/DC2/TFTP-Root/pxelinux.cfg/reboot.c32 b/Build/Automate/DC2/TFTP-Root/pxelinux.cfg/reboot.c32 new file mode 100644 index 0000000..4f35770 Binary files /dev/null and b/Build/Automate/DC2/TFTP-Root/pxelinux.cfg/reboot.c32 differ diff --git a/Build/Automate/DC2/Tftpd64_SE/EUPL-EN.pdf b/Build/Automate/DC2/Tftpd64_SE/EUPL-EN.pdf new file mode 100644 index 0000000..51f9b2d Binary files /dev/null and b/Build/Automate/DC2/Tftpd64_SE/EUPL-EN.pdf differ diff --git a/Build/Automate/DC2/Tftpd64_SE/Tftpd64_SE-uninstall.exe b/Build/Automate/DC2/Tftpd64_SE/Tftpd64_SE-uninstall.exe new file mode 100644 index 0000000..3742bdf Binary files /dev/null and b/Build/Automate/DC2/Tftpd64_SE/Tftpd64_SE-uninstall.exe differ diff --git a/Build/Automate/DC2/Tftpd64_SE/license-tftpd32_SE.txt b/Build/Automate/DC2/Tftpd64_SE/license-tftpd32_SE.txt new file mode 100644 index 0000000..6062bd4 --- /dev/null +++ b/Build/Automate/DC2/Tftpd64_SE/license-tftpd32_SE.txt @@ -0,0 +1 @@ +TFTPD32 is copyrighted 1998-2011 by Philippe Jounin (philippe@jounin.net) and released under the European Union Public License (see file EUPL-EN.pdf). diff --git a/Build/Automate/DC2/Tftpd64_SE/tftpd32.chm b/Build/Automate/DC2/Tftpd64_SE/tftpd32.chm new file mode 100644 index 0000000..784ead6 Binary files /dev/null and b/Build/Automate/DC2/Tftpd64_SE/tftpd32.chm differ diff --git a/Build/Automate/DC2/Tftpd64_SE/tftpd32.ini b/Build/Automate/DC2/Tftpd64_SE/tftpd32.ini new file mode 100644 index 0000000..2bde69a --- /dev/null +++ b/Build/Automate/DC2/Tftpd64_SE/tftpd32.ini @@ -0,0 +1,37 @@ +[DHCP] +Lease_NumLeases=0 +[TFTPD32] +BaseDirectory=C:\TFTP-Root +TftpPort=69 +Hide=0 +WinSize=0 +Negociate=1 +PXECompatibility=0 +DirText=0 +ShowProgressBar=1 +Timeout=3 +MaxRetransmit=6 +SecurityLevel=1 +UnixStrings=1 +Beep=0 +VirtualRoot=0 +MD5=0 +LocalIP= +Services=1 +TftpLogFile= +SaveSyslogFile= +PipeSyslogMsg=0 +LowestUDPPort=0 +HighestUDPPort=0 +MulticastPort=0 +MulticastAddress= +PersistantLeases=1 +DHCP Ping=1 +DHCP LocalIP= +Max Simultaneous Transfers=100 +UseEventLog=0 +Console Password=tftpd32 +Support for port Option=0 +Keep transfer Gui=5 +Ignore ack for last TFTP packet=0 +Enable IPv6=0 diff --git a/Build/Automate/DC2/Tftpd64_SE/tftpd64_gui.exe b/Build/Automate/DC2/Tftpd64_SE/tftpd64_gui.exe new file mode 100644 index 0000000..5d5c4ac Binary files /dev/null and b/Build/Automate/DC2/Tftpd64_SE/tftpd64_gui.exe differ diff --git a/Build/Automate/DC2/Tftpd64_SE/tftpd64_svc.exe b/Build/Automate/DC2/Tftpd64_SE/tftpd64_svc.exe new file mode 100644 index 0000000..7abbbe7 Binary files /dev/null and b/Build/Automate/DC2/Tftpd64_SE/tftpd64_svc.exe differ diff --git a/Build/Automate/Gateway.ps1 b/Build/Automate/Gateway.ps1 new file mode 100644 index 0000000..b44c172 --- /dev/null +++ b/Build/Automate/Gateway.ps1 @@ -0,0 +1,6 @@ +$NICs = Get-WmiObject -Class Win32_NetworkAdapterConfiguration -Filter "IPEnabled=TRUE" +$Null = $NICs.SetGateways("192.168.199.2") +$NICs = Get-WmiObject -Class Win32_NetworkAdapterConfiguration -Filter "IPEnabled=TRUE" +Write-Host "Added gateway. " +Write-Host "Make sure the lab Router VM is running. " +Read-Host "Press <Enter> to exit" \ No newline at end of file diff --git a/Build/Automate/Hosts/esx-tools-for-esxi-9.7.1-0.0.00000.i386.vib b/Build/Automate/Hosts/esx-tools-for-esxi-9.7.1-0.0.00000.i386.vib new file mode 100644 index 0000000..479b07a Binary files /dev/null and b/Build/Automate/Hosts/esx-tools-for-esxi-9.7.1-0.0.00000.i386.vib differ diff --git a/Build/Automate/Hosts/esx1-4.cfg b/Build/Automate/Hosts/esx1-4.cfg new file mode 100644 index 0000000..8f41987 --- /dev/null +++ b/Build/Automate/Hosts/esx1-4.cfg @@ -0,0 +1,6 @@ +vmaccepteula +rootpw VMware1! +autopart --firstdisk --overwritevmfs +install nfs --server=192.168.199.7 --dir=/mnt/LABVOL/Build/ESXi41 +network --device=vmnic0 --bootproto=static --ip=192.168.199.11 --gateway=192.168.199.2 --nameserver=192.168.199.4 --netmask=255.255.255.0 --hostname=host1.lab.local --addvmportgroup=1 +reboot \ No newline at end of file diff --git a/Build/Automate/Hosts/esx1-5.cfg b/Build/Automate/Hosts/esx1-5.cfg new file mode 100644 index 0000000..d4c60a7 --- /dev/null +++ b/Build/Automate/Hosts/esx1-5.cfg @@ -0,0 +1,11 @@ +vmaccepteula +rootpw VMware1! +install --firstdisk --overwritevmfs +network --bootproto=static --ip=192.168.199.11 --gateway=192.168.199.2 --nameserver=192.168.199.4 --netmask=255.255.255.0 --hostname=host1.lab.local --device=vmnic0 --addvmportgroup=1 +reboot + +%firstboot --interpreter=busybox +esxcli storage nmp satp rule add --satp VMW_SATP_LOCAL --device mpx.vmhba1:C0:T1:L0 --option "enable_ssd" +esxcfg-nas -a -o 192.168.199.7 -s /mnt/LABVOL/Build Build +esxcli software vib install -v /vmfs/volumes/Build/Automate/Hosts/esx-tools-for-esxi-9.7.1-0.0.00000.i386.vib -f +echo 'vmx.allowNested = "TRUE"' >> /etc/vmware/config \ No newline at end of file diff --git a/Build/Automate/Hosts/esx11-5.cfg b/Build/Automate/Hosts/esx11-5.cfg new file mode 100644 index 0000000..dd596e3 --- /dev/null +++ b/Build/Automate/Hosts/esx11-5.cfg @@ -0,0 +1,10 @@ +vmaccepteula +rootpw VMware1! +install --firstdisk --overwritevmfs +network --bootproto=static --ip=192.168.201.11 --gateway=192.168.201.2 --nameserver=192.168.201.4 --netmask=255.255.255.0 --hostname=host11.lab.local --device=vmnic0 --addvmportgroup=1 +reboot + +%firstboot --interpreter=busybox +esxcfg-nas -a -o 192.168.199.7 -s /mnt/LABVOL/Build Build +esxcli software vib install -v /vmfs/volumes/Build/Automate/Hosts/esx-tools-for-esxi-9.7.1-0.0.00000.i386.vib -f +echo 'vmx.allowNested = "TRUE"' >> /etc/vmware/config diff --git a/Build/Automate/Hosts/esx12-5.cfg b/Build/Automate/Hosts/esx12-5.cfg new file mode 100644 index 0000000..c1e8b0d --- /dev/null +++ b/Build/Automate/Hosts/esx12-5.cfg @@ -0,0 +1,10 @@ +vmaccepteula +rootpw VMware1! +install --firstdisk --overwritevmfs +network --bootproto=static --ip=192.168.201.12 --gateway=192.168.201.2 --nameserver=192.168.201.4 --netmask=255.255.255.0 --hostname=host12.lab.local --device=vmnic0 --addvmportgroup=1 +reboot + +%firstboot --interpreter=busybox +esxcfg-nas -a -o 192.168.199.7 -s /mnt/LABVOL/Build Build +esxcli software vib install -v /vmfs/volumes/Build/Automate/Hosts/esx-tools-for-esxi-9.7.1-0.0.00000.i386.vib -f +echo 'vmx.allowNested = "TRUE"' >> /etc/vmware/config diff --git a/Build/Automate/Hosts/esx2-4.cfg b/Build/Automate/Hosts/esx2-4.cfg new file mode 100644 index 0000000..a8c4044 --- /dev/null +++ b/Build/Automate/Hosts/esx2-4.cfg @@ -0,0 +1,6 @@ +vmaccepteula +rootpw VMware1! +autopart --firstdisk --overwritevmfs +install nfs --server=192.168.199.7 --dir=/mnt/LABVOL/Build/ESXi41 +network --device=vmnic0 --bootproto=static --ip=192.168.199.12 --gateway=192.168.199.2 --nameserver=192.168.199.4 --netmask=255.255.255.0 --hostname=host2.lab.local --addvmportgroup=1 +reboot \ No newline at end of file diff --git a/Build/Automate/Hosts/esx2-4c.cfg b/Build/Automate/Hosts/esx2-4c.cfg new file mode 100644 index 0000000..13de3c0 --- /dev/null +++ b/Build/Automate/Hosts/esx2-4c.cfg @@ -0,0 +1,29 @@ +#root Password +rootpw VMware1! +# Authconfig +# authconfig --enableshadow --enablemd5 +# BootLoader (Use grub by default.) +bootloader --location=mbr +# Timezone +timezone America/Los_Angeles +#Install +install nfs --server=192.168.199.7 --dir=/mnt/LABVOL/Build/ESX41 +#Network install type +network --bootproto=static --ip=192.168.199.12 --gateway=192.168.199.2 --nameserver=192.168.199.4 --netmask=255.255.255.0 --hostname=host2.lab.local --device=vmnic0 --addvmportgroup=1 +#Keyboard +keyboard us +#Reboot after install? +reboot +# Clear partitions +clearpart --firstdisk --overwritevmfs +# Partitioning +part /boot --fstype=ext3 --size=1200 --onfirstdisk +part storage1 --fstype=vmfs3 --size=10000 --grow --onfirstdisk +part None --fstype=vmkcore --size=100 --onfirstdisk +# Create the vmdk on the cos vmfs partition. +virtualdisk cos --size=5000 --onvmfs=storage1 +# Partition the virtual disk. +part / --fstype=ext3 --size=3600 --grow --onvirtualdisk=cos +part swap --fstype=swap --size=256 --onvirtualdisk=cos +#VMware Specific Commands +accepteula \ No newline at end of file diff --git a/Build/Automate/Hosts/esx2-5.cfg b/Build/Automate/Hosts/esx2-5.cfg new file mode 100644 index 0000000..d543e6b --- /dev/null +++ b/Build/Automate/Hosts/esx2-5.cfg @@ -0,0 +1,11 @@ +vmaccepteula +rootpw VMware1! +install --firstdisk --overwritevmfs +network --bootproto=static --ip=192.168.199.12 --gateway=192.168.199.2 --nameserver=192.168.199.4 --netmask=255.255.255.0 --hostname=host2.lab.local --device=vmnic0 --addvmportgroup=1 +reboot + +%firstboot --interpreter=busybox +esxcli storage nmp satp rule add --satp VMW_SATP_LOCAL --device mpx.vmhba1:C0:T1:L0 --option "enable_ssd" +esxcfg-nas -a -o 192.168.199.7 -s /mnt/LABVOL/Build Build +esxcli software vib install -v /vmfs/volumes/Build/Automate/Hosts/esx-tools-for-esxi-9.7.1-0.0.00000.i386.vib -f +echo 'vmx.allowNested = "TRUE"' >> /etc/vmware/config \ No newline at end of file diff --git a/Build/Automate/Hosts/esx3-5.cfg b/Build/Automate/Hosts/esx3-5.cfg new file mode 100644 index 0000000..cd0b823 --- /dev/null +++ b/Build/Automate/Hosts/esx3-5.cfg @@ -0,0 +1,11 @@ +vmaccepteula +rootpw VMware1! +install --firstdisk --overwritevmfs +network --bootproto=static --ip=192.168.199.13 --gateway=192.168.199.2 --nameserver=192.168.199.4 --netmask=255.255.255.0 --hostname=host3.lab.local --device=vmnic0 --addvmportgroup=1 +reboot + +%firstboot --interpreter=busybox +esxcli storage nmp satp rule add --satp VMW_SATP_LOCAL --device mpx.vmhba1:C0:T1:L0 --option "enable_ssd" +esxcfg-nas -a -o 192.168.199.7 -s /mnt/LABVOL/Build Build +esxcli software vib install -v /vmfs/volumes/Build/Automate/Hosts/esx-tools-for-esxi-9.7.1-0.0.00000.i386.vib -f +echo 'vmx.allowNested = "TRUE"' >> /etc/vmware/config \ No newline at end of file diff --git a/Build/Automate/Hosts/esx4-5.cfg b/Build/Automate/Hosts/esx4-5.cfg new file mode 100644 index 0000000..1f3bcba --- /dev/null +++ b/Build/Automate/Hosts/esx4-5.cfg @@ -0,0 +1,11 @@ +vmaccepteula +rootpw VMware1! +install --firstdisk --overwritevmfs +network --bootproto=static --ip=192.168.199.14 --gateway=192.168.199.2 --nameserver=192.168.199.4 --netmask=255.255.255.0 --hostname=host4.lab.local --device=vmnic0 --addvmportgroup=1 +reboot + +%firstboot --interpreter=busybox +esxcli storage nmp satp rule add --satp VMW_SATP_LOCAL --device mpx.vmhba1:C0:T1:L0 --option "enable_ssd" +esxcfg-nas -a -o 192.168.199.7 -s /mnt/LABVOL/Build Build +esxcli software vib install -v /vmfs/volumes/Build/Automate/Hosts/esx-tools-for-esxi-9.7.1-0.0.00000.i386.vib -f +echo 'vmx.allowNested = "TRUE"' >> /etc/vmware/config diff --git a/Build/Automate/NewCluster.ps1 b/Build/Automate/NewCluster.ps1 new file mode 100644 index 0000000..9f37129 --- /dev/null +++ b/Build/Automate/NewCluster.ps1 @@ -0,0 +1,90 @@ +# Script to add add ESX servers to vCenter and do initial configuration +# +# +# Version 0.8 +# +# +. "C:\PSFunctions.ps1" +If (Test-Administrator){ + Write-host " " + Write-Host "This script should not be 'Run As Administrator'" -foregroundcolor "Red" + Write-host " " + Write-Host "Just double click the shortcut" -foregroundcolor "Red" + Write-host " " + Exit +} +if ( (Get-PSSnapin -Name VMware.VimAutomation.Core -ErrorAction SilentlyContinue) -eq $null ) +{ + try { + Write-Host "Loading PowerCLI plugin, this will take a little while" -foregroundcolor "cyan" + Add-PsSnapin VMware.VimAutomation.Core + } + catch { + Write-Host "Unable to load the PowerCLI plugin. Please verify installation and run this script again." + exit +} +for ($i=1;$i -le 2; $i++){ + $vmhost = "host$i.lab.local" + $ping = new-object System.Net.NetworkInformation.Ping + $Reply = $ping.send($vmhost) + if ($Reply.status –ne "Success") { + Write-Host $vmhost " not responding to ping, exiting" -foregroundcolor "red" + Write-Host "Re-run this script when both ESXi hosts are running" -foregroundcolor "red" + Read-Host "Press <ENTER> to exit." + exit + } +} +Write-Host " " +$Null = connect-viserver vc.lab.local +Write-Host "Create Datacenter and Cluster" -foregroundcolor "green" +if ((Get-DataCenter | where {$_.Name -eq "Lab"}) -eq $Null) { + $Null = New-DataCenter -Location (Get-Folder -NoRecursion) -Name Lab +} +if ((Get-Cluster | where {$_.Name -eq "local"}) -eq $Null) { + $Cluster = New-Cluster Local -DRSEnabled -Location Lab -DRSAutomationLevel PartiallyAutomated +} + +for ($i=1;$i -le 2; $i++){ + $Num = $i +10 + $VMHost = "host" + $VMHost += $i + $VMHost += ".lab.local" + $VMotionIP = "172.16.199." + $VMotionIP += $Num + $IPStoreIP1 = "172.17.199." + $IPStoreIP1 += $Num + $IPStoreIP2 = "172.17.199." + $Num = $i +20 + $IPStoreIP2 += $Num + $FTIP = "172.16.199." + $FTIP += $Num + $Num = $i +40 + $vHeartBeatIP = "172.16.199." + $vHeartBeatIP += $Num + Write-Host $VMHost -foregroundcolor "cyan" + if ((Get-VMHost | where {$_.Name -eq $VMHost}) -eq $Null) { + $VMHostObj = add-vmhost $VMhost -user root -password VMware1! -Location Lab -force:$true + If ($VMHostObj.ConnectionState -ne "Connected"){ + Write-Host " " + Write-Host "Connecting " $VMHost " has failed, is the ESXi server built?" -foregroundcolor "red" + Write-Host " " + exit + } + $Null = Move-VMhost $VMHost -Destination Local + } +} + +Write-Host "Setup HA on Cluster, now that we have shared storage" -foregroundcolor "Green" +$Cluster = Get-Cluster -Name "Local" +$null = set-cluster -cluster $Cluster -HAEnabled:$True -HAAdmissionControlEnabled:$True -confirm:$False +$null = New-AdvancedSetting -Entity $cluster -Type ClusterHA -Name 'das.isolationaddress1' -Value "192.168.199.4" -confirm:$False -force +$null = New-AdvancedSetting -Entity $cluster -Type ClusterHA -Name 'das.usedefaultisolationaddress' -Value false -confirm:$False -force +$spec = New-Object VMware.Vim.ClusterConfigSpecEx +$Null = $spec.dasConfig = New-Object VMware.Vim.ClusterDasConfigInfo +$Null = $spec.dasConfig.admissionControlPolicy = New-Object VMware.Vim.ClusterFailoverResourcesAdmissionControlPolicy +$Null = $spec.dasConfig.admissionControlPolicy.cpuFailoverResourcesPercent = 50 +$Null = $spec.dasConfig.admissionControlPolicy.memoryFailoverResourcesPercent = 50 +$Cluster = Get-View $Cluster +$Null = $Cluster.ReconfigureComputeResource_Task($spec, $true) +Write-Host " " +$Null = Disconnect-VIServer -Server * -confirm:$False diff --git a/Build/Automate/PSFunctions.ps1 b/Build/Automate/PSFunctions.ps1 new file mode 100644 index 0000000..dc4d524 --- /dev/null +++ b/Build/Automate/PSFunctions.ps1 @@ -0,0 +1,212 @@ +# Functions used in AutoLab PowerShell scripts +# +# +# Version 2.6 +# + +# This Function from the PowerCLI Blog +# http://blogs.vmware.com/vipowershell/2009/08/how-to-list-datastores-that-are-on-shared-storage.html +# + +function Write-BuildLog { + param([string]$message) + if (!(Test-Path C:\Buildlog.txt)) { + New-Item -Path C:\Buildlog.txt -ItemType File + } + Write-Host $message + $message | Out-File C:\BuildLog.txt -Encoding Default -append +} + +function Get-ShareableDatastore { + # Get all datastores. + $datastores = Get-Datastore + + # Load the HostStorageSystems of all hosts. + $hosts = Get-VMHost | Get-View -property ConfigManager + $storageSystems = @() + foreach ($h in $hosts) { + $sdi = Get-View $h.ConfigManager.StorageSystem -Property StorageDeviceInfo + Write-Debug ("GSD: SDI for host $h is " + $sdi) + $storageSystems += $sdi + } + + foreach ($dso in $datastores) { + $ds = $dso | Get-View -Property Info + + # Check if this datastore is NFS. + $dsInfo = $ds.Info + Write-Debug ("GSD: Is it NFS? " + $dsInfo.getType()) + if ($dsInfo -is [VMware.Vim.NasDatastoreInfo]) { + Write-Output $dso + continue + } + + # Get the first extent of the datastore. + $firstExtent = $dsInfo.Vmfs.Extent[0] + Write-Debug ("GSD: first extent: " + $firstExtent.DiskName) + + # Find a host that maps this LUN. + foreach ($hss in $storageSystems) { + $lun = $hss.StorageDeviceInfo.ScsiLun | Where {$_.CanonicalName -eq $firstExtent.DiskName } + + if ($lun) { + Write-Debug ("GSD: found " + $lun.DeviceName + " on " + $hss.MoRef.Value) + Write-Debug ("GSD: LUN details: Name:" + $lun.DisplayName + ", Type:" + $lun.DeviceType + ", Vendor:" + $lun.Vendor + ", Model:" + $lun.Model) + + # Search the adapter topology of this host, looking for the LUN. + $adapterTopology = $hss.StorageDeviceInfo.ScsiTopology.Adapter | + Where {$_.Target | + Where {$_.Lun | + Where {$_.ScsiLun -eq $lun.key } + } + } | Select -First 1 + + # We've found a host that has this LUN. Find how it maps to an adapter. + $adapter = $hss.StorageDeviceInfo.HostBusAdapter | Where {$_.Key -eq $adapterTopology.Adapter } + Write-Debug ("GSD: HBA type is: " + $adapter.getType()) + + # It's shared if it's Fibre Channel or iSCSI (we checked for NFS earlier) + if ($adapter -is [VMware.Vim.HostFibreChannelHba] -or $adapter -is [VMware.Vim.HostInternetScsiHba]) { + Write-Debug "GSO: $dso is sharable" + Write-Output $dso + } + + # Otherwise it's not shared and we quit walking through hosts. + break + } + } + } +} + +Function Check-File ($a, $b) { + if (test-Path $a) { + Write-Host ($b + " found.") -foregroundcolor "green" + } else { + Write-Host ($b + " missing.") -foregroundcolor "red" + $Global:Pass = $False + } +} + +Function Check-OptionalFile ($a, $b) { + if (test-Path $a) { + Write-Host ($b + " found.") -foregroundcolor "green" + } else { + Write-Host ($b + " missing.") -foregroundcolor "Yellow" + } +} + +Function Check-ServiceRunning ($a) { + $SVC = Get-Service -name $a -ErrorAction "SilentlyContinue" + if ($SVC.Status -eq "Running") { + Write-Host ("Service " + $a + " running.") -foregroundcolor "green" + } else { + Write-Host ("Service " + $a + " not running.") -foregroundcolor "red" + $Global:Pass = $False + } +} + +Function Check-DNSRecord ($a) { + $FWDIP = "" + $ErrorActionPreference = "silentlycontinue" + $FWDIP = [System.Net.Dns]::GetHostAddresses($a) + $ErrorActionPreference = "continue" + if ($FWDIP -eq "") { + Write-Host ("No DNS for " + $a ) -foregroundcolor "red" + $Global:Pass = $False + } else { + Write-Host ("DNS OK for " + $a) -foregroundcolor "green" + } +} + +function Test-Administrator { + $user = [Security.Principal.WindowsIdentity]::GetCurrent(); + (New-Object Security.Principal.WindowsPrincipal $user).IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator) +} + +# +# This section from Luc Dekens http://www.lucd.info/2011/08/11/vmx-raiders-revisited/ +# +Function Register-VMs ($a){ + # Collect .vmx paths of registered VMs on the datastore + $registered = @{} + $Datastore = Get-Datastore -name $a + Get-VM -Datastore $Datastore | %{$_.Extensiondata.LayoutEx.File | where {$_.Name -like "*.vmx"} | %{$registered.Add($_.Name,$true)}} + # Set up Search for .VMX Files in Datastore + New-PSDrive -Name TgtDS -Location $Datastore -PSProvider VimDatastore -Root '\' | Out-Null + $unregistered = @(Get-ChildItem -Path TgtDS: -Recurse | where {$_.FolderPath -notmatch ".snapshot" -and $_.Name -like "*.vmx" -and !$registered.ContainsKey($_.DatastoreFullPath)}) + Remove-PSDrive -Name TgtDS + #Register all .vmx Files as VMs on the datastore + foreach($VMXFile in $unregistered) {$null= New-VM -VMFilePath $VMXFile.DatastoreFullPath -VMHost $vmhost -Location "vm" -RunAsync} +} + +# +# This section from dEPLOYMENT gUYS BLOG http://blogs.technet.com/b/deploymentguys/archive/2010/07/15/reading-and-modifying-ini-files-with-scripts.aspx +# + +function Convert-IniFile ($file) { + $REGEX_INI_COMMENT_STRING = ";" + $REGEX_INI_SECTION_HEADER = "^\s*(?!$($REGEX_INI_COMMENT_STRING))\s*\[\s*(.*[^\s*])\s*]\s*$" + $REGEX_INI_KEY_VALUE_LINE = "^\s*(?!$($REGEX_INI_COMMENT_STRING))\s*([^=]*)\s*=\s*(.*)\s*$" + + $ini = @{} + switch -regex -file $file { + "$($REGEX_INI_SECTION_HEADER)" { + $section = $matches[1] + $ini[$section] = @{} + } + "$($REGEX_INI_KEY_VALUE_LINE)" { + $name,$value = $matches[1..2] + if ($name -ne $null -and $section -ne $null) + {$ini[$section][$name] = $value } + } + } + $ini +} + +#Menu selection from http://poshtips.com/2011/09/03/howto-make-menus-in-powershell/ +function isNumeric ($x) { + $x2 = 0 + $isNum = [System.Int32]::TryParse($x, [ref]$x2) + return $isNum +} +function SelectFromList { + param([string[]]$List,[string]$Title="Choices",[switch]$verbose=$false) + Write-Host $Title.padright(80) -back green -fore black + $digits = ([string]$List.length).length + $fmt = "{0,$digits}" + #display selection list + for ($LN=0; $LN -lt $List.length) { + Write-Host (" $fmt $($List[$LN])" -f ++$ln) + Write-Host " " + } + #query user until valid selection is made + do { + Write-Host (" Please select from list (1 to {0}) or `"q`" to quit" -f ($list.length)) -back black -fore green -nonewline + $sel = read-host " " + if ($sel -eq "q") { + Write-Host " quitting selection per user request..." -back black -fore yellow + Exit + } elseif (isNumeric $sel) { + if (([int]$sel -gt 0) -and ([int]$sel -le $list.length)) { + if ($verbose) { + Write-Host (" You selected item #{0} ({1})" -f $sel,$List[$sel-1]) -back black -fore green} + } else { + $sel = $null + } + } + else {$sel = $null} + } until ($sel) + + if (isNumeric $sel) { + $sel -1 + } else { + $null + } +} + +Function Get-VMPlatform ($VMType) { +If ((Get-WmiObject Win32_BIOS).Manufacturer.Tolower() -like "bochs*") {$VMType = "Ravello"} +Elseif ((Get-WmiObject Win32_BIOS).Serialnumber.Tolower() -like "vmware*") {$VMType = "VMware"} +Else {$VMType = "Unknown"} +return $VMType +} \ No newline at end of file diff --git a/Build/Automate/PXEMenuConfig.ps1 b/Build/Automate/PXEMenuConfig.ps1 new file mode 100644 index 0000000..10794cc --- /dev/null +++ b/Build/Automate/PXEMenuConfig.ps1 @@ -0,0 +1,161 @@ +<# +.SYNOPSIS + Customizes AutoLab PXE boot menu based on the vSphere and vCloud source files added to TFTP. +.DESCRIPTION + Customizes AutoLab PXE boot menu based on the vSphere and vCloud source files added to TFTP. +.PARAMETER Version + The Version parameter tells the script which PXE boot options to add to the PXE default menu. +.EXAMPLE + C:\PS> PXEMenuConfig.ps1 ESXi51 +.EXAMPLE + C:\PS> PXEMenuConfig.ps1 ESXi50 +.EXAMPLE + C:\PS> PXEMenuConfig.ps1 ESXi41 +.EXAMPLE + C:\PS> PXEMenuConfig.ps1 ESX41 +.EXAMPLE + C:\PS> PXEMenuConfig.ps1 vCloud +#> + +param($version) + +. "C:\PSFunctions.ps1" + +switch ($version) { + ESXi60 { + if ((Test-Path "C:\TFTP-Root\ESXi60\*") -and (!(Get-Content "C:\TFTP-Root\pxelinux.cfg\default" | Select-String -Pattern "ESXi 6.0"))) { + Add-Content -Path "C:\buildlog.txt" -Value "Adding ESXi 6.0 option to PXE menu" + Add-Content -Path "C:\TFTP-Root\pxelinux.cfg\default" -Value @" + +LABEL Fixes Menu + MENU LABEL ESXi 6.0 automated builds + KERNEL pxelinux.cfg/menu.c32 + APPEND pxelinux.cfg/ESXi60.menu +"@ + } else { + Write-BuildLog "ESXi 5.5 already in PXE Menu" + } + } + ESXi55 { + if ((Test-Path "C:\TFTP-Root\ESXi55\*") -and (!(Get-Content "C:\TFTP-Root\pxelinux.cfg\default" | Select-String -Pattern "ESXi 5.5"))) { + Add-Content -Path "C:\buildlog.txt" -Value "Adding ESXi 5.5 option to PXE menu" + Add-Content -Path "C:\TFTP-Root\pxelinux.cfg\default" -Value @" + +LABEL Fixes Menu + MENU LABEL ESXi 5.5 automated builds + KERNEL pxelinux.cfg/menu.c32 + APPEND pxelinux.cfg/ESXi55.menu +"@ + } else { + Write-BuildLog "ESXi 5.5 already in PXE Menu" + } + } + ESXi51 { + if ((Test-Path "C:\TFTP-Root\ESXi51\*") -and (!(Get-Content "C:\TFTP-Root\pxelinux.cfg\default" | Select-String -Pattern "ESXi 5.1"))) { + Add-Content -Path "C:\buildlog.txt" -Value "Adding ESXi 5.1 option to PXE menu" + Add-Content -Path "C:\TFTP-Root\pxelinux.cfg\default" -Value @" + +LABEL Fixes Menu + MENU LABEL ESXi 5.1 automated builds + KERNEL pxelinux.cfg/menu.c32 + APPEND pxelinux.cfg/ESXi51.menu +"@ + } else { + Write-BuildLog "ESXi 5.1 already in PXE Menu" + } + } + ESXi50 { + if ((Test-Path "C:\TFTP-Root\ESXi50\*") -and (!(Get-Content "C:\TFTP-Root\pxelinux.cfg\default" | Select-String -Pattern "ESXi 5.0"))) { + Add-Content -Path "C:\buildlog.txt" -Value "Adding ESXi 5.0 option to PXE menu" + Add-Content -Path "C:\TFTP-Root\pxelinux.cfg\default" -Value @" + +LABEL Fixes Menu + MENU LABEL ESXi 5.0 automated builds + KERNEL pxelinux.cfg/menu.c32 + APPEND pxelinux.cfg/ESXi50.menu +"@ + } + } + ESXi41 { + if (Test-Path "C:\TFTP-Root\ESXi41\*") { + Add-Content -Path "C:\buildlog.txt" -Value "Adding ESXi 4.1 option to PXE menu" + Add-Content -Path "C:\TFTP-Root\pxelinux.cfg\default" -Value @" + +LABEL Fixes Menu + MENU LABEL ESXi 4.1 automated builds + KERNEL pxelinux.cfg/menu.c32 + APPEND pxelinux.cfg/ESXi41.menu +"@ + Add-Content -Path "C:\TFTP-Root\pxelinux.cfg\ESXi41.menu" -Value @" + +label esxi1-4 + kernel /ESXi41/mboot.c32 + append /ESXi41/vmkboot.gz ks=nfs://192.168.199.7/mnt/LABVOL/Build/Automate/Hosts/esx1-4.cfg --- /ESXi41/vmkernel.gz --- /ESXi41/sys.vgz --- /ESXi41/cim.vgz --- /ESXi41/ienviron.vgz --- /ESXi41/install.vgz + menu Label -- Host1 Automated + +label esxi2-4 + kernel /ESXi41/mboot.c32 + append /ESXi41/vmkboot.gz ks=nfs://192.168.199.7/mnt/LABVOL/Build/Automate/Hosts/esx2-4.cfg --- /ESXi41/vmkernel.gz --- /ESXi41/sys.vgz --- /ESXi41/cim.vgz --- /ESXi41/ienviron.vgz --- /ESXi41/install.vgz + menu Label -- Host2 ESXi Automated +"@ + } + } + ESX41 { + if ((Test-Path "C:\TFTP-Root\ESX41\*") -and (!(Get-Content "C:\TFTP-Root\pxelinux.cfg\ESXi41.menu" | Select-String -Pattern "ESX classic"))) { + Add-Content -Path "C:\buildlog.txt" -Value "Adding ESX 4.1 option to PXE menu" + Add-Content -Path "C:\TFTP-Root\pxelinux.cfg\ESXi41.menu" -Value @" + +label esx2-4 + kernel /ESX41/vmlinuz + append initrd=/ESX41/initrd.img debugLogToSerial=1 mem=512M ks=nfs:192.168.199.7:/mnt/LABVOL/Build/Automate/Hosts/esx2-4c.cfg + menu Label -- Host2 ESX classic Automated +"@ + } + } + vCloud { + if (!(Get-Content "C:\TFTP-Root\pxelinux.cfg\default" | Select-String -Pattern "vCloud") ) { + Add-Content -Path "C:\buildlog.txt" -Value "Adding vCloud option to PXE menu" + Add-Content -Path "C:\TFTP-Root\pxelinux.cfg\default" -Value @" + +LABEL Fixes Menu + MENU LABEL vCloud Director automated build + KERNEL pxelinux.cfg/menu.c32 + APPEND pxelinux.cfg/vCloud.menu +"@ + } + } + vCD51 { + if ((Test-Path "B:\vCD_51\*") -and (!(Get-Content "C:\TFTP-Root\pxelinux.cfg\vCloud.menu" | Select-String -Pattern "vCloud Director 5.1"))){ + Add-Content -Path "C:\buildlog.txt" -Value "Adding vCloud 5.1 option to PXE menu" + Add-Content -Path "C:\TFTP-Root\pxelinux.cfg\vCloud.menu" -Value @" + +label vCloud51 + kernel /vCloud/vmlinuz + append ksdevice=eth0 load_ramdisk=1 initrd=/vCloud/initrd.img network ks=nfs:nfsvers=3:192.168.199.7:/mnt/LABVOL/Build/Automate/vCloud/vcd51-ks.cfg + menu Label vCloud Director 5.1 automated build (DVD iso) + +label vCloud51 + kernel /vCloud/vmlinuz + append ksdevice=eth0 load_ramdisk=1 initrd=/vCloud/initrd.img network ks=nfs:nfsvers=3:192.168.199.7:/mnt/LABVOL/Build/Automate/vCloud/vcd51-ks-min.cfg + menu Label vCloud Director 5.1 automated build (minimal ISO) +"@ + } + } + vCD15 { + if ((Test-Path "B:\vCD_15\*") -and (!(Get-Content "C:\TFTP-Root\pxelinux.cfg\vCloud.menu" | Select-String -Pattern "vCloud Director 1.5"))){ + Add-Content -Path "C:\buildlog.txt" -Value "Adding vCloud 1.5 option to PXE menu" + Add-Content -Path "C:\TFTP-Root\pxelinux.cfg\vCloud.menu" -Value @" + +label vCloud15 + kernel /vCloud/vmlinuz + append ksdevice=eth0 load_ramdisk=1 initrd=/vCloud/initrd.img network ks=nfs:nfsvers=3:192.168.199.7:/mnt/LABVOL/Build/Automate/vCloud/vcd15-ks.cfg + menu Label vCloud Director 1.5 automated build (DVD iso) + +label vCloud15 + kernel /vCloud/vmlinuz + append ksdevice=eth0 load_ramdisk=1 initrd=/vCloud/initrd.img network ks=nfs:nfsvers=3:192.168.199.7:/mnt/LABVOL/Build/Automate/vCloud/vcd15-ks-min.cfg + menu Label vCloud Director 1.5 automated build (minimal iso) +"@ + } + } +} \ No newline at end of file diff --git a/Build/Automate/SS/Build.cmd b/Build/Automate/SS/Build.cmd new file mode 100644 index 0000000..230ab3f --- /dev/null +++ b/Build/Automate/SS/Build.cmd @@ -0,0 +1,22 @@ +@echo off +echo ************************* +echo * +echo ** +echo * Connect to build share +net use B: \\192.168.199.7\Build >> c:\buildlog.txt +type b:\automate\version.txt >> c:\buildlog.txt +regedit -s b:\Automate\_Common\ExecuPol.reg +regedit -s b:\Automate\_Common\NoSCRNSave.reg +regedit -s B:\Automate\_Common\ExplorerView.reg +regedit -s b:\Automate\_Common\IExplorer.reg +REG ADD "HKCU\Environment" /V SEE_MASK_NOZONECHECKS /T REG_SZ /D 1 /F +REG ADD "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /V SEE_MASK_NOZONECHECKS /T REG_SZ /D 1 /F +REG ADD "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Attachments " /V SaveZoneInformation /T REG_SZ /D 1 /F +echo * Activate Windows >> c:\buildlog.txt +cscript //B "%windir%\system32\slmgr.vbs" /ato +copy B:\Automate\PSFunctions.ps1 C:\ +copy B:\Automate\%computername%\Build.ps1 c:\ +echo * Starting PowerShell script for Phase 2 completion +echo * Starting PowerShell script for Phase 2 completion >> C:\buildlog.txt +powershell c:\Build.ps1 +if exist C:\Build.ps1 del c:\Build.ps1 \ No newline at end of file diff --git a/Build/Automate/SS/Build.ps1 b/Build/Automate/SS/Build.ps1 new file mode 100644 index 0000000..41456c8 --- /dev/null +++ b/Build/Automate/SS/Build.ps1 @@ -0,0 +1,72 @@ +if (Test-Path C:\PSFunctions.ps1) { + . "C:\PSFunctions.ps1" +} else { + Write-Host "PSFunctions.ps1 not found. Please copy all PowerShell files from B:\Automate to C:\ and rerun Build.ps1" + Read-Host "Press <Enter> to exit" + exit +} + +if (Test-Path "B:\Automate\automate.ini") { + Write-BuildLog "Determining automate.ini settings." + $viewinstall = ((Select-String -SimpleMatch "ViewInstall=" -Path "B:\Automate\automate.ini").line).substring(12) + Write-BuildLog " VMware View install set to $viewinstall." + $timezone = ((Select-String -SimpleMatch "TZ=" -Path "B:\Automate\automate.ini").line).substring(3) + Write-BuildLog " Timezone set to $timezone." + tzutil /s "$timezone" + $AdminPWD = ((Select-String -SimpleMatch "Adminpwd=" -Path "B:\Automate\automate.ini").line).substring(9) +} +If (([System.Environment]::OSVersion.Version.Major -eq 6) -and ([System.Environment]::OSVersion.Version.Minor -ge 2)) { + Write-BuildLog "Disabling autorun of ServerManager at logon." + Start-Process schtasks -ArgumentList ' /Change /TN "\Microsoft\Windows\Server Manager\ServerManager" /DISABLE' -Wait -Verb RunAs + Write-BuildLog "Disabling screen saver" + set-ItemProperty -path 'HKCU:\Control Panel\Desktop' -name ScreenSaveActive -value 0 +} +$Files = get-childitem "b:\view$viewinstall" +for ($i=0; $i -lt $files.Count; $i++) { + If ($Files[$i].Name -like "VMware-viewconnectionserver*") {$Installer = $Files[$i].FullName} +} +Switch ($ViewInstall) { + 50 { + Write-BuildLog "Install View 5.0 Security Server" + copy $Installer C:\ViewInstaller.exe + Start-Process C:\ViewInstaller.exe -wait -ArgumentList '/s /v"/qn VDM_SERVER_INSTANCE_TYPE=3 VDM_SERVER_NAME=cs1.lab.local VDM_SERVER_SS_EXTURL=SS.external.com VDM_SERVER_SS_PWD=VMware1! VDM_SERVER_SS_PCOIP_IPADDR=192.168.20.199 VDM_SERVER_SS_PCOIP_TCPPORT=4172 VDM_SERVER_SS_PCOIP_UDPPORT=4172"' + } + 51 { + Write-BuildLog "Install View 5.1 Security Server" + copy $Installer C:\ViewInstaller.exe + Start-Process C:\ViewInstaller.exe -wait -ArgumentList '/s /v"/qn VDM_SERVER_INSTANCE_TYPE=3 VDM_SERVER_NAME=cs1.lab.local VDM_SERVER_SS_EXTURL=SS.external.com VDM_SERVER_SS_PWD=VMware1! VDM_SERVER_SS_PCOIP_IPADDR=192.168.20.199 VDM_SERVER_SS_PCOIP_TCPPORT=4172 VDM_SERVER_SS_PCOIP_UDPPORT=4172"' + } + 52 { + Write-BuildLog "Install View 5.2 Security Server" + copy $Installer C:\ViewInstaller.exe + Start-Process C:\ViewInstaller.exe -wait -ArgumentList '/s /v"/qn VDM_SERVER_INSTANCE_TYPE=3 VDM_SERVER_NAME=cs1.lab.local VDM_SERVER_SS_EXTURL=SS.external.com VDM_SERVER_SS_PWD=VMware1! VDM_SERVER_SS_PCOIP_IPADDR=192.168.20.199 VDM_SERVER_SS_PCOIP_TCPPORT=4172 VDM_SERVER_SS_PCOIP_UDPPORT=4172"' + } + 53 { + Write-BuildLog "Install View 5.3 Security Server" + copy $Installer C:\ViewInstaller.exe + Start-Process C:\ViewInstaller.exe -wait -ArgumentList '/s /v"/qn VDM_SERVER_INSTANCE_TYPE=3 VDM_SERVER_NAME=cs1.lab.local VDM_SERVER_SS_EXTURL=SS.external.com VDM_SERVER_SS_PWD=VMware1! VDM_SERVER_SS_PCOIP_IPADDR=192.168.20.199 VDM_SERVER_SS_PCOIP_TCPPORT=4172 VDM_SERVER_SS_PCOIP_UDPPORT=4172"' + } + 60 { + Write-BuildLog "Install View 6.0 Security Server" + copy $Installer C:\ViewInstaller.exe + Start-Process C:\ViewInstaller.exe -wait -ArgumentList '/s /v"/qn VDM_SERVER_INSTANCE_TYPE=3 VDM_SERVER_NAME=cs1.lab.local VDM_SERVER_SS_EXTURL=https://SS.lab.local:443 VDM_SERVER_SS_PWD=VMware1! VDM_SERVER_SS_PCOIP_IPADDR=192.168.199.35 VDM_SERVER_SS_PCOIP_TCPPORT=4172 VDM_SERVER_SS_PCOIP_UDPPORT=4172"' + } +} +Write-BuildLog "Install Flash Player" +Start-Process msiexec -wait -ArgumentList " /i b:\Automate\_Common\install_flash_player_11_active_x.msi /qn" +Write-BuildLog "Setup Firewall" +netsh advfirewall firewall add rule name="All ICMP V4" dir=in action=allow protocol=icmpv4 +netsh advfirewall firewall set rule group="remote desktop" new enable=Yes +netsh advfirewall firewall set rule group="File and Printer Sharing" new enable=Yes +Write-BuildLog "Setup persistet route to other subnet for SRM and View" +route add 192.168.201.0 mask 255.255.255.0 192.168.199.254 -p +Write-BuildLog "Cleanup" +regedit /s b:\Automate\_Common\ExecuPol.reg +regedit -s b:\Automate\_Common\NoSCRNSave.reg +Write-BuildLog "Change default local administrator password" +net user administrator $AdminPWD +B:\automate\_Common\Autologon vi-admin lab $AdminPWD +reg delete HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /v Build /f +Write-BuildLog "Install VMware Tools" +b:\VMTools\Setup64.exe /s /v "/qn" +Read-Host "Rebooting after VMTools Install" diff --git a/Build/Automate/ScriptMenu.ps1 b/Build/Automate/ScriptMenu.ps1 new file mode 100644 index 0000000..cdd2789 --- /dev/null +++ b/Build/Automate/ScriptMenu.ps1 @@ -0,0 +1,22 @@ +#PowerShell menu on VC rather than lots of scripts on desktop +# +# Version 0.8 +# +# +. "C:\PSFunctions.ps1" +clear-host +$choices = ("Validate this server's build","Open build log","Add ESXi Hosts to vCenter and configure cluster","Activate Windows","Install vShield 5.0 for vCloud 1.5", "Launch Derek Seamans SSL Script", "Shutdown Lab servers") +While ($True) { + $sel = SelectFromList $choices " AutoLab script Launcher" + clear-host + Switch ($sel) + { + 0 {Start-Process PowerShell.exe -Verb Runas -ArgumentList " c:\validate.ps1"} + 1 {Invoke-Expression "C:\BuildLog.txt"} + 2 {Start-Process c:\windows\syswow64\WindowsPowerShell\v1.0\powershell.exe -ArgumentList " C:\AddHosts.ps1"} + 3 {Start-Process cscript.exe -Verb Runas -ArgumentList " c:\windows\system32\slmgr.vbs /ato"} + 4 {Start-Process c:\windows\syswow64\WindowsPowerShell\v1.0\powershell.exe -ArgumentList " -noexit c:\Derek-SSL.ps1" -Verg RunAs} + 5 {Start-Process c:\windows\syswow64\WindowsPowerShell\v1.0\powershell.exe -ArgumentList " -noexit c:\vShield15.ps1"} + 6 {Invoke-Expression "C:\ShutLab.ps1"} + } + } diff --git a/Build/Automate/Shared/ExecuPol.reg b/Build/Automate/Shared/ExecuPol.reg new file mode 100644 index 0000000..93a125d Binary files /dev/null and b/Build/Automate/Shared/ExecuPol.reg differ diff --git a/Build/Automate/Shared/NoSCRNSave.reg b/Build/Automate/Shared/NoSCRNSave.reg new file mode 100644 index 0000000..b753763 Binary files /dev/null and b/Build/Automate/Shared/NoSCRNSave.reg differ diff --git a/Build/Automate/ShellVMs/TTYLinux/TTYLinux-flat.vmdk b/Build/Automate/ShellVMs/TTYLinux/TTYLinux-flat.vmdk new file mode 100644 index 0000000..175e0f5 Binary files /dev/null and b/Build/Automate/ShellVMs/TTYLinux/TTYLinux-flat.vmdk differ diff --git a/Build/Automate/ShellVMs/TTYLinux/TTYLinux.nvram b/Build/Automate/ShellVMs/TTYLinux/TTYLinux.nvram new file mode 100644 index 0000000..5032f65 Binary files /dev/null and b/Build/Automate/ShellVMs/TTYLinux/TTYLinux.nvram differ diff --git a/Build/Automate/ShellVMs/TTYLinux/TTYLinux.vmdk b/Build/Automate/ShellVMs/TTYLinux/TTYLinux.vmdk new file mode 100644 index 0000000..3a968e0 --- /dev/null +++ b/Build/Automate/ShellVMs/TTYLinux/TTYLinux.vmdk @@ -0,0 +1,21 @@ +# Disk DescriptorFile +version=1 +encoding="UTF-8" +CID=9da7cb2f +parentCID=ffffffff +isNativeSnapshot="no" +createType="vmfs" + +# Extent description +RW 65536 VMFS "TTYLinux-flat.vmdk" + +# The Disk Data Base +#DDB + +ddb.virtualHWVersion = "8" +ddb.longContentID = "e043e0f2a20bce73ad8bd43f9da7cb2f" +ddb.uuid = "60 00 C2 99 27 ac 5a 89-86 32 03 2e 95 a5 c9 8c" +ddb.geometry.cylinders = "65" +ddb.geometry.heads = "16" +ddb.geometry.sectors = "63" +ddb.adapterType = "ide" diff --git a/Build/Automate/ShellVMs/TTYLinux/TTYLinux.vmsd b/Build/Automate/ShellVMs/TTYLinux/TTYLinux.vmsd new file mode 100644 index 0000000..e69de29 diff --git a/Build/Automate/ShellVMs/TTYLinux/TTYLinux.vmx b/Build/Automate/ShellVMs/TTYLinux/TTYLinux.vmx new file mode 100644 index 0000000..9230f3a --- /dev/null +++ b/Build/Automate/ShellVMs/TTYLinux/TTYLinux.vmx @@ -0,0 +1,71 @@ +.encoding = "UTF-8" +config.version = "8" +virtualHW.version = "8" +pciBridge0.present = "true" +pciBridge4.present = "true" +pciBridge4.virtualDev = "pcieRootPort" +pciBridge4.functions = "8" +pciBridge5.present = "true" +pciBridge5.virtualDev = "pcieRootPort" +pciBridge5.functions = "8" +pciBridge6.present = "true" +pciBridge6.virtualDev = "pcieRootPort" +pciBridge6.functions = "8" +pciBridge7.present = "true" +pciBridge7.virtualDev = "pcieRootPort" +pciBridge7.functions = "8" +vmci0.present = "true" +hpet0.present = "true" +nvram = "TTYLinux.nvram" +virtualHW.productCompatibility = "hosted" +powerType.powerOff = "soft" +powerType.powerOn = "hard" +powerType.suspend = "hard" +powerType.reset = "soft" +displayName = "TTYLinux" +extendedConfigFile = "TTYLinux.vmxf" +ide1:0.present = "true" +ide1:0.clientDevice = "TRUE" +ide1:0.deviceType = "atapi-cdrom" +ide1:0.startConnected = "FALSE" +ethernet0.present = "true" +ethernet0.networkName = "Servers" +ethernet0.addressType = "vpx" +ethernet0.generatedAddress = "00:50:56:95:20:d0" +guestOS = "linux" +uuid.bios = "42 15 27 53 0c 46 21 06-ed 56 af cb 6a e6 93 6a" +vc.uuid = "50 15 7e 5e 8f 11 7a e2-a4 c7 2e fb ec b1 ad f1" +ide1:0.fileName = "" +vmci0.id = "1793495914" +uuid.location = "56 4d 05 c0 25 54 f1 ca-dc 48 58 81 01 1e b3 dc" +cleanShutdown = "TRUE" +replay.supported = "FALSE" +sched.swap.derivedName = "/vmfs/volumes/50013664-85840aba-619f-000c290cc62d/TTYLinux/TTYLinux-9b440b2c.vswp" +replay.filename = "" +pciBridge0.pciSlotNumber = "17" +pciBridge4.pciSlotNumber = "21" +pciBridge5.pciSlotNumber = "22" +pciBridge6.pciSlotNumber = "23" +pciBridge7.pciSlotNumber = "24" +ethernet0.pciSlotNumber = "32" +vmci0.pciSlotNumber = "33" +hostCPUID.0 = "0000000d756e65476c65746e49656e69" +hostCPUID.1 = "000306a900020800969822231febfbff" +hostCPUID.80000001 = "00000000000000000000000128100800" +guestCPUID.0 = "0000000d756e65476c65746e49656e69" +guestCPUID.1 = "000306a900010800969822030febfbff" +guestCPUID.80000001 = "00000000000000000000000128100800" +userCPUID.0 = "0000000d756e65476c65746e49656e69" +userCPUID.1 = "000306a900010800969822030febfbff" +userCPUID.80000001 = "00000000000000000000000128100800" +evcCompatibilityMode = "FALSE" +vmotion.checkpointFBSize = "4194304" +keyboard.typematicMinDelay = "2000000" +ide0:0.present = "TRUE" +ide0:0.fileName = "TTYLinux.vmdk" +ide0:0.redo = "" +ethernet0.virtualDev = "e1000" +scsi0.present = "FALSE" +scsi0:0.present = "FALSE" +floppy0.present = "FALSE" +tools.remindInstall = "TRUE" diff --git a/Build/Automate/ShellVMs/TTYLinux/TTYLinux.vmxf b/Build/Automate/ShellVMs/TTYLinux/TTYLinux.vmxf new file mode 100644 index 0000000..1ec6dce --- /dev/null +++ b/Build/Automate/ShellVMs/TTYLinux/TTYLinux.vmxf @@ -0,0 +1,8 @@ +<?xml version="1.0"?> +<Foundry> +<VM> +<VMId type="string">52 50 d3 d7 3c 32 c8 bf-7f 3a e4 f6 fe a3 2f c1</VMId> +<ClientMetaData> +<clientMetaDataAttributes/> +<HistoryEventList/></ClientMetaData> +<vmxPathName type="string">TTYLinux.vmx</vmxPathName></VM></Foundry> diff --git a/Build/Automate/ShutLab.ps1 b/Build/Automate/ShutLab.ps1 new file mode 100644 index 0000000..1aa3e24 --- /dev/null +++ b/Build/Automate/ShutLab.ps1 @@ -0,0 +1,91 @@ +# Script to Shutdown AutoLab +# +# +# Version 2.6 +# +# +. "C:\PSFunctions.ps1" +Function ShutWinServ ($WinServ){ + $ping = new-object System.Net.NetworkInformation.Ping + $Reply = $ping.send($WinServ) + if ($Reply.status –eq "Success") { + Write-Host "Shutdown $WinServ" -foregroundcolor "Green" + $null = stop-Computer -comp $WinServ -force + } + } +if (Test-Path \\nas\build\Automate\automate.ini) { + $AdminPWD = "VMware1!" + $AdminPWD = ((Select-String -SimpleMatch "Adminpwd=" -Path "\\nas\build\Automate\automate.ini").line).substring(9) +} Else { + Write-BuildLog "Cannot find Automate.ini, this isn't a good sign" +} + +Write-Host " " +Write-Host "This script will shutdown your lab, enter Y to proceed" -foregroundcolor "cyan" +$ReBuild = Read-Host +If ([string]::Compare($ReBuild, "Y", $True) -eq "0"){ + Write-Host "Shutting down your lab" -foregroundcolor "cyan" + if ( (Get-PSSnapin -Name VMware.VimAutomation.Core -ErrorAction SilentlyContinue) -eq $null ) + { + try { + Write-Host "Loading PowerCLI plugin, this will take a little while" -foregroundcolor "cyan" + Add-PsSnapin VMware.VimAutomation.Core + } + catch { + Write-Host "Unable to load the PowerCLI plugin. Please verify installation and run this script again." + 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" + $Cluster = Get-Cluster -name "Local" + $null = get-VM -Location $Cluster | Where-Object {$_.PowerState -eq "PoweredOn"}| foreach-Object{Write-Host "Shutting down " $_.Name -foregroundcolor "Green";stop-vm $_ -Confirm:$false} + Write-Host "Shutdown any running ESX servers" -foregroundcolor "Green" + $null = get-VMhost -Location $Cluster | Where-Object {$_.ConnectionState -eq "Connected"}| foreach-Object{Write-Host "Shutting down " $_.Name -foregroundcolor "Green"; stop-vmhost $_ -Confirm:$false -force} + $null = Disconnect-VIServer -Server * -confirm:$false + ShutWinServ ("ss.lab.local") + ShutWinServ ("cs1.lab.local") + 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" + Write-Host "Connect to vCenter" -foregroundcolor "Green" + $null = connect-viserver vc2.lab.local -user administrator -password $AdminPWD + Write-Host "Shutdown any running VMs" -foregroundcolor "Green" + $null = get-VM | Where-Object {$_.PowerState -eq "PoweredOn"}| foreach-Object{Write-Host "Shutting down " $_.Name -foregroundcolor "Green";stop-vm $_ -Confirm:$false} + Write-Host "Shutdown any running ESX servers" -foregroundcolor "Green" + $null = get-VMhost | Where-Object {$_.ConnectionState -eq "Connected"}| foreach-Object{Write-Host "Shutting down " $_.Name -foregroundcolor "Green"; stop-vmhost $_ -Confirm:$false -force} + $null = Disconnect-VIServer -Server * -confirm:$false + } + $Reply = $ping.send("192.168.199.254") + if ($Reply.status –eq "Success") { + Write-Host "Shutdown WAN" -foregroundcolor "Green" + cmd /c '"C:\Program Files (x86)\PuTTY\plink.exe" 192.168.199.254 -l root -pw VMware1! shutdown -h now' + } + $Reply = $ping.send("gw") + if (($Reply.status –eq "Success") -and (!((get-vmplatform) -ne "Ravello"))) { + Write-Host "Shutdown Router" -foregroundcolor "Green" + cmd /c '"C:\Program Files (x86)\PuTTY\plink.exe" gw -l root -pw VMware1! halt -p' + } + $Reply = $ping.send("nas") + if ($Reply.status –eq "Success") { + 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") + ShutWinServ ("vc.lab.local") + Read-Host "Exit and wait for everything to go away" -foregroundcolor "cyan" +} Else { + Write-Host "Leaving your lab running" -foregroundcolor "cyan" +} \ No newline at end of file diff --git a/Build/Automate/V1/Build.cmd b/Build/Automate/V1/Build.cmd new file mode 100644 index 0000000..47fed8e --- /dev/null +++ b/Build/Automate/V1/Build.cmd @@ -0,0 +1,20 @@ +@echo off +echo ************************* +echo * +echo ** +echo * Connect to build share +net use B: \\192.168.199.7\Build >> c:\buildlog.txt +type b:\automate\version.txt >> c:\buildlog.txt +echo ** +echo * Setup persistent route to other subnet for SRM and View +echo * Setup persistent route to other subnet for SRM and View >> c:\buildLog.txt +route add 192.168.201.0 mask 255.255.255.0 192.168.199.254 -p +echo ** +echo * Install reqired Windows compnents +echo * Install reqired Windows compnents >> c:\buildLog.txt +Start /wait pkgmgr /l:C:\IIS_Install_Log.txt /iu:NetFx3;IIS-WebServerRole;IIS-WebServer;IIS-ApplicationDevelopment;IIS-ASP;IIS-ISAPIFilter;ADFS-WebAgentToken;IIS-ASPNET;IIS-Security;IIS-BasicAuthentication;IIS-DigestAuthentication;IIS-RequestFiltering;IIS-WindowsAuthentication;IIS-WebServerManagementTools;IIS-ManagementConsole;IIS-NetFxExtensibility;IIS-ISAPIExtensions +echo ** +echo * Install VMware Tools +echo * Install VMware Tools >> c:\buildLog.txt +b:\VMTools\Setup64.exe /s /v "/qn" +timeout 60 diff --git a/Build/Automate/VBR/Build.cmd b/Build/Automate/VBR/Build.cmd new file mode 100644 index 0000000..47fed8e --- /dev/null +++ b/Build/Automate/VBR/Build.cmd @@ -0,0 +1,20 @@ +@echo off +echo ************************* +echo * +echo ** +echo * Connect to build share +net use B: \\192.168.199.7\Build >> c:\buildlog.txt +type b:\automate\version.txt >> c:\buildlog.txt +echo ** +echo * Setup persistent route to other subnet for SRM and View +echo * Setup persistent route to other subnet for SRM and View >> c:\buildLog.txt +route add 192.168.201.0 mask 255.255.255.0 192.168.199.254 -p +echo ** +echo * Install reqired Windows compnents +echo * Install reqired Windows compnents >> c:\buildLog.txt +Start /wait pkgmgr /l:C:\IIS_Install_Log.txt /iu:NetFx3;IIS-WebServerRole;IIS-WebServer;IIS-ApplicationDevelopment;IIS-ASP;IIS-ISAPIFilter;ADFS-WebAgentToken;IIS-ASPNET;IIS-Security;IIS-BasicAuthentication;IIS-DigestAuthentication;IIS-RequestFiltering;IIS-WindowsAuthentication;IIS-WebServerManagementTools;IIS-ManagementConsole;IIS-NetFxExtensibility;IIS-ISAPIExtensions +echo ** +echo * Install VMware Tools +echo * Install VMware Tools >> c:\buildLog.txt +b:\VMTools\Setup64.exe /s /v "/qn" +timeout 60 diff --git a/Build/Automate/VC/AdminPwd.ps1 b/Build/Automate/VC/AdminPwd.ps1 new file mode 100644 index 0000000..2466d3b --- /dev/null +++ b/Build/Automate/VC/AdminPwd.ps1 @@ -0,0 +1,8 @@ +$AdminPWD = ((Select-String -SimpleMatch "Adminpwd=" -Path "B:\Automate\automate.ini").line).substring(9) +net user administrator $AdminPWD /domain +$cred = new-object -typename System.Management.Automation.PSCredential -argumentlist "Lab\Administrator", (ConvertTo-SecureString -AsPlainText $AdminPWD -Force) +invoke-command -computername DC -credential $cred { + $AdminPWD = ((Select-String -SimpleMatch "Adminpwd=" -Path "\\192.168.199.7\Build\Automate\automate.ini").line).substring(9) + Start-Process Regedit.exe -ArgumentList " -s \\192.168.199.7\Build\automate\_Common\ExplorerView.reg" -verb RunAs + Start-Process \\192.168.199.7\Build\automate\_Common\Autologon.exe -ArgumentList " administrator lab $AdminPWD" -verb RunAs +} \ No newline at end of file diff --git a/Build/Automate/VC/Build.cmd b/Build/Automate/VC/Build.cmd new file mode 100644 index 0000000..d7cc6f1 --- /dev/null +++ b/Build/Automate/VC/Build.cmd @@ -0,0 +1,26 @@ +@echo off +echo ************************* +echo * +echo ** +echo * Connect to build share +echo * Connect to build share >> c:\buildlog.txt +net use B: \\192.168.199.7\Build >> c:\buildlog.txt +md c:\temp +type b:\automate\version.txt >> c:\buildlog.txt +regedit -s b:\Automate\_Common\ExecuPol.reg +regedit -s b:\Automate\_Common\NoSCRNSave.reg +regedit -s B:\Automate\_Common\ExplorerView.reg +regedit -s b:\Automate\_Common\IExplorer.reg +regedit -s b:\Automate\_Common\Nested.reg +copy b:\automate\_Common\wasp.dll c:\windows\system32 +copy B:\Automate\validate.ps1 C:\ +copy B:\Automate\PSFunctions.ps1 C:\ +copy B:\Automate\VC\Build.ps1 c:\ +copy B:\Automate\VC\Derek-SSL.ps1 c:\ +echo * Activate Windows >> c:\buildlog.txt +cscript //B "%windir%\system32\slmgr.vbs" /ato +echo * Starting PowerShell script for Build +echo * Starting PowerShell script for Build >> C:\buildlog.txt +powershell c:\Build.ps1 +if exist C:\Build.ps1 del c:\Build.ps1 +if exist C:\Build.cmd del c:\Build.cmd \ No newline at end of file diff --git a/Build/Automate/VC/Build.ps1 b/Build/Automate/VC/Build.ps1 new file mode 100644 index 0000000..6e7f69f --- /dev/null +++ b/Build/Automate/VC/Build.ps1 @@ -0,0 +1,653 @@ +if (Test-Path C:\PSFunctions.ps1) { + . "C:\PSFunctions.ps1" +} else { + Write-Host "PSFunctions.ps1 not found. Please copy all PowerShell files from B:\Automate to C:\ and rerun Build.ps1" + Read-Host "Press <Enter> to exit" + exit +} + +# Start VC configuration process +if (Test-Path "B:\Automate\automate.ini") { + Write-BuildLog "Determining automate.ini settings." + $vcinstall = "55" + $vcinstall = ((Select-String -SimpleMatch "VCInstall=" -Path "B:\Automate\automate.ini").line).substring(10) + If ($vcinstall -eq "50") {$vcinstall = "5"} + Write-BuildLog " VMware vCenter install set to $vcinstall." + $viewinstall = "None" + $viewinstall = ((Select-String -SimpleMatch "ViewInstall=" -Path "B:\Automate\automate.ini").line).substring(12) + Write-BuildLog " VMware View install set to $viewinstall." + $buildvm = "false" + $buildvm = ((Select-String -SimpleMatch "BuildVM=" -Path "B:\Automate\automate.ini").line).substring(8) + if ($buildvm -like "true") { + $buildvm = $true + Write-BuildLog " vCenter Lab VM to be built." + } else { + $buildvm = $false + } + $win2k3key = "XXXXX-XXXXX-XXXXX-XXXXX-XXXXX" + $win2k3key = ((Select-String -SimpleMatch "ProductKey=" -Path "B:\Automate\automate.ini" -List).line).substring(11) + if ($win2k3key -and !($win2k3key -like "*XXXX*")) { + Write-BuildLog " Windows 2003 product key for vCenter Lab VM found." + $fileoriginal = Get-Content B:\Automate\_Common\Lab2K3.sif + [String[]] $filemodified = @() + foreach ($line in $fileoriginal) { + if ($line -match "ProductID=XXXXX-XXXXX-XXXXX-XXXXX-XXXXX") { + $line = "ProductID=$win2k3key" + } + $filemodified += $line + } + $null = New-Item -Path C:\temp\Lab2K3.sif -ItemType File -Force + Set-Content C:\temp\Lab2k3.sif $filemodified + $fileoriginal = Get-Content B:\Automate\_Common\Auto2K3.sif + [String[]] $filemodified = @() + foreach ($line in $fileoriginal) { + if ($line -match "ProductID=XXXXX-XXXXX-XXXXX-XXXXX-XXXXX") { + $line = "ProductID=$win2k3key" + } + $filemodified += $line + } + $null = New-Item -Path C:\temp\Auto2K3.sif -ItemType File -Force + Set-Content C:\temp\Auto2K3.sif $filemodified + } + $buildviewvm = "false" + $buildviewvm = ((Select-String -SimpleMatch "BuildViewVM=" -Path "B:\Automate\automate.ini").line).substring(12) + if ($buildviewvm -like "true") { + $buildviewvm = $true + Write-BuildLog " View Lab VM to be built." + } else { + $buildviewvm = $false + } + $viewvmproductkey = "XXXXX-XXXXX-XXXXX-XXXXX-XXXXX" + $viewvmproductkey = ((Select-String -SimpleMatch "ViewVMProductKey=" -Path "B:\Automate\automate.ini").line).substring(17) + if ($viewvmproductkey -and !($viewvmproductkey -like "*XXXX*")) { + Write-BuildLog " Windows XP product key found for View Lab VM found." + $fileoriginal = Get-Content B:\Automate\_Common\AutoXP.sif + [String[]] $filemodified = @() + foreach ($line in $fileoriginal) { + if ($line -match "ProductID=XXXXX-XXXXX-XXXXX-XXXXX-XXXXX") { + $line = "ProductID=$viewvmproductkey" + } + $filemodified += $line + } + $null = New-Item -Path C:\temp\AutoXP.sif -ItemType File -Force + Set-Content C:\temp\AutoXP.sif $filemodified + } + $timezone = "New Zealand Standard Time" + $timezone = ((Select-String -SimpleMatch "TZ=" -Path "B:\Automate\automate.ini").line).substring(3) + Write-BuildLog " Set timezone to $timezone." + tzutil /s "$timezone" + $DeployVUM = $false + if ((((Select-String -SimpleMatch "DeployVUM=" -Path "B:\Automate\automate.ini").line).substring(10)) -like "true") { + $DeployVUM = $true + Write-BuildLog " VUM will be installed." + } else { + $DeployVUM = $false + Write-BuildLog " No VUM." + } + $AutoAddHosts = "false" + $AutoAddHosts = ((Select-String -SimpleMatch "AutoAddHosts=" -Path "B:\Automate\automate.ini").line).substring(13) + if ($AutoAddHosts -like "true") { + $AutoAddHosts = $true + Write-BuildLog " Hosts will be automatically added to vCenter after build completes." + } else { + $AutoAddHosts = $false + } + $AutoVCNS = "false" + $AutoVCNS = ((Select-String -SimpleMatch "AutoVCNS=" -Path "B:\Automate\automate.ini").line).substring(9) + if ($AutoVCNS -like "true") { + $AutoVCNS = $true + Write-BuildLog " vShield Manager will be automatically deployed" + } else { + $AutoVCNS = $false + } + $AdminPWD = "VMware1!" + $AdminPWD = ((Select-String -SimpleMatch "Adminpwd=" -Path "B:\Automate\automate.ini").line).substring(9) +} else { + Write-BuidLog "Unable to find B:\Automate\automate.ini. Where did it go?" +} +If ((([System.Environment]::OSVersion.Version.Major *10) +[System.Environment]::OSVersion.Version.Minor) -ge 62) { + Write-BuildLog "Disabling autorun of ServerManager at logon." + Start-Process schtasks -ArgumentList ' /Change /TN "\Microsoft\Windows\Server Manager\ServerManager" /DISABLE' -Wait -Verb RunAs + Write-BuildLog "Disabling screen saver" + set-ItemProperty -path 'HKCU:\Control Panel\Desktop' -name ScreenSaveActive -value 0 +} +if (Test-Path "C:\VMware-viewcomposer*") { + $Files = get-childitem "C:\" + for ($i=0; $i -lt $files.Count; $i++) { + If ($Files[$i].Name -like "VMware-viewcomposer*") {$Installer = $Files[$i].FullName} + } + switch ($viewinstall) { + 60 { + Write-BuildLog "Installing VMware View 6.0 Composer" + Start-Process $Installer -ArgumentList '/s /v" /qn AgreeToLicense="Yes" DB_USERNAME="VMview" DB_PASSWORD="VMware1!" DB_DSN="ViewComposer" REBOOT="ReallySuppress" "' -Wait -Verb RunAs + } 53 { + Write-BuildLog "Installing VMware View 5.3 Composer" + Start-Process $Installer -ArgumentList '/s /v" /qn AgreeToLicense="Yes" DB_USERNAME="VMview" DB_PASSWORD="VMware1!" DB_DSN="ViewComposer" REBOOT="ReallySuppress" "' -Wait -Verb RunAs + } 52 { + Write-BuildLog "Installing VMware View 5.2 Composer" + Start-Process $Installer -ArgumentList '/s /v" /qn AgreeToLicense="Yes" DB_USERNAME="VMview" DB_PASSWORD="VMware1!" DB_DSN="ViewComposer" REBOOT="ReallySuppress" "' -Wait -Verb RunAs + } + } + reg delete HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /v Build /f + Exit +} + +Write-BuildLog "Clear System eventlog, erors to here are spurious" +Clear-EventLog -LogName System -confirm:$False + +Write-BuildLog "Installing 7-zip." +try { + Start-Process msiexec -ArgumentList '/qb /i B:\Automate\_Common\7z920-x64.msi' -Wait +} +catch { + Write-BuildLog "7-zip installation failed." +} +Write-BuildLog "Installing PuTTy." +$null = New-Item -Path "C:\Program Files (x86)\PuTTY" -ItemType Directory -Force +xcopy B:\Automate\vc\PuTTY\*.* "C:\Program Files (x86)\PuTTY" /s /c /y /q +regedit -s B:\Automate\vc\PuTTY.reg +If (!((([System.Environment]::OSVersion.Version.Major *10) +[System.Environment]::OSVersion.Version.Minor) -ge 62)) { + try { + Write-BuildLog "Installing Adobe Flash Player." + Start-Process msiexec -ArgumentList '/i b:\Automate\_Common\install_flash_player_17_active_x.msi /qb' -Wait + } + catch { + Write-BuildLog "Adobe Flash Player installation failed." + } +} +Write-BuildLog "" + +#Install now running as local administrator, don't need to allow vi-admin access +#$Acl = Get-Acl "C:\Buildlog.txt" +#$Ar = New-Object system.security.accesscontrol.filesystemaccessrule("lab\vi-admin","FullControl","Allow") +#$Acl.SetAccessRule($Ar) +#Set-Acl "C:\Buildlog.txt" $Acl + +Write-BuildLog "Change default local administrator password" +net user administrator $AdminPWD +B:\automate\_Common\Autologon administrator vc $AdminPWD + +Write-BuildLog "" +if (Test-Path "b:\VMware-PowerCLI*.exe") { + #Start-Process b:\VMware-PowerCLI.exe -ArgumentList '/q /s /w /L1033 /V" /qb"' -Wait -Verb RunAs + $null = New-Item -Path "C:\Users\vi-admin\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1" -ItemType File -Force + $null = Add-Content -Path "C:\Users\vi-admin\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1" -Value @" +if ((Get-PSSnapin -Name VMware.VimAutomation.Core -ErrorAction SilentlyContinue) -eq `$null) { + try { + Write-Host "Loading PowerCLI plugin, this may take a little while." -foregroundcolor "cyan" + Add-PSSnapin VMware.VimAutomation.Core + `$PCLIVer = Get-PowerCLIVersion + if (((`$PCLIVer.Major * 10 ) + `$PCLIVer.Minor) -ge 51) { + `$null = Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -confirm:`$false -Scope "Session" + } + } + catch { + Write-Host "Unable to load the PowerCLI plugin. Please verify installation or install VMware PowerCLI and run this script again." + Read-Host "Press <Enter> to exit" + exit + } +} +"@ +} else { + Write-BuildLog "VMware PowerCLI installer not found. This will need to be installing before running any AutoLab PowerShell post-install scripts." +} + +switch ($vcinstall) { + 60 { + Write-BuildLog "Starting vCenter 6.0 automation." + if (Test-Path "b:\VIM_60\redist\SQLEXPR\SQLEXPR_x64_ENU.exe") { + Write-BuildLog "SQL Server 2012 Express SP1 for vCenter 6.0 found; installing." + Start-Process b:\VIM_60\redist\SQLEXPR\SQLEXPR_x64_ENU.exe -ArgumentList '/q /x:c:\temp /quiet' -Wait -Verb RunAs + if (Test-Path "C:\temp\pcusource\1033_enu_lp\x64\setup\x64\sqlncli.msi") { + copy C:\temp\pcusource\1033_enu_lp\x64\setup\x64\sqlncli.msi c:\temp + } elseif (Test-Path "C:\temp\1033_enu_lp\x64\setup\x64\sqlncli.msi") { + copy C:\temp\1033_enu_lp\x64\setup\x64\sqlncli.msi c:\temp + } + if (Test-Path "C:\temp\sqlncli.msi") { + Write-BuildLog "Installing SQL native client." + Start-Process msiexec -ArgumentList '/i C:\temp\sqlncli.msi ADDLOCAL=ALL IACCEPTSQLNCLILICENSETERMS=YES /qb' -Wait -Verb RunAs + Start-Process regedit -ArgumentList "-s B:\Automate\vc\vCenter6DB.reg" -Wait -Verb RunAs + start-sleep -s 10 + } + } else { + Write-BuildLog "SQL Server 2012 Express SP1 for vCenter 6.0 not found. Exiting." + Read-Host "Press <Enter> to exit" + exit + } + Write-BuildLog "Installing vCentre server 6.0. with embedded PSC" + Start-Process B:\VIM_60\vCenter-Server\VMware-vCenter-Server.exe -ArgumentList " /qr CUSTOM_SETTINGS=B:\Automate\VC\vCentre60.json" -Wait -Verb RunAs + Write-BuildLog "Installing vCentre Client Integration Plugin" + If (!(Test-Path("c:\temp\VMware-ClientIntegrationPlugin-6.0.0.exe"))) { + B: + cd B:\VIM_60 + B:\Automate\_Common\wget.exe -q http://vsphereclient.vmware.com/vsphereclient/VMware-ClientIntegrationPlugin-6.0.0.exe + } + Start-Process B:\VIM_60\VMware-ClientIntegrationPlugin-6.0.0.exe -ArgumentList '/v" /qb" ' -Wait -Verb RunAs + Write-BuildLog "Installing vSphere Client 6.0." + Start-Process B:\VIM_60\vSphere-Client\VMware-viclient.exe -ArgumentList '/qb /s /w /L1033 /v" /qb"' -Wait -Verb RunAs + $null = mkdir "C:\Program Files (x86)\VMware\Infrastructure\Virtual Infrastructure Client\Plugins\SSHAutoConnect" + $null = copy B:\Automate\vc\SSHAutoConnect\*.* "C:\Program Files (x86)\VMware\Infrastructure\Virtual Infrastructure Client\Plugins\SSHAutoConnect" + Write-BuildLog "Installing vSphere Client 6.0 VUM Plugin." + Start-Process B:\VIM_60\updateManager\VMware-UMClient.exe -ArgumentList '/qb /s /w /L1033 /v" /qr"' -Wait -Verb RunAs + Write-BuildLog "Installing vSphere Web Client Integration plugin." + if ((Test-Path "b:\VMware-PowerCLI-6.0.*.exe") -and ((([System.Environment]::OSVersion.Version.Major *10) +[System.Environment]::OSVersion.Version.Minor) -ge 62)) { + Write-BuildLog "VMware PowerCLI 6.0 installer found; installing." + Start-Process (Get-ChildItem b:\VMware-PowerCLI-6.0.*.exe).FullName -ArgumentList '/q /s /w /L1033 /V" /qb"' -Wait -Verb RunAs + } elseif (Test-Path "b:\VMware-PowerCLI-5.8.*.exe") { + Write-BuildLog "VMware PowerCLI 5.8 installer found; installing." + Start-Process (Get-ChildItem b:\VMware-PowerCLI-5.8.*.exe).FullName -ArgumentList '/q /s /w /L1033 /V" /qb"' -Wait -Verb RunAs + } elseif (Test-Path "b:\VMware-PowerCLI-5.5.*.exe") { + Write-BuildLog "VMware PowerCLI 5.5 installer found; installing." + Start-Process (Get-ChildItem b:\VMware-PowerCLI-5.5.*.exe).FullName -ArgumentList '/q /s /w /L1033 /V" /qb"' -Wait -Verb RunAs + } elseif (Test-Path "b:\VMware-PowerCLI-5.0.*.exe"){ + Write-BuildLog "PowerCLI installer is out of date, installing anyway." + Start-Process (Get-ChildItem b:\VMware-PowerCLI-5.0.*.exe).FullName -ArgumentList '/q /s /w /L1033 /V" /qb"' -Wait -Verb RunAs + } else { + If ((Read-Host "Would you like to go to the PowerCLI download site (y/n)?") -like "y") { + $IE=new-object -com internetexplorer.application + if ((([System.Environment]::OSVersion.Version.Major *10) +[System.Environment]::OSVersion.Version.Minor) -ge 62) {$IE.navigate2("https://my.vmware.com/group/vmware/get-download?downloadGroup=PCLI600R1")} + if ((([System.Environment]::OSVersion.Version.Major *10) +[System.Environment]::OSVersion.Version.Minor) -le 62) {$IE.navigate2("https://my.vmware.com/group/vmware/get-download?downloadGroup=PCLI58R1")} + $IE.visible=$true + } Else { + Write-Host "OK, but the build will not work correctly without PowerCLI" + } + } + } + 55 { + Write-BuildLog "Starting vCenter 5.5 automation." + if (Test-Path "b:\VIM_55\redist\SQLEXPR\SQLEXPR_x64_ENU.exe") { + Write-BuildLog "SQL Server 2008 R2 Express SP1 for vCenter 5.5 found; installing." + Start-Process b:\VIM_55\redist\SQLEXPR\SQLEXPR_x64_ENU.exe -ArgumentList '/extract:c:\temp /quiet' -Wait -Verb RunAs + if (Test-Path "C:\temp\pcusource\1033_enu_lp\x64\setup\x64\sqlncli.msi") { + copy C:\temp\pcusource\1033_enu_lp\x64\setup\x64\sqlncli.msi c:\temp + } elseif (Test-Path "C:\temp\1033_enu_lp\x64\setup\x64\sqlncli.msi") { + copy C:\temp\1033_enu_lp\x64\setup\x64\sqlncli.msi c:\temp + } + if (Test-Path "C:\temp\sqlncli.msi") { + Write-BuildLog "Installing SQL native client." + Start-Process msiexec -ArgumentList '/i C:\temp\sqlncli.msi ADDLOCAL=ALL IACCEPTSQLNCLILICENSETERMS=YES /qb' -Wait -Verb RunAs + regedit -s B:\Automate\vc\vCenterDB.reg + } + } else { + Write-BuildLog "SQL Server 2008 R2 Express SP1 for vCenter 5.5 not found. Exiting." + Read-Host "Press <Enter> to exit" + exit + } + Write-BuildLog "Installing VisalC Runtime as pre-requisite." + start-Process "B:\VIM_55\Single Sign-On\prerequisites\vcredist_x64.exe" -argumentList " /q" -Wait -Verb RunAs + Write-BuildLog "Installing vCenter 5.5 Single Sign On." + start-Process msiexec -argumentList '/i "B:\VIM_55\Single Sign-On\VMware-SSO-Server.msi" /qr SSO_HTTPS_PORT=7444 DEPLOYMODE=FIRSTDOMAIN ADMINPASSWORD=VMware1! SSO_SITE=Lab' -Wait -Verb RunAs + Write-BuildLog "Installing vCenter 5.5 Web Client." + Start-Process B:\VIM_55\vSphere-WebClient\VMware-WebClient.exe -ArgumentList '/L1033 /v" HTTP_PORT=9090 HTTPS_PORT=9443 SSO_ADMIN_USER=administrator@vsphere.local SSO_ADMIN_PASSWORD=VMware1! LS_URL=https://vc.lab.local:7444/lookupservice/sdk /qr"' -Wait -Verb RunAs + Write-BuildLog "Installing vCenter 5.5 Inventory Service." + Start-Process "B:\VIM_55\Inventory Service\VMware-inventory-service.exe" -argumentList ' /S /L1033 /v" QUERY_SERVICE_NUKE_DATABASE=1 SSO_ADMIN_USER=administrator@vsphere.local SSO_ADMIN_PASSWORD=VMware1! LS_URL=https://vc.lab.local:7444/lookupservice/sdk /qr"' -Wait -Verb RunAs + Write-BuildLog "Installing vCenter 5.5." + Start-Process B:\VIM_55\vCenter-Server\VMware-vcserver.exe -ArgumentList '/S /W /L1033 /v" /qr /norestart WARNING_LEVEL=0 VCS_GROUP_TYPE=Single VPX_ACCOUNT_TYPE=System DB_SERVER_TYPE=Custom DB_DSN=vCenterDB DB_USERNAME=vpx DB_PASSWORD=VMware1! FORMAT_DB=1 IS_URL="https://localhost:10443" SSO_ADMIN_USER=administrator@vsphere.local SSO_ADMIN_PASSWORD=VMware1! VC_ADMIN_USER=administrators@VC VC_ADMIN_IS_GROUP_VPXD_TXT=true LS_URL=https://vc.lab.local:7444/lookupservice/sdk "' -Wait -Verb RunAs + Write-BuildLog "Installing vSphere Client 5.5." + Start-Process B:\VIM_55\redist\vjredist\x64\vjredist64.exe -ArgumentList '/q:a /c:"install.exe /q"' -Wait -Verb RunAs + Start-Process B:\VIM_55\vSphere-Client\VMware-viclient.exe -ArgumentList '/qb /s /w /L1033 /v" /qr"' -Wait -Verb RunAs + $null = mkdir "C:\Program Files (x86)\VMware\Infrastructure\Virtual Infrastructure Client\Plugins\SSHAutoConnect" + $null = copy B:\Automate\vc\SSHAutoConnect\*.* "C:\Program Files (x86)\VMware\Infrastructure\Virtual Infrastructure Client\Plugins\SSHAutoConnect" + If ($DeployVUM) { + Write-BuildLog "Installing vSphere Client 5.5 VUM Plugin." + Start-Process B:\VIM_55\updateManager\VMware-UMClient.exe -ArgumentList '/qb /s /w /L1033 /v" /qr"' -Wait -Verb RunAs + Write-BuildLog "Installing vCenter Update Manager 5.5." + $Arguments = '""/L1033 /v" /qr VMUM_SERVER_SELECT=vc.lab.local VC_SERVER_IP=vc.lab.local VC_SERVER_ADMIN_USER=\"VC\administrator\" VC_SERVER_ADMIN_PASSWORD=' + $AdminPWD +' VCI_DB_SERVER_TYPE=Custom VCI_FORMAT_DB=1 DB_DSN=VUM DB_USERNAME=vpx DB_PASSWORD=VMware1!"' + Start-Process B:\VIM_55\updateManager\VMware-UpdateManager.exe -ArgumentList $Arguments -Wait -Verb RunAs + } + Write-BuildLog "Installing vSphere Web Client Integration plugin." + copy "C:\Program Files\VMware\Infrastructure\vSphereWebClient\server\work\deployer\s\global\72\0\container-app-war-5.5.0.war\vmrc\VMware-ClientIntegrationPlugin-5.5.0.exe" c:\ + Start-Process C:\VMware-ClientIntegrationPlugin-5.5.0.exe -ArgumentList '/v/qn' -Wait -Verb RunAs + if (Test-Path "b:\VMware-PowerCLI-5.8.*.exe") { + Write-BuildLog "VMware PowerCLI installer found; installing." + Start-Process (Get-ChildItem b:\VMware-PowerCLI-5.8.*.exe).FullName -ArgumentList '/q /s /w /L1033 /V" /qb"' -Wait -Verb RunAs + } elseif (Test-Path "b:\VMware-PowerCLI-5.5.*.exe") { + Write-BuildLog "VMware PowerCLI installer found; installing." + Start-Process (Get-ChildItem b:\VMware-PowerCLI-5.5.*.exe).FullName -ArgumentList '/q /s /w /L1033 /V" /qb"' -Wait -Verb RunAs + } elseif (Test-Path "b:\VMware-PowerCLI-5.0.*.exe"){ + Write-BuildLog "PowerCLI installer is out of date, installing anyway." + Start-Process (Get-ChildItem b:\VMware-PowerCLI-5.0.*.exe).FullName -ArgumentList '/q /s /w /L1033 /V" /qb"' -Wait -Verb RunAs + } else { If ((Read-Host "Would you like to go to the PowerCLI download site (y/n)?") -like "y") { + $IE=new-object -com internetexplorer.application + $IE.navigate2("https://my.vmware.com/group/vmware/get-download?downloadGroup=PCLI58R1") + $IE.visible=$true + } Else { + Write-Host "OK, but the build will not work correctly without PowerCLI" + } + } + } + 51 { + Write-BuildLog "Starting vCenter 5.1 automation." + if (Test-Path "b:\VIM_51\redist\SQLEXPR\SQLEXPR_x64_ENU.exe") { + Write-BuildLog "SQL Server 2008 R2 Express SP1 for vCenter 5.1 found; installing." + Start-Process b:\VIM_51\redist\SQLEXPR\SQLEXPR_x64_ENU.exe -ArgumentList '/extract:c:\temp /quiet' -Wait -Verb RunAs + if (Test-Path "C:\temp\pcusource\1033_enu_lp\x64\setup\x64\sqlncli.msi") { + copy C:\temp\pcusource\1033_enu_lp\x64\setup\x64\sqlncli.msi c:\temp + } elseif (Test-Path "C:\temp\1033_enu_lp\x64\setup\x64\sqlncli.msi") { + copy C:\temp\1033_enu_lp\x64\setup\x64\sqlncli.msi c:\temp + } + if (Test-Path "C:\temp\sqlncli.msi") { + Write-BuildLog "Installing SQL native client." + Start-Process msiexec -ArgumentList '/i C:\temp\sqlncli.msi ADDLOCAL=ALL IACCEPTSQLNCLILICENSETERMS=YES /qb' -Wait -Verb RunAs + regedit -s B:\Automate\vc\vCenterDB.reg + } + } else { + Write-BuildLog "SQL Server 2008 R2 Express SP1 for vCenter 5.1 not found. Exiting." + Read-Host "Press <Enter> to exit" + exit + } + Write-BuildLog "Installing vCenter 5.1 Single Sign On." + Start-Process "B:\VIM_51\Single Sign On\VMware-SSO-Server.exe" -ArgumentList '/L1033 /v"/qb MASTER_PASSWORD=VMware1! CONFIRM_MASTER_PASSWORD=VMware1! CONFIG_TYPE=Setup SETUP_TYPE=Basic SSO_DB_SERVER_TYPE=\"Custom\" JDBC_DBTYPE=Mssql JDBC_DBNAME=RSA JDBC_HOSTNAME_OR_IP=DC JDBC_HOST_PORT=1433 JDBC_USERNAME=RSA_USER JDBC_PASSWORD=VMware1! SKIP_DB_USER_CREATION=1 DBA_JDBC_USERNAME=RSA_DBA DBA_JDBC_PASSWORD=VMware1! COMPUTER_FQDN=vc.lab.local IS_SSPI_NETWORK_SERVICE_ACCOUNT=1 SSO_HTTPS_PORT=7444"' -Wait -Verb RunAs + Write-BuildLog "Add AD to SSO since the installer failed to add" + Start-Process "C:\Program Files\VMware\Infrastructure\SSOServer\utils\rsautil" -ArgumentList ' manage-identity-sources -a create -u admin -p VMware1! -r ldap://dc.lab.local --ldap-port 3268 -d lab.local -l LAB --principal-base-dn dc=lab,dc=local --group-base-dn dc=lab,dc=local -f ldap://dc2.lab.local -L administrator@lab.local -P VMware1!' -Wait -Verb RunAs + Write-BuildLog "Installing vCenter 5.1 Web Client." + Start-Process B:\VIM_51\vSphere-WebClient\VMware-WebClient.exe -ArgumentList '/L1033 /v" HTTP_PORT=9090 HTTPS_PORT=9443 SSO_ADMIN_USER=admin@System-Domain SSO_ADMIN_PASSWORD=VMware1! LS_URL=https://vc.lab.local:7444/lookupservice/sdk /qr"' -Wait -Verb RunAs + Write-BuildLog "Installing vCenter 5.1 Inventory Service." + Start-Process "B:\VIM_51\Inventory Service\VMware-inventory-service.exe" -ArgumentList '/L1033 /v" HTTPS_PORT=10443 XDB_PORT=10109 FEDERATION_PORT=10111 QUERY_SERVICE_NUKE_DATABASE=1 TOMCAT_MAX_MEMORY_OPTION=S SSO_ADMIN_USER=admin@System-Domain SSO_ADMIN_PASSWORD=VMware1! LS_URL=https://vc.lab.local:7444/lookupservice/sdk /qr"' -Wait -Verb RunAs + Write-BuildLog "Installing vCenter 5.1." + Start-Process B:\VIM_51\vCenter-Server\VMware-vcserver.exe -ArgumentList '/L1033 /v" /qr DB_SERVER_TYPE=Custom DB_DSN=vCenterDB DB_USERNAME=vpx DB_PASSWORD=VMware1! FORMAT_DB=1 JVM_MEMORY_OPTION=S SSO_ADMIN_USER=admin@System-Domain SSO_ADMIN_PASSWORD=VMware1! LS_URL=https://vc.lab.local:7444/lookupservice/sdk IS_URL=https://vc.lab.local:10443 VC_ADMIN_USER=administrator@vc VC_ADMIN_IS_GROUP_VPXD_TXT=0 VPX_USES_SYSTEM_ACCOUNT=1 VCS_GROUP_TYPE=Single VCS_ADAM_LDAP_PORT=389 VCS_ADAM_SSL_PORT=636 VCS_HTTPS_PORT=443 VCS_HTTP_PORT=80 TC_HTTP_PORT=8080 TC_HTTPS_PORT=8443 VCS_WSCNS_PORT=60099 VCS_HEARTBEAT_PORT=902"' -Wait -Verb RunAs + Write-BuildLog "Installing vSphere Client 5.1." + Start-Process B:\VIM_51\redist\vjredist\x64\vjredist64.exe -ArgumentList '/q:a /c:"install.exe /q"' -Wait -Verb RunAs + Start-Process B:\VIM_51\vSphere-Client\VMware-viclient.exe -ArgumentList '/qb /s /w /L1033 /v" /qr"' -Wait -Verb RunAs + $null = mkdir "C:\Program Files (x86)\VMware\Infrastructure\Virtual Infrastructure Client\Plugins\SSHAutoConnect" + $null = copy B:\Automate\vc\SSHAutoConnect\*.* "C:\Program Files (x86)\VMware\Infrastructure\Virtual Infrastructure Client\Plugins\SSHAutoConnect" + If ($DeployVUM) { + Write-BuildLog "Installing vSphere Client 5.1 VUM Plugin." + Start-Process B:\VIM_51\updateManager\VMware-UMClient.exe -ArgumentList '/qb /s /w /L1033 /v" /qr"' -Wait -Verb RunAs + Write-BuildLog "Installing vCenter Update Manager 5.1." + $Arguments = '/L1033 /v" /qr VMUM_SERVER_SELECT=vc.lab.local VC_SERVER_IP=vc.lab.local VC_SERVER_ADMIN_USER=\"vc\administrator\" VC_SERVER_ADMIN_PASSWORD=' + $AdminPWD +' VCI_DB_SERVER_TYPE=Custom VCI_FORMAT_DB=1 DB_DSN=VUM DB_USERNAME=vpx DB_PASSWORD=VMware1!"' + Start-Process B:\VIM_51\updateManager\VMware-UpdateManager.exe -ArgumentList $Arguments -Wait -Verb RunAs + } + Write-BuildLog "Installing vSphere Web Client Integration plugin." + copy "C:\Program Files\VMware\Infrastructure\vSphereWebClient\server\work\org.eclipse.virgo.kernel.deployer_3.0.3.RELEASE\staging\global\bundle\com.vmware.vsphere.client.containerapp\5.1.0\container-app-war-5.1.0.war\vmrc\VMware-ClientIntegrationPlugin-5.1.0.exe" c:\ + Start-Process C:\VMware-ClientIntegrationPlugin-5.1.0.exe -ArgumentList '/v/qn' -Wait -Verb RunAs + if (Test-Path "b:\VMware-PowerCLI-5.1.*.exe") { + Write-BuildLog "VMware PowerCLI installer found; installing." + Start-Process (Get-ChildItem b:\VMware-PowerCLI-5.1.*.exe).FullName -ArgumentList '/q /s /w /L1033 /V" /qb"' -Wait -Verb RunAs + } elseif (Test-Path "b:\VMware-PowerCLI-5.0.*.exe"){ + Write-BuildLog "PowerCLI installer is out of date, installing anyway." + Start-Process (Get-ChildItem b:\VMware-PowerCLI-5.0.*.exe).FullName -ArgumentList '/q /s /w /L1033 /V" /qb"' -Wait -Verb RunAs + } else {Write-BuildLog "PowerCLI installer not found."} + } + 5 { + Write-BuildLog "Starting vCenter 5 automation." + if (Test-Path "b:\VIM_50\redist\SQLEXPR\SQLEXPR_x64_ENU.exe") { + Write-BuildLog "SQL Server 2008 R2 Express SP1 for vCenter 5.0 found; installing." + Start-Process b:\VIM_50\redist\SQLEXPR\SQLEXPR_x64_ENU.exe -ArgumentList '/extract:c:\temp /quiet' -Wait -Verb RunAs + if (Test-Path "C:\temp\pcusource\1033_enu_lp\x64\setup\x64\sqlncli.msi") { + Write-BuildLog "Installing SQL native client." + Start-Process msiexec -ArgumentList ' /i C:\temp\pcusource\1033_enu_lp\x64\setup\x64\sqlncli.msi ADDLOCAL=ALL IACCEPTSQLNCLILICENSETERMS=YES /qb' -Wait -Verb RunAs + regedit -s B:\Automate\vc\vCenterDB.reg + } elseif (Test-Path "C:\temp\1033_enu_lp\x64\setup\x64\sqlncli.msi") { + Write-BuildLog "Installing SQL native client." + Start-Process msiexec -ArgumentList '/i C:\temp\1033_enu_lp\x64\setup\x64\sqlncli.msi ADDLOCAL=ALL IACCEPTSQLNCLILICENSETERMS=YES /qb' -Wait -Verb RunAs + regedit -s B:\Automate\vc\vCenterDB.reg + } + } else { + Write-BuildLog "SQL Server 2008 R2 Express SP1 for vCenter 5.0 not found. Exiting." + Read-Host "Press <Enter> to exit" + exit + } + Write-BuildLog "Installing vCenter and vSphere client." + copy b:\automate\vc\vc50.cmd c:\ + start-process c:\vc50.cmd -Wait -verb RunAs + if (Test-Path "b:\VMware-PowerCLI-5.0.*.exe"){ + Write-BuildLog "VMware PowerCLI installer found; installing." + Start-Process (Get-ChildItem b:\VMware-PowerCLI-5.0.*.exe).FullName -ArgumentList '/q /s /w /L1033 /V" /qb"' -Wait -Verb RunAs + } else {Write-BuildLog "PowerCLI installer not found."} +} + 4 { + Write-BuildLog "Starting vCenter 4.1 automation." + if (Test-Path "b:\VIM_41\redist\SQLEXPR\x64\SQLEXPR.EXE") { + Write-BuildLog "SQL Server 2005 Express for vCenter 4.1 found; installing." + Start-Process b:\VIM_41\redist\SQLEXPR\x64\SQLEXPR.EXE -ArgumentList '/extract:c:\temp /quiet' -Wait -Verb RunAs + if (Test-Path c:\temp\setup\sqlncli_x64.msi) { + Start-Process msiexec -ArgumentList '/i C:\temp\setup\sqlncli_x64.msi ADDLOCAL=ALL IACCEPTSQLNCLILICENSETERMS=YES /qb' -Wait -Verb RunAs + } + } else { + Write-BuildLog "SQL Server 2005 Express for vCenter 4.1 not found. Exiting." + Read-Host "Press <Enter> to exit" + exit + } + copy b:\automate\vc\vc41.cmd c:\ + start-process c:\vc41.cmd -Wait -verb RunAs + if (Test-Path "b:\VMware-PowerCLI-5.0.*.exe"){ + Write-BuildLog "VMware PowerCLI installer found; installing." + Start-Process (Get-ChildItem b:\VMware-PowerCLI-5.0.*.exe).FullName -ArgumentList '/q /s /w /L1033 /V" /qb"' -Wait -Verb RunAs + } else {Write-BuildLog "PowerCLI installer not found."} +} + Base { + if (Test-Path "b:\VIM_55\redist\SQLEXPR\SQLEXPR_x64_ENU.exe") { + Write-BuildLog "SQL Server 2008 R2 Express SP1 for vCenter 5.5 found; installing." + Start-Process b:\VIM_55\redist\SQLEXPR\SQLEXPR_x64_ENU.exe -ArgumentList '/extract:c:\temp /quiet' -Wait -Verb RunAs + if (Test-Path "C:\temp\pcusource\1033_enu_lp\x64\setup\x64\sqlncli.msi") { + copy C:\temp\pcusource\1033_enu_lp\x64\setup\x64\sqlncli.msi c:\temp + } elseif (Test-Path "C:\temp\1033_enu_lp\x64\setup\x64\sqlncli.msi") { + copy C:\temp\1033_enu_lp\x64\setup\x64\sqlncli.msi c:\temp + } + if (Test-Path "C:\temp\sqlncli.msi") { + Write-BuildLog "Installing SQL native client." + Start-Process msiexec -ArgumentList '/i C:\temp\sqlncli.msi ADDLOCAL=ALL IACCEPTSQLNCLILICENSETERMS=YES /qb' -Wait -Verb RunAs + } + } ElseIf (Test-Path "b:\VIM_51\redist\SQLEXPR\SQLEXPR_x64_ENU.exe") { + Write-BuildLog "SQL Server 2008 R2 Express SP1 for vCenter 5.1 found; installing." + Start-Process b:\VIM_51\redist\SQLEXPR\SQLEXPR_x64_ENU.exe -ArgumentList '/extract:c:\temp /quiet' -Wait -Verb RunAs + if (Test-Path "C:\temp\pcusource\1033_enu_lp\x64\setup\x64\sqlncli.msi") { + copy C:\temp\pcusource\1033_enu_lp\x64\setup\x64\sqlncli.msi c:\temp + } elseif (Test-Path "C:\temp\1033_enu_lp\x64\setup\x64\sqlncli.msi") { + copy C:\temp\1033_enu_lp\x64\setup\x64\sqlncli.msi c:\temp + } + if (Test-Path "C:\temp\sqlncli.msi") { + Write-BuildLog "Installing SQL native client." + Start-Process msiexec -ArgumentList '/i C:\temp\sqlncli.msi ADDLOCAL=ALL IACCEPTSQLNCLILICENSETERMS=YES /qb' -Wait -Verb RunAs + } + } elseif (Test-Path "b:\VIM_50\redist\SQLEXPR\SQLEXPR_x64_ENU.exe") { + Write-BuildLog "SQL Server 2008 R2 Express SP1 for vCenter 5.0 found; installing." + Start-Process b:\VIM_50\redist\SQLEXPR\SQLEXPR_x64_ENU.exe -ArgumentList '/extract:c:\temp /quiet' -Wait -Verb RunAs + if (Test-Path "C:\temp\pcusource\1033_enu_lp\x64\setup\x64\sqlncli.msi") { + Write-BuildLog "Installing SQL native client." + Start-Process msiexec -ArgumentList ' /i C:\temp\pcusource\1033_enu_lp\x64\setup\x64\sqlncli.msi ADDLOCAL=ALL IACCEPTSQLNCLILICENSETERMS=YES /qb' -Wait -Verb RunAs + } elseif (Test-Path "C:\temp\1033_enu_lp\x64\setup\x64\sqlncli.msi") { + Write-BuildLog "Installing SQL native client." + Start-Process msiexec -ArgumentList '/i C:\temp\1033_enu_lp\x64\setup\x64\sqlncli.msi ADDLOCAL=ALL IACCEPTSQLNCLILICENSETERMS=YES /qb' -Wait -Verb RunAs + regedit -s B:\Automate\vc\vCenterDB.reg + } + } elseif (Test-Path "b:\VIM_41\redist\SQLEXPR\x64\SQLEXPR.EXE") { + Write-BuildLog "SQL Server 2005 Express for vCenter 4.1 found; installing." + Start-Process b:\VIM_41\redist\SQLEXPR\x64\SQLEXPR.EXE -ArgumentList '/extract:c:\temp /quiet' -Wait -Verb RunAs + if (Test-Path c:\temp\setup\sqlncli_x64.msi) { + Start-Process msiexec -ArgumentList '/i C:\temp\setup\sqlncli_x64.msi ADDLOCAL=ALL IACCEPTSQLNCLILICENSETERMS=YES /qb' -Wait -Verb RunAs + regedit -s B:\Automate\vc\vCenterDB.reg + } + } + } + None {} +} +If ($viewinstall -ne "None") { + $Files = get-childitem "b:\view$viewinstall" + for ($i=0; $i -lt $files.Count; $i++) { + If ($Files[$i].Name -like "VMware-viewcomposer*") {$Installer = $Files[$i].FullName} + } +} +switch ($viewinstall) { + 60 { + if (Test-Path "B:\View60\VMware-viewcomposer-*.exe") { + Write-BuildLog "Setup install VMware View 6.0 Composer, reboot required before install" + copy-item $Installer C:\ + Write-BuildLog "Setup script recall for Phase 2 completion" + reg add HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce /v Build /t REG_SZ /d "cmd /c c:\Build.cmd" /f >> c:\buildlog.txt + } + } 53 { + if (Test-Path "B:\View53\VMware-viewcomposer-5.3*.exe") { + Write-BuildLog "Setup install VMware View 5.3 Composer, reboot required before install" + copy-item $Installer C:\ + Write-BuildLog "Setup script recall for Phase 2 completion" + reg add HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce /v Build /t REG_SZ /d "cmd /c c:\Build.cmd" /f >> c:\buildlog.txt + } + } 52 { + if (Test-Path "B:\View52\VMware-viewcomposer-5.2*.exe") { + Write-BuildLog "Setup install VMware View 5.2 Composer, reboot required before install" + copy-item $Installer C:\ + Write-BuildLog "Setup script recall for Phase 2 completion" + reg add HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Runonce /v Build /t REG_SZ /d "cmd /c c:\Build.cmd" /f >> c:\buildlog.txt + } + } + 51 { + if (Test-Path "B:\View51\VMware-viewcomposer-3.0*.exe") { + Write-BuildLog "Installing VMware View 5.1 Composer" + Start-Process B:\View51\VMware-viewcomposer-3.0.0-691993.exe -ArgumentList '/s /v" /qn AgreeToLicense="Yes" DB_USERNAME="VMview" DB_PASSWORD="VMware1!" DB_DSN="ViewComposer" REBOOT="ReallySuppress" "' -Wait -Verb RunAs + } + } + 50 { + if (Test-Path "B:\View50\VMware-viewcomposer-2.7*.exe") { + Write-BuildLog "Installing VMware View 5.0 Composer" + Start-Process B:\View50\VMware-viewcomposer-2.7.0-481620.exe -ArgumentList '/s /v" /qn AgreeToLicense="Yes" DB_USERNAME="VMview" DB_PASSWORD="VMware1!" DB_DSN="ViewComposer" REBOOT="ReallySuppress" "' -Wait -Verb RunAs + } + } + None {} +} + +if (Test-Path "b:\VMware-vSphere-CLI.exe") { + Write-BuildLog "VMware vSphere CLI installer found; installing." + Start-Process b:\VMware-vSphere-CLI.exe -ArgumentList '/S /v/qb' -Wait -Verb RunAs +} else { + Write-BuildLog "VMware vSphere CLI installer not found." +} + +Write-BuildLog "Adding Domain Admins to vCenter administrators role and setting PowerCLI certificate warning." +if (!(($vcinstall -eq "None") -or ($vcinstall -eq "Base"))) { + Add-PSSnapin VMware.VimAutomation.Core + $PCLIVer = Get-PowerCLIVersion + if ((($PCLIVer.Major * 10 ) + $PCLIVer.Minor) -ge 51) { + $null = Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -confirm:$false -Scope "AllUsers" + } + If ($vcinstall -eq "60") { + $null = connect-viserver vc.lab.local -user administrator@vsphere.local -password VMware1! + $null = New-VIPermission -Role Admin -Principal 'Administrator' -Entity Datacenters + $null = Disconnect-VIServer -Server * -confirm:$false + If ($DeployVUM) { + Write-BuildLog "Installing vCenter Update Manager 6.0." + if ((([System.Environment]::OSVersion.Version.Major *10) +[System.Environment]::OSVersion.Version.Minor) -ge 62) { + Start-Process B:\VIM_60\redist\dotnet\dotnetfx35.exe -ArgumentList " /qb /norestart" -Wait -Verb RunAs + } Else { + import-module ServerManager + Add-WindowsFeature AS-NET-Framework + } + $Arguments = '""/L1033 /v" /qr VMUM_SERVER_SELECT=vc.lab.local VC_SERVER_IP=vc.lab.local VC_SERVER_ADMIN_USER=\"VC\administrator\" VC_SERVER_ADMIN_PASSWORD=' + $AdminPWD +' VCI_DB_SERVER_TYPE=Custom VCI_FORMAT_DB=1 DB_DSN=VUM DB_USERNAME=vpx DB_PASSWORD=VMware1!"' + Start-Process B:\VIM_60\updateManager\VMware-UpdateManager.exe -ArgumentList $Arguments -Wait -Verb RunAs + } + } ElseIf ($vcinstall -eq "55") { + $null = connect-viserver vc.lab.local -user vc\administrator -password $AdminPWD + $null = New-VIPermission -Role Admin -Principal 'lab\Domain Admins' -Entity Datacenters + $null = Disconnect-VIServer -Server * -confirm:$false + } ElseIf ($vcinstall -eq "51") { + $null = connect-viserver vc.lab.local -user vc\administrator -password $AdminPWD + $null = New-VIPermission -Role Admin -Principal 'Administrators' -Entity Datacenters + $null = Disconnect-VIServer -Server * -confirm:$false + } Else { + $null = connect-viserver vc.lab.local -user vc\administrator -password $AdminPWD + $null = New-VIPermission -Role Admin -Principal 'lab\Domain Admins' -Entity Datacenters + $null = New-VIPermission -Role Admin -Principal 'Administrator' -Entity Datacenters + $null = Disconnect-VIServer -Server * -confirm:$false + } +} + +if ($buildvm -and (Test-Path B:\Win2k3.iso)) { + Write-BuildLog "Creating fully automated Windows 2003 install ISO." + $null = New-Item -Path c:\temp\Win2K3 -ItemType Directory -Force + cd c:\temp\Win2K3 + . "C:\Program Files\7-Zip\7z.exe" x -r -y -aoa b:\win2k3.iso >> c:\temp\Extractlog.txt + cmd /c copy c:\temp\Win2K3\[BOOT]\Bootable_NoEmulation.img c:\temp\Win2K3\win2k3.img + if (!(Test-Path b:\Auto2K3.iso)) { + Copy-Item -Path C:\temp\Auto2K3.sif -Destination c:\temp\Win2K3\i386\winnt.sif -Force + Copy-Item B:\Automate\_Common\Auto2K3.cmd c:\temp\Win2k3 + b:\automate\vc\mkisofs -b win2k3.img -c boot.catalog -hide boot.catalog -no-emul-boot -boot-load-seg 1984 -boot-load-size 4 -iso-level 2 -J -l -D -N -joliet-long -quiet -relaxed-filenames -V "WIN2K3" -o b:\Auto2K3.iso . + } + if (!(Test-Path b:\Windows2K3.iso)) { + Write-BuildLog "Creating Lab Windows 2003 install ISO" + Copy-Item -Path C:\temp\Lab2K3.sif -Destination c:\temp\Win2K3\i386\winnt.sif -Force + Copy-Item -Path B:\Automate\_Common\extpart.exe -Destination c:\temp\Win2K3\ -Force + Copy-Item -Path B:\Automate\_Common\cpubusy.vbs -Destination c:\temp\Win2K3\ -Force + Copy-Item -Path B:\Automate\_Common\iometer.exe -Destination c:\temp\Win2K3\ -Force + Copy-Item -Path B:\Automate\_Common\Nested.reg -Destination c:\temp\Win2K3\ -Force + b:\automate\vc\mkisofs -b win2k3.img -c boot.catalog -hide boot.catalog -no-emul-boot -boot-load-seg 1984 -boot-load-size 4 -iso-level 2 -J -l -D -N -joliet-long -quiet -relaxed-filenames -V "WIN2K3" -o b:\Windows2K3.iso . + } + if (Test-Path "C:\ProgramData\VMware\VMware VirtualCenter\sysprep\svr2003") { + Write-BuildLog "Setting up sysprep for Windows 2003." + expand -r c:\temp\Win2K3\Support\Tools\deploy.cab -f:* "C:\ProgramData\VMware\VMware VirtualCenter\sysprep\svr2003" >> c:\temp\Extractlog.txt + } elseif (Test-Path "C:\ProgramData\VMware\vCenterServer\cfg\vmware-vpx\sysprep\svr2003") { + Write-BuildLog "Setting up sysprep for Windows 2003." + expand -r c:\temp\Win2K3\Support\Tools\deploy.cab -f:* "C:\ProgramData\VMware\vCenterServer\cfg\vmware-vpx\sysprep\svr2003" >> c:\temp\Extractlog.txt + } else { + copy c:\temp\Win2K3\Support\Tools\deploy.cab c:\ + } +} +if ($buildviewvm -and (Test-Path B:\WinXP.iso)) { + $null = New-Item -Path c:\temp\WinXP -ItemType Directory -Force + cd c:\temp\WinXP + . "C:\Program Files\7-Zip\7z.exe" x -r -y -aoa b:\winXP.iso >> c:\temp\Extractlog.txt + if (Test-Path "C:\ProgramData\VMware\VMware VirtualCenter\sysprep\xp") { + Write-BuildLog "Setting up sysprep for Windows XP." + expand -r c:\temp\WinXP\Support\Tools\deploy.cab -f:* "C:\ProgramData\VMware\VMware VirtualCenter\sysprep\xp" >> c:\temp\Extractlog.txt + } elseif (Test-Path "C:\ProgramData\VMware\vCenterServer\cfg\vmware-vpx\sysprep\xp") { + Write-BuildLog "Setting up sysprep for Windows XP." + expand -r c:\temp\WinXP\Support\Tools\deploy.cab -f:* "C:\ProgramData\VMware\vCenterServer\cfg\vmware-vpx\sysprep\xp" >> c:\temp\Extractlog.txt + } + if (!(Test-Path b:\AutoXP.iso)){ + Write-BuildLog "Creating fully automated Windows XP install ISO for VMware View" + cmd /c copy c:\temp\WinXP\[BOOT]\Bootable_NoEmulation.img c:\temp\WinXP\winXP.img + rd c:\temp\WinXP\[BOOT] + Move-Item -Path C:\temp\AutoXP.sif -Destination c:\temp\WinXP\i386\winnt.sif + $null = New-Item -Path C:\temp\WinXP\$OEM$ -ItemType Directory -Force + $null = New-Item -Path C:\temp\WinXP\$OEM$\TEXTMODE -ItemType Directory -Force + copy B:\Automate\_Common\XPDrivers\*.* C:\temp\WinXP\$OEM$\TEXTMODE\ + copy B:\Automate\_Common\AutoXP.cmd C:\temp\WinXP\ + cd c:\temp\WinXP + b:\automate\vc\mkisofs -b winXP.img -c boot.catalog -hide boot.catalog -no-emul-boot -boot-load-seg 1984 -boot-load-size 4 -iso-level 2 -J -l -D -N -joliet-long -quiet -relaxed-filenames -V "WINXP" -o b:\AutoXP.iso . + } + cd c:\ +} + +Write-BuildLog "Cleanup and creating Desktop shortcuts." +regedit -s b:\Automate\vc\vSphereClient.reg +Remove-Item "C:\Users\Public\Desktop\*.lnk" +Remove-Item c:\eula*.* +Remove-Item c:\install*.* +Remove-Item c:\VC* +Remove-Item c:\VMware-ClientIntegrationPlugin*.exe +Remove-Item c:\temp\* -Force -Recurse +copy b:\Automate\vc\Shortcuts.vbs c:\Shortcuts.vbs +wscript c:\Shortcuts.vbs +copy b:\Automate\*.ps1 c:\ + +Write-BuildLog "Disable Internet Explorer Enhanced Security to allow access to Web Client" +$AdminKey = "HKLM:\SOFTWARE\Microsoft\Active Setup\Installed Components\{A509B1A7-37EF-4b3f-8CFC-4F3A74704073}" +$UserKey = "HKLM:\SOFTWARE\Microsoft\Active Setup\Installed Components\{A509B1A8-37EF-4b3f-8CFC-4F3A74704073}" +Set-ItemProperty -Path $AdminKey -Name "IsInstalled" -Value 0 +Set-ItemProperty -Path $UserKey -Name "IsInstalled" -Value 0 + +If (($AutoAddHosts -eq "True") -and (Test-Path "c:\Addhosts.ps1")){ + Write-BuildLog " " + Write-BuildLog "Automatically running AddHosts script." + Write-BuildLog " " + Start-Process c:\windows\syswow64\WindowsPowerShell\v1.0\powershell.exe -ArgumentList " C:\AddHosts.ps1" -wait +} +If ($AutovCNS -eq "True"){ + Write-BuildLog "vShield" + If (($VCInstall -eq "51") -and (Test-Path "C:\vShield51.ps1")) { + Write-BuildLog "Automatically deploying vShield 5.1." + Start-Process c:\windows\syswow64\WindowsPowerShell\v1.0\powershell.exe -ArgumentList " C:\vShield51.ps1" -wait + } + If (($VCInstall -eq "5") -and (Test-Path "C:\vShield15.ps1")) { + Write-BuildLog "Automatically deploying vShield 5.0." + . "C:\vShield15.ps1" + } +} +Write-BuildLog "Installing VMware tools, build complete after reboot." +if (Test-Path B:\VMTools\setup64.exe) { + #Read-Host "End of install checkpoint, before VMTools" + Start-Process B:\VMTools\setup64.exe -ArgumentList '/s /v "/qn"' -verb RunAs -Wait +} + +Read-Host "Computer will restart when VMware Tools is installed" +exit \ No newline at end of file diff --git a/Build/Automate/VC/Derek-SSL.ps1 b/Build/Automate/VC/Derek-SSL.ps1 new file mode 100644 index 0000000..cdf1378 --- /dev/null +++ b/Build/Automate/VC/Derek-SSL.ps1 @@ -0,0 +1,1059 @@ +# Creates vCenter 5.5 certificates and related files +# Do not use with vCenter 5.1. Run on the vCenter 5.5 server. +# +# Derek Seaman, VCDX #125, www.derekseaman.com +# vSphere 5.5 Install series: vexpert.me/Derek55 +# For full instructions see Part 8 & 9 in the vSphere 5.5 install series +# Download the latest version from: vexpert.me/toolkit55 +# +# v1.59 August 9, 2014 +# Updated OpenSSL download to 0.9.8.zb +# Added check for PowerShell 3.0 (minimum requirement) +# +# v1.58 July 12, 2014 +# Updated OpenSSL download to 0.9.8za +# Removed SQL 2012 SP1 client download (link broken) +# Fixed Database creation script bug +# Added additional error handling and Powershell-ized more commands +# Changed the sts.properties file to use sts in the URI per KB2058519 +# +# v1.57 February 14, 2014 +# More robust handling of non-internet connected systems +# Removed line continuation characters +# +# v1.56 January 19, 2014 +# Fixed bug when no subordinate CA was present (Thanks Troy) +# Changed Microsoft "renewal" default to 0 for root/subordinate +# +# v1.55 January 12, 2014 +# Added additional CA/subordinate error checking +# +# v1.50 December 22, 2013 +# Added ESXi host support +# +# v1.42 December 3, 2013 +# Modified how the certificate hash files are created +# Added Authentication Proxy certificate generation +# Changed MS CA download parameter to Renewal=1 +# +# v1.41 November 14, 2013 +# Changed the root/intermediate CA download order and added more error checking +# +# v1.40 November 10, 2013 +# Added Auto Deploy, Dump Collector and Syslog collector SSL certs for Windows +# Added support for CA approval of submitted requests (Thanks Ryan Bolger) +# Added SHA512 request in CSR creation +# Ask for vCenter name when selecting Option 3 +# +# v1.31 Octover 29, 2013 +# Bugfix in option #2 where CSRs would fail to create +# +# v1.3 October 22, 2013 +# Added basic support for vCenter Server Appliance cert minting/CSR +# Added support for manually entering vCenter FQDN +# Changed method of building the automatic vCenter FQDN +# +# v1.2 October 19, 2013 +# Added SQL database script creation +# Added vCenter/VUM DSN creation +# +# v1.1 October 10, 2013 Changes: +# Added IP address support for SAN field +# Added configurable CA download method (HTTP or HTTPS) +# Skips Root/subordinate certificate download if files already exist +# +# +[CmdletBinding()] +param() + +# Directory where the certificate folders will be created. Does not need to exist. +$Cert_Dir = "C:\Certs" + +# Path to your existing Open SSL directory. It may be c:\OpenSSL-Win32, too +# If OpenSSL is not located in this directory it will be downloaded and installed +$openssldir = "C:\OpenSSL" + +# Modify these Certificate Details for your environment +$Country="NZ" +$State="BoP" +$City="Tauranga" +$org="AutoLab" + +# If you want the vCenter server IP address included in the certificate set +# the value to the appropriate IP. If you don't want an IP, comment out the line. +# This applies to Windows vCenter and the vCenter Appliance. +$vCenterIP="192.168.199.5" + +# The URLs where your Root and Subordinate CA certificates can be downloaded. +# If your CA certificates are not available online or you don't have a subordinate +# CA, just comment out the associated lines with a hash. +# +# If you have an online Microsoft CA running the Web Enrollment role service, +# the CA certificate should be downloadable using the following URL: +# http(s)://YourCA.domain/certsrv/certnew.cer?ReqID=CACert&Renewal=0&Enc=b64 +# +# If your have issues with the root certificate downloading, change Renewal=0 +# in the body of the code. Or if the tool is downloading an expired certificate, +# increase the renewal number until it pulls the current certificate. +# +# If you CA doesn't have web services or enabled or it's offline, you can download +# the root and intermediate CA certs manually and place them in the $Cert_Dir. +# Please see Part 9 of my vexpert.me\Derek55 series for details on how to create +# the root/intermediate files in the proper format. +# +$rootCA = "dc.lab.local" +#$SubCA = "subca01.contoso.local" + +# If your CA web enrollment site is not SSL enabled change to HTTP (insecure) +# Ignore if you don't have online Microsoft CAs. +$CADownload = "http" + +# Online Microsoft CA name that will issue the certificates. +# Ignore if you don't have online Microsoft CAs. +$ISSUING_CA = "dc\LabCA" + +# Your VMware CA certificate template name (not the display name; no spaces) +# Ignore if you don't have online Microsoft CAs. +$Template = "CertificateTemplate:VMware-SSL" + +####### +# The magic happens here...don't modify +####### + +# SSO and vCenter administrator usernames. Should not need to change these. +$sso_admin = "administrator@vsphere.local" +$vc_admin = "administrator@vsphere.local" + +$rootcer = "$Cert_Dir\root64.cer" +$intermcer = "$Cert_Dir\interm64.cer" +$openssl = $openssldir+"\bin\openssl.exe" +$ESXUser = "root" +$wc = New-Object System.Net.WebClient +$wc.UseDefaultCredentials = $true +New-Alias -Name OpenSSL $openssl + +$Script:CertsWaitingForApproval = $false + +$WServices = @("vCenterServer","vCenterInventoryService","vCenterSSO","VMwareUpdateManager","vCenterWebClient","vCenterLogBrowser","VMwareOrchestrator","AutoDeploy","DumpCollector","SysLogCollector", "AuthenticationProxy") + +$LServices = @("VMware vCenter Service Certificate","VMware Inventory Service Certificate","VMware LDAP Service Certificate","VMware vCenter VAMI Certificate","vCenter Web Client Service Certificate","VMware Logbrowser Service Certificate","VMware vSphere Autodeploy Service Certificate") + +# Check for PowerShell 3.0 and higher (required) + +$PSpath = "HKLM:\SOFTWARE\Microsoft\PowerShell\3" + +if(!(Test-Path $PSpath)) { + write-host "PowerShell 3.0 or higher required. Please install"; exit + } + +# Download OpenSSL if it's not already installed + +if (!(Test-Path($openssl))) { + Write-Host -Foreground "DarkBlue" -Background "White" "Downloading OpenSSL.." + $null = New-Item -Type Directory $openssldir -erroraction silentlycontinue + $sslurl = "http://slproweb.com/download/Win32OpenSSL-0_9_8zb.exe" + $sslexe = "$env:temp\openssl.exe" + $wc.DownloadFile($sslurl,$sslexe) + $env:path = $env:path + ";$openssldir" + if (!(test-Path($sslexe))) { write-host -Foreground "red" -Background "white" "Could not download or find OpenSSL. Please install OpenSSL 0.9.8y manually."; exit} + Write-Host -Foreground "DarkBlue" -Background "White" "Installing OpenSSL.." + cmd /c $sslexe /silent /verysilent /sp- /suppressmsgboxes + Remove-Item $sslexe +} + +# Create certificate directory if it does not exist + +if(!(Test-Path $Cert_Dir)) { New-Item $Cert_Dir -Type Directory } + +# +# Functions Begin Here +# + +Function CheckOpenSSL { + if (!(Test-Path $openssl)) {throw "Openssl required, unable to download, please install."} +} + +Function WinVCCheck { + +# Validates Windows vCenter SSO is installed + +# Sets SSO filesystem path if SSO is installed +$ssoregpath = "HKLM:\SOFTWARE\VMware, Inc.\VMware Identity Services" + +if(!(Test-Path $ssoregpath)) { + write-host "SSO 5.5 not installed. Please install it first."; exit + } + Else { + $ssoreg = (Get-ItemProperty -Path $ssoregpath) + $Script:ssodir = $ssoreg.InstallPath ; $ssodir= $ssodir -replace ".$" +} + +# Configures JRE keytool alias with path if SSO is installed +$JREregpath = "HKLM:\SOFTWARE\VMware, Inc.\VMware Infrastructure\vJRE" + +if(!(Test-Path $JREregpath)) { + write-host "JRE not installed. Please install SSO 5.5 first."; exit + } + Else { + $JREreg = (Get-ItemProperty -Path $JREregpath) + $JREBinDir = $JREreg.InstallPath ; $JREBinDir= $JREBinDir -replace ".$" + $keytool = $JREBinDir+"\bin\keytool.exe" + New-Alias -Name keytool $keytool -Scope script + } +} + +Function VCFQDN { + +# Construct vCenter server hostname (localhost) and ask for input + +$Computername = get-wmiobject win32_computersystem +$DEFFQDN = "$($computername.name).$($computername.domain)".ToLower() + +$Script:FQDN = $( +Write-Host "Is the vCenter FQDN $DEFFQDN ?" +$Input = Read-Host "Press ENTER to accept or input a new vCenter FQDN" +If ($input) {$input} else {$DEFFQDN} +) + +$POS = $FQDN.IndexOf(".") +$Script:Shortname = $FQDN.Substring(0, $POS) + +} + +Function DownloadRoot +{ + +# Download Root CA public certificate, if defined +# If the certificate exists (root64.cer) then it won't attempt to download + +if ($RootCA) { + + If (!(test-path -Path $rootcer)){ + write-host "Downloading root certificate from $rootca ..." + $url = "$CADownload"+"://$rootCA/certsrv/certnew.cer?ReqID=CACert&Renewal=0&Enc=b64" + $wc.DownloadFile($url,$rootcer) + If (!(test-path -Path $rootcer)) {write-host "Root64.cer did not download. Check Root CA variable, CA web services, or manually download root cert and copy to $Cert_Dir\root64.cer. See vExpert.me/Derek55 Part 9 for more details." -foregroundcolor red;exit} + Write-host "Root CA download successful." -foregroundcolor yellow + } + Else { Write-host "Root CA file found, will not download." -ForegroundColor yellow} + } + $Validation = select-string -simple CERTIFICATE----- $rootcer + If (!$Validation) {write-host "Invalid Root certificate format. Validate BASE64 encoding and try again." -foregroundcolor red; exit} +} + +Function DownloadSub +{ +# Download Subordinate CA public certificate, if defined +# If the certificate exists (interm64.cer) then it won't attempt to download + +if ($SubCA) { + + If (!(test-path -Path $intermcer)){ + write-host "Downloading subordinate certificate from $subca ..." + $url = "$CADownload"+"://$SubCA/certsrv/certnew.cer?ReqID=CACert&Renewal=1&Enc=b64" + $wc.DownloadFile($url,$intermcer) + If (!(test-path -Path $intermcer)) {write-host "Interm64.cer did not download. Check Intermediate CA variable, CA web services, or manually download intermediate cert and copy to $Cert_Dir\interm64.cer. See vExpert.me/Derek55 Part 9 for more details." -foregroundcolor red;exit} + Write-host "Intermediate CA download successful." -foregroundcolor yellow + } + Else { Write-host "Intermediate CA file found, will not download." -ForegroundColor yellow} + + $Validation = select-string -simple CERTIFICATE----- $intermcer + If (!$Validation) {write-host "Invalid subordinate certificate format. Validate BASE64 encoding and try again." -foregroundcolor red; exit} +} +} + +Function CAHashes{ +# Computes CA hash file(s) + +# Skip if we have pending cert requests +if ($Script:CertsWaitingForApproval) { return } + +# Prompt for Root cert if it's not there yet +While (!(Test-Path $rootcer)) { + read-host "Please copy the Root CA certificate root64.cer (Base64 encoded) to $rootcer and press Enter to continue" + } + +$roothash = & OpenSSL x509 -subject_hash -noout -in $rootcer +$hashdest = $roothash + '.0' +copy-item -path $rootcer -Destination $Cert_Dir\$hashdest + +If (Test-Path $intermcer) { + $intermhash = & OpenSSL x509 -subject_hash -noout -in $intermcer + $interdest = $intermhash + '.0' + Copy-Item -Path $intermcer -Destination $Cert_Dir\$interdest + cmd /c copy $intermcer+$rootcer $Cert_Dir\chain.cer + } + +write-host "Root CA hash is $roothash" -foregroundcolor yellow +If ($intermhash) { write-host "Intermediate CA hash is $intermhash" -foregroundcolor yellow } +} + +Function CreateCSR { +# Create RSA private keys and CSRs + +# If IP address is defined, add it to the SAN field +If ($vCenterIP) { $IP = " IP:$vCenterIP, DNS:$vCenterIP," } + +$RequestTemplate = "[ req ] +default_md = sha512 +default_bits = 2048 +default_keyfile = rui.key +distinguished_name = req_distinguished_name +encrypt_key = no +prompt = no +string_mask = nombstr +req_extensions = v3_req + +[ v3_req ] +basicConstraints = CA:FALSE +keyUsage = digitalSignature, keyEncipherment, dataEncipherment +extendedKeyUsage = serverAuth, clientAuth +subjectAltName = DNS:$ShortName,$IP DNS:$FQDN + +[ req_distinguished_name ] +countryName = $Country +stateOrProvinceName = $State +localityName = $City +0.organizationName = $Org +organizationalUnitName = SVCREPLACE +commonName = $FQDN +" + +ForEach ($Service in $Services) { + Set-Location $Cert_Dir + if(!(Test-Path $Service)) { new-Item $Service -Type Directory } + Set-Location $Service + + # Create CSR and private key + $Out = $RequestTemplate -replace "SVCREPLACE", $Service | Out-File "$Cert_Dir\$Service\$Service.cfg" -Encoding Default -Force + OpenSSL req -new -nodes -out "$Cert_Dir\$Service\$Service.csr" -keyout "$Cert_Dir\$Service\rui-orig.key" -config "$Cert_Dir\$Service\$Service.cfg" + OpenSSL rsa -in "$Cert_Dir\$Service\rui-orig.key" -out "$Cert_Dir\$Service\rui.key" + Remove-Item rui-orig.key + } +} + +Function CreateESXCSR { +# Create RSA private keys and CSR + +ForEach ($Service in $Services) { + +$POS = $Service.IndexOf(".") +$Script:Shortname = $Service.Substring(0, $POS) + +$RequestTemplate = "[ req ] +default_md = sha512 +default_bits = 2048 +default_keyfile = rui.key +distinguished_name = req_distinguished_name +encrypt_key = no +prompt = no +string_mask = nombstr +req_extensions = v3_req + +[ v3_req ] +basicConstraints = CA:FALSE +keyUsage = digitalSignature, keyEncipherment, dataEncipherment +extendedKeyUsage = serverAuth, clientAuth +subjectAltName = DNS:$ShortName, DNS:$Service + +[ req_distinguished_name ] +countryName = $Country +stateOrProvinceName = $State +localityName = $City +0.organizationName = $Org +commonName = $Service +" + + Set-Location $Cert_Dir + if(!(Test-Path $Service)) { new-Item $Service -Type Directory } + Set-Location $Service + + # Create CSR and private key + $Out = $RequestTemplate -replace "SVCREPLACE", $Service | Out-File "$Cert_Dir\$Service\$Service.cfg" -Encoding Default -Force + OpenSSL req -new -nodes -out "$Cert_Dir\$Service\$Service.csr" -keyout "$Cert_Dir\$Service\rui-orig.key" -config "$Cert_Dir\$Service\$Service.cfg" + OpenSSL rsa -in "$Cert_Dir\$Service\rui-orig.key" -out "$Cert_Dir\$Service\rui.key" + Remove-Item rui-orig.key + } +} + + +Function OnlineMint { +#Mint certificates from online Microsoft CA + + # initialize objects to use for external processes + $psi = New-Object System.Diagnostics.ProcessStartInfo + $psi.CreateNoWindow = $true + $psi.UseShellExecute = $false + $psi.RedirectStandardOutput = $true + $psi.RedirectStandardError = $true + $process = New-Object System.Diagnostics.Process + $process.StartInfo = $psi + + $certsRequireApproval = $false + + ForEach ($Service in $Services) { + + # submit the CSR to the CA + $psi.FileName = "certreq.exe" + $psi.Arguments = @("-submit -attrib `"$Template`" -config `"$ISSUING_CA`" -f `"$Cert_Dir\$Service\$Service.csr`" `"$Cert_Dir\$Service\rui.crt`"") + write-host "Submitting certificate request for $Service" + [void]$process.Start() + + $cmdOut = $process.StandardOutput.ReadToEnd() + if ($cmdOut.Trim() -like "*request is pending*") + { + # Output indicates the request requires approval before we can download the signed cert. + $Script:CertsWaitingForApproval = $true + + # So we need to save the request ID to use later once they're approved. + $reqID = ([regex]"RequestId: (\d+)").Match($cmdOut).Groups[1].Value + if ($reqID.Trim() -eq [String]::Empty) + { + write-error "Unable to parse RequestId from output." + write-debug $cmdOut + Exit + } + write-host "RequestId: $reqID is pending" -ForegroundColor Yellow + + # Save the request ID to a file that OnlineMintResume can read back in later + $reqID | out-file "$Cert_Dir\$Service\requestid.txt" + } + else + { + # Output doesn't indicate a pending request, so check for a signed cert file + if (!(Test-Path $Cert_Dir\$Service\rui.crt)) { + Write-Error "Certificate request failed or was unable to download the signed certificate." + Write-Error "Verify that the ISSUING_CA variable is set correctly." + Write-Debug $cmdOut + Exit + } + } + + } + + if ($Script:CertsWaitingForApproval) { + write-host + write-host "One or more certificate requests require manual approval before they can be downloaded." + Write-host "Contact your CA administrator to approve the request IDs listed above." + write-host "To resume use Option 3 for Windows vCenter, 9 for vCenter Appliance or 13 for ESXi Hosts" + } + +} + +Function OnlineMintResume { +#Resume the minting process for certificates from online Microsoft CA that required approval + + # initialize objects to use for external processes + $psi = New-Object System.Diagnostics.ProcessStartInfo + $psi.CreateNoWindow = $true + $psi.UseShellExecute = $false + $psi.RedirectStandardOutput = $true + $psi.RedirectStandardError = $true + $process = New-Object System.Diagnostics.Process + $process.StartInfo = $psi + + ForEach ($Service in $Services) { + + # skip if there's no requestid.txt file + if (!(Test-Path "$Cert_Dir\$Service\requestid.txt")) { continue } + + $reqID = Get-Content "$Cert_Dir\$Service\requestid.txt" + write-verbose "Found RequestId: $reqID for $Service" + + # retrieve the signed certificate + $psi.FileName = "certreq.exe" + $psi.Arguments = @("-retrieve -f -config `"$ISSUING_CA`" $reqID `"$Cert_Dir\$Service\rui.crt`"") + write-host "Downloading the signed $Service certificate" + [void]$process.Start() + $cmdOut = $process.StandardOutput.ReadToEnd() + if (!(test-path "$Cert_Dir\$Service\rui.crt")) + { + # it's not there, so check if the request is still pending + if ($cmdOut.Trim() -like "*request is pending*") + { + $Script:CertsWaitingForApproval = $true + write-host "RequestId: $reqID is pending" -ForegroundColor Yellow + } + else + { + write-warning "There was a problem downloading the signed certificate" + write-warning $cmdOut + continue + } + } + + } + + if ($Script:CertsWaitingForApproval) { + write-host + write-host "One or more certificate requests require manual approval before they can be downloaded." + Write-host "Contact your CA administrator to approve the request IDs listed above." + write-host "To resume use Option 3 for Windows vCenter, 9 for vCenter Appliance or 13 for ESXi Hosts" + } +} + +Function CreatePEMFiles { +# Create PEM files and JKS keystore. Rui.crt files must exist for all services. + +# Skip if we have pending cert requests +if ($Script:CertsWaitingForApproval) { return; } + +if (Test-Path $Cert_Dir\chain.cer) { + $chaincer = "$Cert_Dir\chain.cer" + } + Else { + $chaincer = "$Cert_Dir\root64.cer" + } + +ForEach ($Service in $WServices) { + + if (!(test-path $Cert_Dir\$Service\rui.crt)) { + Write-host "$Service rui.crt file not found. Skipping PEM creation. Please correct and re-run." -ForegroundColor Red + continue; + } + elseif ($Service -eq "vCenterSSO") { + OpenSSL pkcs12 -export -in "$Cert_Dir\$Service\rui.crt" -inkey "$Cert_Dir\$Service\rui.key" -certfile "$Chaincer" -name "ssoserver" -passout pass:changeme -out "$Cert_Dir\$Service\ssoserver.p12" + + if (test-path $Cert_Dir\$Service\root-trust.jks) {remove-item $Cert_Dir\$Service\root-trust.jks} + keytool -v -importkeystore -srckeystore $Cert_Dir\$Service\ssoserver.p12 -srcstoretype pkcs12 -srcstorepass changeme -srcalias ssoserver -destkeystore $Cert_Dir\$Service\root-trust.jks -deststoretype JKS -deststorepass testpassword -destkeypass testpassword + keytool -v -importcert -noprompt -keystore $Cert_Dir\$Service\root-trust.jks -deststoretype JKS -storepass testpassword -keypass testpassword -file $rootcer -alias root-ca + Copy-Item -Path $Cert_Dir\$Service\rui.key -Destination $Cert_Dir\$Service\ssoserver.key + + if (test-path -path $intermcer){ + keytool -v -importcert -noprompt -trustcacerts -keystore $Cert_Dir\$Service\root-trust.jks -deststoretype JKS -storepass testpassword -keypass testpassword -file $intermcer -alias intermediate-$intermhash.0 + + } + Copy-Item -Path $Cert_Dir\$Service\root-trust.jks -Destination $Cert_Dir\$Service\server-identity.jks + cmd /c copy $Cert_Dir\$Service\rui.crt+$chaincer $Cert_Dir\$Service\chain.pem + Copy-Item -Path $Cert_Dir\$Service\chain.pem -Destination $Cert_Dir\$Service\ssoserver.crt + } + else { + OpenSSL pkcs12 -export -in "$Cert_Dir\$Service\rui.crt" -inkey "$Cert_Dir\$Service\rui.key" -certfile "$Chaincer" -name "rui" -passout pass:testpassword -out "$Cert_Dir\$Service\rui.pfx" + $RUI = get-content $Cert_Dir\$Service\rui.crt + $ChainCont = get-content $chaincer -encoding default + $RUI + $ChainCont | out-file $Cert_Dir\$Service\chain.pem -Encoding default + } + Set-Location $Cert_Dir + } +} + +Function CreateSSOFiles { + +# Create the three SSO properties files, needed to replace SSO certificates + +# Skip if we have pending cert requests +if ($Script:CertsWaitingForApproval) { return } + +$LookupServiceURL = 'https://' + $FQDN + ':7444/lookupservice/sdk' +$SSOServices = @("gc","admin","sts") + +if (Test-Path $Cert_Dir\chain.cer) { + $SSLCert = "$Cert_Dir\chain.cer" + } + Else { + $SSLCert = "$Cert_Dir\root64.cer" + } + +ForEach ($SSOService in $SSOServices) { + +if ($SSOService -eq "gc") { + $SSOFriendly = "The group check interface of the SSO server" + $SSOType = "groupcheck" + $SSODescription = "The group check interface of the SSO server" + $SSOProtocol = "vmomi" + $SVCURI = "sso-adminserver/sdk/vsphere.local" + } + +if ($SSOService -eq "admin") { + $SSOFriendly = "The administrative interface of the SSO server" + $SSOType = "admin" + $SSODescription = "The administrative interface of the SSO server" + $SSOProtocol = "vmomi" + $SVCURI = "sso-adminserver/sdk/vsphere.local" + } + +if ($SSOService -eq "sts") { + $SSOFriendly = "STS for Single Sign On" + $SSOType = "sts" + $SSODescription = "The Security Token Service of the Single Sign On server." + $SSOProtocol = "wsTrust" + $SVCURI = "sts/STSService/vsphere.local" + } + +$SSOTemplate = "[service] +friendlyName=$SSOFriendly +version=1.5 +ownerId= +productId=product:sso +type=urn:sso:$SSOType +description=$SSODescription + +[endpoint0] +uri=https://FQDN:7444/$SVCURI +ssl=$SSLCert +protocol=$SSOProtocol +" + +$Out = $SSOTemplate -replace "FQDN", $FQDN | Out-File "$Cert_Dir\vCenterSSO\$SSOService.properties" -Encoding Default -Force +} + +# Create the three SSO ID files + +write-host "Connecting to Lookup Service..." +$output = &"$ssodir\ssolscli.cmd" listServices "$lookupServiceURL" + +foreach ($line in $output) { + if ($line.StartsWith("Service ")) { + $linenum = ($output | Select-String $line).LineNumber + if ($linenum -is [int32]) { + + $serviceId = $output | Select-Object -Index ($linenum+1) + $type = $output | Select-Object -Index ($linenum+3) + + if ($type -like '*sts*') { + $serviceidfilename = "$Cert_Dir\vCenterSSO\sts_id" + Set-Content $serviceidfilename $serviceid.TrimStart("serviceId=") + write-host "Created sts files..." + } + + elseif ($type -like '*admin*') { + $serviceidfilename = "$Cert_Dir\vCenterSSO\admin_id" + Set-Content $serviceidfilename $serviceid.TrimStart("serviceId=") + write-host "Created admin files..." + } + + elseif ($type -like '*group*') { + $serviceidfilename = "$Cert_Dir\vCenterSSO\gc_id" + Set-Content $serviceidfilename $serviceid.TrimStart("serviceId=") + write-host "Created groupcheck files..." + } + + } + } + } + + If(!(Test-Path "$Cert_Dir\vCenterSSO\gc_id")) { + Write-host "Unable to connect to Lookup service at $lookupserviceurl. " -ForegroundColor Red + } + +} + +Function CreateBat { +# Create batch template file for VMware vCenter certificate automation tool + +$BatchTemplate = " +@echo off +set sso_cert_chain=$Cert_Dir\vCenterSSO\chain.pem +set sso_private_key=$Cert_Dir\vCenterSSO\ssoserver.key +set sso_node_type=single +set is_cert_chain=$Cert_Dir\vCenterInventoryService\chain.pem +set is_private_key_new=$Cert_Dir\vCenterInventoryService\rui.key +set vc_cert_chain=$Cert_Dir\vCenterServer\chain.pem +set vc_private_key=$Cert_Dir\vCenterServer\rui.key +set ngc_cert_chain=$Cert_Dir\vCenterWebClient\chain.pem +set ngc_private_key=$Cert_Dir\vCenterWebClient\rui.key +set logbrowser_cert_chain=$Cert_Dir\vCenterLogBrowser\chain.pem +set logbrowser_private_key=$Cert_Dir\vCenterLogBrowser\rui.key +set vco_cert_chain=$Cert_Dir\VMwareOrchestrator\chain.pem +set vco_private_key=$Cert_Dir\VMwareOrchestrator\rui.key +set vum_cert_chain=$Cert_Dir\VMwareUpdateManager\chain.pem +set vum_private_key=$Cert_Dir\VMwareUpdateManager\rui.key +set sso_admin_user=$sso_admin +set vc_username=$vc_admin +set last_error= +set ROLLBACK_BACKUP_FOLDER=%~dp0backup +set LOGS_FOLDER=%~dp0logs +set CSR_OUTPUT_FOLDER=%~dp0requests +" +$Out = $BatchTemplate | Out-File "$Cert_Dir\ssl-environment.bat" -Encoding Default -Force +Write-host "Batch file written to $Cert_Dir. Copy over VMware tool file." -ForegroundColor Yellow +} + +Function SQLDB { + +# Creates a generic SQL database creation script. + +$VCDB = Read-Host "Enter vCenter Database Name" +$VUMDB = Read-Host "Enter VUM Database Name" +$Account = Read-Host "Enter vCenter service account (domain\account)" + +$SQLTemplate = " + +/* Creates vCenter server and VUM databases. */ +/* Change login name to vCenter service account */ +/* Modify paths, DB, log sizes as needed */ + +EXEC('CREATE LOGIN [$Account]FROM WINDOWS') + +USE MSDB +EXEC sp_grantdbaccess ""$Account"" +EXEC sp_addrolemember db_owner, ""$Account"" + +USE master +create database ""$VCDB"" +on +( name = '$VCDB', + filename = 'F:\SQLData1\$VCDB.mdf', + size = 4096MB, + filegrowth = 512MB ) + log on +( name = '$VCDB log', + filename = 'F:\SQLLogs1\$VCDB.ldf', + size = 384MB, + filegrowth = 128MB ) + +COLLATE SQL_Latin1_General_CP1_CI_AS; + +create database ""$VUMDB"" +on +( name = '$VUMDB', + filename = 'F:\SQLData1\$VUMDB.mdf', + size = 1024MB, + filegrowth = 128MB ) + log on +( name = '$VUMDB log', + filename = 'F:\SQLLogs1\$VUMDB.ldf', + size = 256MB, + filegrowth = 64MB ) + +COLLATE SQL_Latin1_General_CP1_CI_AS; + +EXEC('ALTER AUTHORIZATION ON DATABASE::""$VCDB"" TO [$Account]') +EXEC('ALTER AUTHORIZATION ON DATABASE::""$VUMDB"" TO [$Account]') + +GO +" +$Out = $SQLTemplate | Out-File "$Cert_Dir\vCenter-VUM-DB.sql" -Encoding Default -Force +Write-host "vCenter-VUM-DB.sql written to $Cert_Dir. Modify and run in SQL Manager Studio." -ForegroundColor Yellow + +} + +Function VCDSN { + +$SQLServer = Read-Host "Enter SQL server FQDN" +$DBName = Read-Host "Enter vCenter Database Name" +$Version = Read-Host "What version of SQL server? (2008 or 2012)" +$Encrypt = Read-Host "Do you want SQL SSL encryption? (yes or no)" + +$HKLMPath1 = "HKLM:\SOFTWARE\ODBC\ODBC.INI\" + $DBName +$HKLMPath2 = "HKLM:\SOFTWARE\ODBC\ODBC.INI\ODBC Data Sources" +md $HKLMPath1 -ErrorAction silentlycontinue + +set-itemproperty -path $HKLMPath1 -name Description -value $DBName +set-itemproperty -path $HKLMPath1 -name Server -value $SQLServer +set-itemproperty -path $HKLMPath1 -name LastUser -value "Administrator" +set-itemproperty -path $HKLMPath1 -name Trusted_Connection -value "Yes" +set-itemproperty -path $HKLMPath1 -name Encrypt -value $Encrypt +set-itemproperty -path $HKLMPath1 -name Database -value $DBName + +md $HKLMPath2 -ErrorAction silentlycontinue + +if ($version -eq 2008) { + set-itemproperty -path $HKLMPath2 -name "$DBName" -value "SQL Server Native Client 10.0" + set-itemproperty -path $HKLMPath1 -name Driver -value "C:\WINDOWS\system32\sqlncli10.dll" + If(!(test-path "C:\WINDOWS\system32\sqlncli10.dll")) { + Write-Host -Foreground "DarkBlue" -Background "White" "Downloading SQL 2008 R2 SP2 Native Client.." + $SQLurl = "http://download.microsoft.com/download/F/7/B/F7B7A246-6B35-40E9-8509-72D2F8D63B80/sqlncli_amd64.msi" + $SQLexe = "$env:temp\sqlncli.msi" + $wc.DownloadFile($SQLurl,$SQLexe) + $env:path = $env:path + ";$SQLdir" + Write-Host -Foreground "DarkBlue" -Background "White" "Installing SQL 2008 R2 SP2 native client..." + cmd /c msiexec /i $SQLexe /qn IACCEPTSQLNCLILICENSETERMS=YES + Remove-Item $SQLexe + } + } + +Else { + set-itemproperty -path $HKLMPath2 -name "$DBName" -value "SQL Server Native Client 11.0" + set-itemproperty -path $HKLMPath1 -name Driver -value "C:\WINDOWS\system32\sqlncli11.dll" + If(!(test-path "C:\WINDOWS\system32\sqlncli11.dll")) { + Write-Host -Foreground "DarkBlue" -Background "White" "Download and install ENU\x64\sqlncli.msi from http://www.microsoft.com/en-us/download/details.aspx?id=35580" + } + } +} + + +Function VUMDSN { + +$SQLServer = Read-Host "Enter SQL server FQDN" +$DBName = Read-Host "Enter VUM Database Name" +$Version = Read-Host "What version of SQL server? (2008 or 2012)" +$Encrypt = Read-Host "Do you want SQL SSL encryption? (yes or no)" + +$HKLMPath1 = "HKLM:\SOFTWARE\Wow6432Node\ODBC\ODBC.INI\" + $DBName +$HKLMPath2 = "HKLM:\SOFTWARE\Wow6432Node\ODBC\ODBC.INI\ODBC Data Sources" +md $HKLMPath1 -ErrorAction silentlycontinue + +set-itemproperty -path $HKLMPath1 -name Description -value $DBName +set-itemproperty -path $HKLMPath1 -name Server -value $SQLServer +set-itemproperty -path $HKLMPath1 -name LastUser -value "Administrator" +set-itemproperty -path $HKLMPath1 -name Trusted_Connection -value "Yes" +set-itemproperty -path $HKLMPath1 -name Encrypt -value $Encrypt +set-itemproperty -path $HKLMPath1 -name Database -value $DBName + +md $HKLMPath2 -ErrorAction silentlycontinue + +if ($version -eq 2008) { + set-itemproperty -path $HKLMPath2 -name "$DBName" -value "SQL Server Native Client 10.0" + set-itemproperty -path $HKLMPath1 -name Driver -value "C:\WINDOWS\system32\sqlncli10.dll" + If(!(test-path "C:\WINDOWS\system32\sqlncli10.dll")) {Write-host "Don't forget to install the SQL 2008 client." -ForegroundColor Yellow} + } + +Else { + set-itemproperty -path $HKLMPath2 -name "$DBName" -value "SQL Server Native Client 11.0" + set-itemproperty -path $HKLMPath1 -name Driver -value "C:\WINDOWS\system32\sqlncli11.dll" + If(!(test-path "C:\WINDOWS\system32\sqlncli11.dll")) {Write-host "Don't forget to install the SQL 2012 client." -ForegroundColor Yellow} + } +} + +Function GetESXHost { + +# Construct ESXi Hostname + +[int]$xMenuChoiceA = 0 +while ( $xMenuChoiceA -lt 1 -or $xMenuChoiceA -gt 3 ){ +Write-host "" +Write-host "Note: If you are resuming a manual/offline request, enter the same" +Write-host "hostname(s) or CSV file as the original request." +Write-host "" +Write-host "1. Manually enter ESXi host(s)" +Write-host "2. Read ESXi hosts from CSV file" +Write-host "3. Quit" + +[Int]$xMenuChoiceA = read-host "Please enter an option 1 to 3" } +Write-Host +Switch( $xMenuChoiceA ){ + 1{ESXHost} + 2{ESXCSV} + 3{Exit} +default{Exit} + } + +} + +Function ESXHost { + +$Script:Services = (Read-Host "Enter each ESXi FQDN (separate with comma)").split(',') | % {$_.trim()} +} + +Function ESXCSV { + +# Reads CSV input file of ESXi FQDNs + +$CSVFile = Read-Host "Full path to CSV file"; + If ( !(Test-Path $CSVFile) ) + { + Write-Host "$CSVfile not found" -ForegroundColor Red + ESXCSV + } + + else { + $Script:Services = get-content $CSVFile + } +} + + +Function getWebClient { + +# Used for PUTing SSL Certificates on ESXi host + +$Provider=New-Object Microsoft.CSharp.CSharpCodeProvider +$Compiler=$Provider.CreateCompiler() +$Params=New-Object System.CodeDom.Compiler.CompilerParameters +$Params.GenerateExecutable=$False +$Params.GenerateInMemory=$True +$Params.IncludeDebugInformation=$False +$Params.ReferencedAssemblies.Add("System.DLL") | out-null + +$TASource=@' + namespace Com.Marchview.Net.CertificatePolicy { + public class TrustAll : System.Net.ICertificatePolicy { + public TrustAll() { + } + public bool CheckValidationResult(System.Net.ServicePoint sp, + System.Security.Cryptography.X509Certificates.X509Certificate cert, + System.Net.WebRequest req, int problem) { + return true; + } + } + } +'@ +$TAResults=$Provider.CompileAssemblyFromSource($Params,$TASource) +$TAAssembly=$TAResults.CompiledAssembly + +# We now create an instance of the TrustAll and attach it to the ServicePointManager + +$TrustAll=$TAAssembly.CreateInstance("Com.Marchview.Net.CertificatePolicy.TrustAll") +[System.Net.ServicePointManager]::CertificatePolicy=$TrustAll + +$WCSource=@' + namespace Com.Marchview.Net { + class WebClient : System.Net.WebClient { + protected override System.Net.WebRequest GetWebRequest(System.Uri uri) { + System.Net.WebRequest webRequest = base.GetWebRequest(uri); + webRequest.PreAuthenticate = true; + webRequest.Timeout = 10000; + return webRequest; + } + } + } +'@ +$WCResults=$Provider.CompileAssemblyFromSource($Params,$WCSource) +$WCAssembly=$WCResults.CompiledAssembly +$WebClient=$WCAssembly.CreateInstance("Com.Marchview.Net.WebClient") + +$WebClient + +} + +Function GetCredential { +# Used for PUTing SSL Certificates on ESXi host + +param( + [String]$UserName, + $Password + ) + + $CredentialCache=New-Object System.Net.CredentialCache + if ($Password.getType().FullName -eq "System.Security.SecureString") { + $Credential=New-Object System.Net.NetworkCredential($UserName, + [System.Runtime.InteropServices.Marshal]::PtrToStringAuto( + [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($Password))) + } + else { + $Credential=New-Object System.Net.NetworkCredential($UserName,$Password) +} + +$Credential +} + +Function getCredentialCache { +# Used for PUTing SSL Certificates on ESXi host + +param( + [String]$URIName, + [System.Net.NetworkCredential]$Credential + ) + +$CredentialCache=New-Object System.Net.CredentialCache + +$URI=New-Object System.URI($URIName) +$CredentialCache.Add($URI,"Basic",$Credential) + +$CredentialCache +} + +Function UploadESXCert { + + if ($Script:CertsWaitingForApproval) {EXIT} + +ForEach ($Service in $Services) { + + # Get password for root account or read from file + + $ESXPassFile = $ESXUser + "-credentials" + $ESXPassFile = "$Cert_Dir\$ESXPassFile" + If ( !(Test-Path $ESXPassFile) ) + { + Write-Host "No credentials found for " $ESXUser + $Prompt = "Please enter the password for " + $ESXUser + Read-Host -prompt $Prompt -assecurestring | ConvertFrom-SecureString | Out-File $ESXPassFile + } + $ESXPassword = Get-Content $ESXPassFile| ConvertTo-SecureString + + # Set directories + + $ESXCertFile = "$Cert_Dir\$Service" + "\" + "rui.crt" + $ESXKeyFile = "$Cert_Dir\$Service" + "\" + "rui.key" + + # Check if SSL certificate and key exist + If (-not (Test-Path ($ESXKeyFile))) { + "ERROR: Failed to locate the SSL key file at $Cert_Dir\$Service" + exit + } + If (-not (Test-Path ($ESXCertFile))) { + "ERROR: Failed to locate the SSL crt file at $Cert_Dir\$Service" + exit + } + + # Set URLs + + $ESXiURL = "https://" + $Service + + # Create WebClient for uploading the SSL certificate / key + $WebClient=getWebClient + $HostCredential=getCredential $ESXUser $ESXPassword + $HostCredentialCache=getCredentialCache $ESXiURL $HostCredential + $WebClient.Credentials=$HostCredentialCache + + # Upload SSL keys + Try + { + $WebClient.UploadFile(($ESXiURL + "/host/ssl_key"),"PUT",$ESXKeyFile) + $WebClient.UploadFile(($ESXiURL + "/host/ssl_cert"),"PUT", $ESXCertFile) + } + Catch + { + $UploadError = $_.Exception.Message + write-host "Upload error occurred for $Service. Check hostname and credentials." -ForegroundColor Red + write-host $_.Exception.Message -ForegroundColor Red + } + + if (!$UploadError) {write-host "Certificates uploaded to $Service" -ForegroundColor Yellow } + } +} + + +### Main ### + +[int]$xMenuChoiceA = 0 +while ( $xMenuChoiceA -lt 1 -or $xMenuChoiceA -gt 14 ){ +Write-host "" +Write-host "Welcome to the vCenter 5.5 Toolkit" -foregroundcolor Yellow +Write-host "Derek Seaman, VCDX #125, derekseaman.com" -ForegroundColor Yellow +Write-host "vSphere 5.5 series: vexpert.me\Derek55" -ForegroundColor Yellow +Write-host "Use at your own risk; no warranty implied or stated" -ForegroundColor Yellow +Write-host "" +Write-host "Windows vCenter only:" +Write-host "" +Write-host "1. Mint vCenter SSL certs with an online Microsoft CA" +Write-host "2. Create vCenter CSRs for an offline or non-Microsoft CA" +Write-host "3. Process manually downloaded certificates or resume a pending online request" +Write-host "4. Create vCenter Certificate Automation Batch file" +Write-host "5. Create vCenter and VUM SQL database file" +Write-host "6. Create vCenter DSN" +Write-host "7. Create VUM DSN" +write-host "" +Write-host "Linux vCenter Server Appliance (VCSA) only:" +Write-host "" +Write-host "8. Mint VCSA SSL certs with an online Microsoft CA" +Write-host "9. Resume a pending online Microsoft CA request" +Write-host "10. Create VCSA CSRs for an offline or non-Microsoft CA" +Write-host "" +Write-host "ESXi Hosts" +Write-host "" +Write-host "11. Mint ESXi SSL certificate with an online Microsoft CA" +Write-host "12. Create ESXi CSRs for an offline or non-Microsoft CA" +Write-host "13. Install manually downloaded certificates or resume a pending online request" +Write-host "" +Write-host "14. Quit" + +[Int]$xMenuChoiceA = read-host "Please enter an option 1 to 14" } +Write-Host +Switch( $xMenuChoiceA ){ + 1{$Script:Services = $WServices; CheckOpenSSL; WinVCCheck; DownloadRoot; DownloadSub; VCFQDN; CreateCSR; OnlineMint; CAHashes; CreatePEMFiles; CreateSSOFiles} + 2{$Script:Services = $WServices; CheckOpenSSL; WinVCCheck; VCFQDN; CreateCSR} + 3{$Script:Services = $WServices; CheckOpenSSL; WinVCCheck; DownloadRoot; DownloadSub; VCFQDN; OnlineMintResume; CAHashes; CreatePemFiles; CreateSSOFiles} + 4{CreateBat} + 5{SQLDB} + 6{VCDSN} + 7{VUMDSN} + 8{$Script:Services = $LServices; CheckOpenSSL; VCFQDN; DownloadRoot; DownloadSub; CreateCSR; OnlineMint } + 9{$Script:Services = $LServices; CheckOpenSSL; VCFQDN; DownloadRoot; DownloadSub; OnlineMintResume} + 10{$Script:Services = $LServices; CheckOpenSSL; VCFQDN; CreateCSR} + 11 {CheckOpenSSL; GetESXHost; CreateESXCSR; OnlineMint; UploadESXCert} + 12 {CheckOpenSSL; GetESXHost; CreateESXCSR} + 13 {CheckOpenSSL; GetESXHost; OnlineMintResume; UploadESXCert} + 14{Exit} +default{Exit} +} diff --git a/Build/Automate/VC/PuTTY.reg b/Build/Automate/VC/PuTTY.reg new file mode 100644 index 0000000..14b40d8 Binary files /dev/null and b/Build/Automate/VC/PuTTY.reg differ diff --git a/Build/Automate/VC/PuTTY/LICENCE b/Build/Automate/VC/PuTTY/LICENCE new file mode 100644 index 0000000..1960cc2 --- /dev/null +++ b/Build/Automate/VC/PuTTY/LICENCE @@ -0,0 +1,25 @@ +PuTTY is copyright 1997-2007 Simon Tatham. + +Portions copyright Robert de Bath, Joris van Rantwijk, Delian +Delchev, Andreas Schultz, Jeroen Massar, Wez Furlong, Nicolas Barry, +Justin Bradford, Ben Harris, Malcolm Smith, Ahmad Khalifa, Markus +Kuhn, and CORE SDI S.A. + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation files +(the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of the Software, +and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE +FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF +CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/Build/Automate/VC/PuTTY/README.txt b/Build/Automate/VC/PuTTY/README.txt new file mode 100644 index 0000000..b4b5fba --- /dev/null +++ b/Build/Automate/VC/PuTTY/README.txt @@ -0,0 +1,40 @@ +PuTTY README +============ + +This is the README file for the PuTTY installer distribution. If +you're reading this, you've probably just run our installer and +installed PuTTY on your system. + +What should I do next? +---------------------- + +If you want to use PuTTY to connect to other computers, or use PSFTP +to transfer files, you should just be able to run them from the +Start menu. + +If you want to use the command-line-only file transfer utility PSCP, +you will probably want to put the PuTTY installation directory on +your PATH. How you do this depends on your version of Windows. On +Windows NT, 2000, and XP, you can set it using Control Panel > System; +on Windows 95, 98, and Me, you will need to edit AUTOEXEC.BAT. Consult +your Windows manuals for details. + +Some versions of Windows will refuse to run HTML Help files (.CHM) +if they are installed on a network drive. If you have installed +PuTTY on a network drive, you might want to check that the help file +works properly. If not, see http://support.microsoft.com/kb/896054 +for information on how to solve this problem. + +What do I do if it doesn't work? +-------------------------------- + +The PuTTY home web site is + + http://www.chiark.greenend.org.uk/~sgtatham/putty/ + +Here you will find our list of known bugs and pending feature +requests. If your problem is not listed in there, or in the FAQ, or +in the manuals, read the Feedback page to find out how to report +bugs to us. PLEASE read the Feedback page carefully: it is there to +save you time as well as us. Do not send us one-line bug reports +telling us `it doesn't work'. diff --git a/Build/Automate/VC/PuTTY/pageant.exe b/Build/Automate/VC/PuTTY/pageant.exe new file mode 100644 index 0000000..ea2379b Binary files /dev/null and b/Build/Automate/VC/PuTTY/pageant.exe differ diff --git a/Build/Automate/VC/PuTTY/plink.exe b/Build/Automate/VC/PuTTY/plink.exe new file mode 100644 index 0000000..a27bf36 Binary files /dev/null and b/Build/Automate/VC/PuTTY/plink.exe differ diff --git a/Build/Automate/VC/PuTTY/pscp.exe b/Build/Automate/VC/PuTTY/pscp.exe new file mode 100644 index 0000000..e511e5b Binary files /dev/null and b/Build/Automate/VC/PuTTY/pscp.exe differ diff --git a/Build/Automate/VC/PuTTY/psftp.exe b/Build/Automate/VC/PuTTY/psftp.exe new file mode 100644 index 0000000..1f986e7 Binary files /dev/null and b/Build/Automate/VC/PuTTY/psftp.exe differ diff --git a/Build/Automate/VC/PuTTY/putty.chm b/Build/Automate/VC/PuTTY/putty.chm new file mode 100644 index 0000000..6f769ad Binary files /dev/null and b/Build/Automate/VC/PuTTY/putty.chm differ diff --git a/Build/Automate/VC/PuTTY/putty.cnt b/Build/Automate/VC/PuTTY/putty.cnt new file mode 100644 index 0000000..84d15ef --- /dev/null +++ b/Build/Automate/VC/PuTTY/putty.cnt @@ -0,0 +1,492 @@ +:Title PuTTY User Manual +1 Title page=Top +1 Chapter 1: Introduction to PuTTY +2 Chapter 1: Introduction to PuTTY=t00000000 +2 Section 1.1: What are SSH, Telnet and Rlogin?=t00000001 +2 Section 1.2: How do SSH, Telnet and Rlogin differ?=t00000002 +1 Chapter 2: Getting started with PuTTY +2 Chapter 2: Getting started with PuTTY=t00000003 +2 Section 2.1: Starting a session=t00000004 +2 Section 2.2: Verifying the host key (SSH only)=t00000005 +2 Section 2.3: Logging in=t00000006 +2 Section 2.4: After logging in=t00000007 +2 Section 2.5: Logging out=t00000008 +1 Chapter 3: Using PuTTY +2 Chapter 3: Using PuTTY=t00000009 +2 Section 3.1: During your session +3 Section 3.1: During your session=t00000010 +3 Section 3.1.1: Copying and pasting text=t00000011 +3 Section 3.1.2: Scrolling the screen back=t00000012 +3 Section 3.1.3: The System menu +4 Section 3.1.3: The System menu=t00000013 +4 Section 3.1.3.1: The PuTTY Event Log=t00000014 +4 Section 3.1.3.2: Special commands=t00000015 +4 Section 3.1.3.3: Starting new sessions=t00000016 +4 Section 3.1.3.4: Changing your session settings=t00000017 +4 Section 3.1.3.5: Copy All to Clipboard=t00000018 +4 Section 3.1.3.6: Clearing and resetting the terminal=t00000019 +4 Section 3.1.3.7: Full screen mode=t00000020 +1 Section 3.2: Creating a log file of your session=t00000021 +1 Section 3.3: Altering your character set configuration=t00000022 +1 Section 3.4: Using X11 forwarding in SSH=t00000023 +1 Section 3.5: Using port forwarding in SSH=t00000024 +1 Section 3.6: Making raw TCP connections=t00000025 +1 Section 3.7: Connecting to a local serial line=t00000026 +2 Section 3.8: The PuTTY command line +3 Section 3.8: The PuTTY command line=t00000027 +3 Section 3.8.1: Starting a session from the command line=t00000028 +3 Section 3.8.2: -cleanup=options.cleanup +3 Section 3.8.3: Standard command-line options +4 Section 3.8.3: Standard command-line options=t00000029 +4 Section 3.8.3.1: -load: load a saved session=t00000030 +4 Section 3.8.3.2: Selecting a protocol: -ssh, -telnet, -rlogin, -raw=t00000031 +4 Section 3.8.3.3: -v: increase verbosity=t00000032 +4 Section 3.8.3.4: -l: specify a login name=t00000033 +4 Section 3.8.3.5: -L, -R and -D: set up port forwardings=t00000034 +4 Section 3.8.3.6: -m: read a remote command or script from a file=t00000035 +4 Section 3.8.3.7: -P: specify a port number=t00000036 +4 Section 3.8.3.8: -pw: specify a password=t00000037 +4 Section 3.8.3.9: -agent and -noagent: control use of Pageant for authentication=t00000038 +4 Section 3.8.3.10: -A and -a: control agent forwarding=t00000039 +4 Section 3.8.3.11: -X and -x: control X11 forwarding=t00000040 +4 Section 3.8.3.12: -t and -T: control pseudo-terminal allocation=t00000041 +4 Section 3.8.3.13: -N: suppress starting a shell or command=t00000042 +4 Section 3.8.3.14: -nc: make a remote network connection in place of a remote shell or command=t00000043 +4 Section 3.8.3.15: -C: enable compression=t00000044 +4 Section 3.8.3.16: -1 and -2: specify an SSH protocol version=t00000045 +4 Section 3.8.3.17: -4 and -6: specify an Internet protocol version=t00000046 +4 Section 3.8.3.18: -i: specify an SSH private key=t00000047 +4 Section 3.8.3.19: -pgpfp: display PGP key fingerprints=t00000048 +1 Chapter 4: Configuring PuTTY +2 Chapter 4: Configuring PuTTY=t00000049 +2 Section 4.1: The Session panel +3 Section 4.1: The Session panel=t00000050 +3 Section 4.1.1: The host name section=session.hostname +3 Section 4.1.2: Loading and storing saved sessions=session.saved +3 Section 4.1.3: ‘Close Window on Exit’=session.coe +2 Section 4.2: The Logging panel +3 Section 4.2: The Logging panel=logging.main +3 Section 4.2.1: ‘Log file name’=logging.filename +3 Section 4.2.2: ‘What to do if the log file already exists’=logging.exists +3 Section 4.2.3: ‘Flush log file frequently’=logging.flush +3 Section 4.2.4: Options specific to SSH packet logging +4 Section 4.2.4: Options specific to SSH packet logging=t00000051 +4 Section 4.2.4.1: ‘Omit known password fields’=logging.ssh.omitpassword +4 Section 4.2.4.2: ‘Omit session data’=logging.ssh.omitdata +2 Section 4.3: The Terminal panel +3 Section 4.3: The Terminal panel=t00000052 +3 Section 4.3.1: ‘Auto wrap mode initially on’=terminal.autowrap +3 Section 4.3.2: ‘DEC Origin Mode initially on’=terminal.decom +3 Section 4.3.3: ‘Implicit CR in every LF’=terminal.lfhascr +3 Section 4.3.4: ‘Use background colour to erase screen’=terminal.bce +3 Section 4.3.5: ‘Enable blinking text’=terminal.blink +3 Section 4.3.6: ‘Answerback to ^E’=terminal.answerback +3 Section 4.3.7: ‘Local echo’=terminal.localecho +3 Section 4.3.8: ‘Local line editing’=terminal.localedit +3 Section 4.3.9: Remote-controlled printing=terminal.printing +2 Section 4.4: The Keyboard panel +3 Section 4.4: The Keyboard panel=t00000053 +3 Section 4.4.1: Changing the action of the Backspace key=keyboard.backspace +3 Section 4.4.2: Changing the action of the Home and End keys=keyboard.homeend +3 Section 4.4.3: Changing the action of the function keys and keypad=keyboard.funkeys +3 Section 4.4.4: Controlling Application Cursor Keys mode=keyboard.appcursor +3 Section 4.4.5: Controlling Application Keypad mode=keyboard.appkeypad +3 Section 4.4.6: Using NetHack keypad mode=keyboard.nethack +3 Section 4.4.7: Enabling a DEC-like Compose key=keyboard.compose +3 Section 4.4.8: ‘Control-Alt is different from AltGr’=keyboard.ctrlalt +2 Section 4.5: The Bell panel +3 Section 4.5: The Bell panel=t00000054 +3 Section 4.5.1: ‘Set the style of bell’=bell.style +3 Section 4.5.2: ‘Taskbar/caption indication on bell’=bell.taskbar +3 Section 4.5.3: ‘Control the bell overload behaviour’=bell.overload +2 Section 4.6: The Features panel +3 Section 4.6: The Features panel=t00000055 +3 Section 4.6.1: Disabling application keypad and cursor keys=features.application +3 Section 4.6.2: Disabling xterm-style mouse reporting=features.mouse +3 Section 4.6.3: Disabling remote terminal resizing=features.resize +3 Section 4.6.4: Disabling switching to the alternate screen=features.altscreen +3 Section 4.6.5: Disabling remote window title changing=features.retitle +3 Section 4.6.6: Response to remote window title querying=features.qtitle +3 Section 4.6.7: Disabling destructive backspace=features.dbackspace +3 Section 4.6.8: Disabling remote character set configuration=features.charset +3 Section 4.6.9: Disabling Arabic text shaping=features.arabicshaping +3 Section 4.6.10: Disabling bidirectional text display=features.bidi +2 Section 4.7: The Window panel +3 Section 4.7: The Window panel=t00000056 +3 Section 4.7.1: Setting the size of the PuTTY window=window.size +3 Section 4.7.2: What to do when the window is resized=window.resize +3 Section 4.7.3: Controlling scrollback=window.scrollback +3 Section 4.7.4: ‘Push erased text into scrollback’=window.erased +2 Section 4.8: The Appearance panel +3 Section 4.8: The Appearance panel=t00000057 +3 Section 4.8.1: Controlling the appearance of the cursor=appearance.cursor +3 Section 4.8.2: Controlling the font used in the terminal window=appearance.font +3 Section 4.8.3: ‘Hide mouse pointer when typing in window’=appearance.hidemouse +3 Section 4.8.4: Controlling the window border=appearance.border +2 Section 4.9: The Behaviour panel +3 Section 4.9: The Behaviour panel=t00000058 +3 Section 4.9.1: Controlling the window title=appearance.title +3 Section 4.9.2: ‘Warn before closing window’=behaviour.closewarn +3 Section 4.9.3: ‘Window closes on ALT-F4’=behaviour.altf4 +3 Section 4.9.4: ‘System menu appears on ALT-Space’=behaviour.altspace +3 Section 4.9.5: ‘System menu appears on Alt alone’=behaviour.altonly +3 Section 4.9.6: ‘Ensure window is always on top’=behaviour.alwaysontop +3 Section 4.9.7: ‘Full screen on Alt-Enter’=behaviour.altenter +2 Section 4.10: The Translation panel +3 Section 4.10: The Translation panel=t00000059 +3 Section 4.10.1: Controlling character set translation=translation.codepage +3 Section 4.10.2: ‘Treat CJK ambiguous characters as wide’=translation.cjkambigwide +3 Section 4.10.3: ‘Caps Lock acts as Cyrillic switch’=translation.cyrillic +3 Section 4.10.4: Controlling display of line-drawing characters=translation.linedraw +3 Section 4.10.5: Controlling copy and paste of line drawing characters=selection.linedraw +2 Section 4.11: The Selection panel +3 Section 4.11: The Selection panel=t00000060 +3 Section 4.11.1: Pasting in Rich Text Format=selection.rtf +3 Section 4.11.2: Changing the actions of the mouse buttons=selection.buttons +3 Section 4.11.3: ‘Shift overrides application's use of mouse’=selection.shiftdrag +3 Section 4.11.4: Default selection mode=selection.rect +3 Section 4.11.5: Configuring word-by-word selection=selection.charclasses +2 Section 4.12: The Colours panel +3 Section 4.12: The Colours panel=t00000061 +3 Section 4.12.1: ‘Allow terminal to specify ANSI colours’=colours.ansi +3 Section 4.12.2: ‘Allow terminal to use xterm 256-colour mode’=colours.xterm256 +3 Section 4.12.3: ‘Bolded text is a different colour’=colours.bold +3 Section 4.12.4: ‘Attempt to use logical palettes’=colours.logpal +3 Section 4.12.5: ‘Use system colours’=colours.system +3 Section 4.12.6: Adjusting the colours in the terminal window=colours.config +2 Section 4.13: The Connection panel +3 Section 4.13: The Connection panel=t00000062 +3 Section 4.13.1: Using keepalives to prevent disconnection=connection.keepalive +3 Section 4.13.2: ‘Disable Nagle's algorithm’=connection.nodelay +3 Section 4.13.3: ‘Enable TCP keepalives’=connection.tcpkeepalive +3 Section 4.13.4: ‘Internet protocol’=connection.ipversion +2 Section 4.14: The Data panel +3 Section 4.14: The Data panel=t00000063 +3 Section 4.14.1: ‘Auto-login username’=connection.username +3 Section 4.14.2: ‘Terminal-type string’=connection.termtype +3 Section 4.14.3: ‘Terminal speeds’=connection.termspeed +3 Section 4.14.4: Setting environment variables on the server=telnet.environ +2 Section 4.15: The Proxy panel +3 Section 4.15: The Proxy panel=proxy.main +3 Section 4.15.1: Setting the proxy type=proxy.type +3 Section 4.15.2: Excluding parts of the network from proxying=proxy.exclude +3 Section 4.15.3: Name resolution when using a proxy=proxy.dns +3 Section 4.15.4: Username and password=proxy.auth +3 Section 4.15.5: Specifying the Telnet or Local proxy command=proxy.command +2 Section 4.16: The Telnet panel +3 Section 4.16: The Telnet panel=t00000064 +3 Section 4.16.1: ‘Handling of OLD_ENVIRON ambiguity’=telnet.oldenviron +3 Section 4.16.2: Passive and active Telnet negotiation modes=telnet.passive +3 Section 4.16.3: ‘Keyboard sends Telnet special commands’=telnet.specialkeys +3 Section 4.16.4: ‘Return key sends Telnet New Line instead of ^M’=telnet.newline +2 Section 4.17: The Rlogin panel +3 Section 4.17: The Rlogin panel=t00000065 +3 Section 4.17.1: ‘Local username’=rlogin.localuser +2 Section 4.18: The SSH panel +3 Section 4.18: The SSH panel=t00000066 +3 Section 4.18.1: Executing a specific command on the server=ssh.command +3 Section 4.18.2: ‘Don't start a shell or command at all’=ssh.noshell +3 Section 4.18.3: ‘Enable compression’=ssh.compress +3 Section 4.18.4: ‘Preferred SSH protocol version’=ssh.protocol +3 Section 4.18.5: Encryption algorithm selection=ssh.ciphers +2 Section 4.19: The Kex panel +3 Section 4.19: The Kex panel=t00000067 +3 Section 4.19.1: Key exchange algorithm selection=ssh.kex.order +3 Section 4.19.2: Repeat key exchange=ssh.kex.repeat +2 Section 4.20: The Auth panel +3 Section 4.20: The Auth panel=t00000068 +3 Section 4.20.1: ‘Bypass authentication entirely’=ssh.auth.bypass +3 Section 4.20.2: ‘Attempt authentication using Pageant’=ssh.auth.pageant +3 Section 4.20.3: ‘Attempt TIS or CryptoCard authentication’=ssh.auth.tis +3 Section 4.20.4: ‘Attempt keyboard-interactive authentication’=ssh.auth.ki +3 Section 4.20.5: ‘Allow agent forwarding’=ssh.auth.agentfwd +3 Section 4.20.6: ‘Allow attempted changes of username in SSH-2’=ssh.auth.changeuser +3 Section 4.20.7: ‘Private key file for authentication’=ssh.auth.privkey +2 Section 4.21: The TTY panel +3 Section 4.21: The TTY panel=t00000069 +3 Section 4.21.1: ‘Don't allocate a pseudo-terminal’=ssh.nopty +3 Section 4.21.2: Sending terminal modes=ssh.ttymodes +2 Section 4.22: The X11 panel +3 Section 4.22: The X11 panel=ssh.tunnels.x11 +3 Section 4.22.1: Remote X11 authentication=ssh.tunnels.x11auth +2 Section 4.23: The Tunnels panel +3 Section 4.23: The Tunnels panel=ssh.tunnels.portfwd +3 Section 4.23.1: Controlling the visibility of forwarded ports=ssh.tunnels.portfwd.localhost +3 Section 4.23.2: Selecting Internet protocol version for forwarded ports=ssh.tunnels.portfwd.ipversion +2 Section 4.24: The Bugs panel +3 Section 4.24: The Bugs panel=t00000070 +3 Section 4.24.1: ‘Chokes on SSH-1 ignore messages’=ssh.bugs.ignore1 +3 Section 4.24.2: ‘Refuses all SSH-1 password camouflage’=ssh.bugs.plainpw1 +3 Section 4.24.3: ‘Chokes on SSH-1 RSA authentication’=ssh.bugs.rsa1 +3 Section 4.24.4: ‘Miscomputes SSH-2 HMAC keys’=ssh.bugs.hmac2 +3 Section 4.24.5: ‘Miscomputes SSH-2 encryption keys’=ssh.bugs.derivekey2 +3 Section 4.24.6: ‘Requires padding on SSH-2 RSA signatures’=ssh.bugs.rsapad2 +3 Section 4.24.7: ‘Misuses the session ID in SSH-2 PK auth’=ssh.bugs.pksessid2 +3 Section 4.24.8: ‘Handles SSH-2 key re-exchange badly’=ssh.bugs.rekey2 +2 Section 4.25: The Serial panel +3 Section 4.25: The Serial panel=t00000071 +3 Section 4.25.1: Selecting a serial line to connect to=serial.line +3 Section 4.25.2: Selecting the speed of your serial line=serial.speed +3 Section 4.25.3: Selecting the number of data bits=serial.databits +3 Section 4.25.4: Selecting the number of stop bits=serial.stopbits +3 Section 4.25.5: Selecting the serial parity checking scheme=serial.parity +3 Section 4.25.6: Selecting the serial flow control scheme=serial.flow +1 Section 4.26: Storing configuration in a file=t00000072 +1 Chapter 5: Using PSCP to transfer files securely +2 Chapter 5: Using PSCP to transfer files securely=t00000073 +2 Section 5.1: Starting PSCP=t00000074 +2 Section 5.2: PSCP Usage +3 Section 5.2: PSCP Usage=t00000075 +3 Section 5.2.1: The basics +4 Section 5.2.1: The basics=t00000076 +4 Section 5.2.1.1: user=t00000077 +4 Section 5.2.1.2: host=t00000078 +4 Section 5.2.1.3: source=t00000079 +4 Section 5.2.1.4: target=t00000080 +3 Section 5.2.2: Options +4 Section 5.2.2: Options=t00000081 +4 Section 5.2.2.1: -ls list remote files=t00000082 +4 Section 5.2.2.2: -p preserve file attributes=t00000083 +4 Section 5.2.2.3: -q quiet, don't show statistics=t00000084 +4 Section 5.2.2.4: -r copies directories recursively=t00000085 +4 Section 5.2.2.5: -batch avoid interactive prompts=t00000086 +4 Section 5.2.2.6: -sftp, -scp force use of particular protocol=t00000087 +2 Section 5.2.3: Return value=t00000088 +2 Section 5.2.4: Using public key authentication with PSCP=t00000089 +1 Chapter 6: Using PSFTP to transfer files securely +2 Chapter 6: Using PSFTP to transfer files securely=t00000090 +2 Section 6.1: Starting PSFTP +3 Section 6.1: Starting PSFTP=t00000091 +3 Section 6.1.1: -b: specify a file containing batch commands=t00000092 +3 Section 6.1.2: -bc: display batch commands as they are run=t00000093 +3 Section 6.1.3: -be: continue batch processing on errors=t00000094 +3 Section 6.1.4: -batch: avoid interactive prompts=t00000095 +2 Section 6.2: Running PSFTP +3 Section 6.2: Running PSFTP=t00000096 +3 Section 6.2.1: General quoting rules for PSFTP commands=t00000097 +3 Section 6.2.2: Wildcards in PSFTP=t00000098 +3 Section 6.2.3: The open command: start a session=t00000099 +3 Section 6.2.4: The quit command: end your session=t00000100 +3 Section 6.2.5: The close command: close your connection=t00000101 +3 Section 6.2.6: The help command: get quick online help=t00000102 +3 Section 6.2.7: The cd and pwd commands: changing the remote working directory=t00000103 +3 Section 6.2.8: The lcd and lpwd commands: changing the local working directory=t00000104 +3 Section 6.2.9: The get command: fetch a file from the server=t00000105 +3 Section 6.2.10: The put command: send a file to the server=t00000106 +3 Section 6.2.11: The mget and mput commands: fetch or send multiple files=t00000107 +3 Section 6.2.12: The reget and reput commands: resuming file transfers=t00000108 +3 Section 6.2.13: The dir command: list remote files=t00000109 +3 Section 6.2.14: The chmod command: change permissions on remote files=t00000110 +3 Section 6.2.15: The del command: delete remote files=t00000111 +3 Section 6.2.16: The mkdir command: create remote directories=t00000112 +3 Section 6.2.17: The rmdir command: remove remote directories=t00000113 +3 Section 6.2.18: The mv command: move and rename remote files=t00000114 +3 Section 6.2.19: The ! command: run a local Windows command=t00000115 +1 Section 6.3: Using public key authentication with PSFTP=t00000116 +1 Chapter 7: Using the command-line connection tool Plink +2 Chapter 7: Using the command-line connection tool Plink=t00000117 +2 Section 7.1: Starting Plink=t00000118 +2 Section 7.2: Using Plink +3 Section 7.2: Using Plink=t00000119 +3 Section 7.2.1: Using Plink for interactive logins=t00000120 +3 Section 7.2.2: Using Plink for automated connections=t00000121 +3 Section 7.2.3: Plink command line options +4 Section 7.2.3: Plink command line options=t00000122 +4 Section 7.2.3.1: -batch: disable all interactive prompts=t00000123 +4 Section 7.2.3.2: -s: remote command is SSH subsystem=t00000124 +1 Section 7.3: Using Plink in batch files and scripts=t00000125 +1 Section 7.4: Using Plink with CVS=t00000126 +1 Section 7.5: Using Plink with WinCVS=t00000127 +1 Chapter 8: Using public keys for SSH authentication +2 Chapter 8: Using public keys for SSH authentication=t00000128 +2 Section 8.1: Public key authentication - an introduction=t00000129 +2 Section 8.2: Using PuTTYgen, the PuTTY key generator +3 Section 8.2: Using PuTTYgen, the PuTTY key generator=puttygen.general +3 Section 8.2.1: Generating a new key=t00000130 +3 Section 8.2.2: Selecting the type of key=puttygen.keytype +3 Section 8.2.3: Selecting the size (strength) of the key=puttygen.bits +3 Section 8.2.4: The ‘Generate’ button=puttygen.generate +3 Section 8.2.5: The ‘Key fingerprint’ box=puttygen.fingerprint +3 Section 8.2.6: Setting a comment for your key=puttygen.comment +3 Section 8.2.7: Setting a passphrase for your key=puttygen.passphrase +3 Section 8.2.8: Saving your private key to a disk file=puttygen.savepriv +3 Section 8.2.9: Saving your public key to a disk file=puttygen.savepub +3 Section 8.2.10: ‘Public key for pasting into authorized_keys file’=puttygen.pastekey +3 Section 8.2.11: Reloading a private key=puttygen.load +3 Section 8.2.12: Dealing with private keys in other formats=puttygen.conversions +1 Section 8.3: Getting ready for public key authentication=t00000131 +1 Chapter 9: Using Pageant for authentication +2 Chapter 9: Using Pageant for authentication=pageant.general +2 Section 9.1: Getting started with Pageant=t00000132 +2 Section 9.2: The Pageant main window +3 Section 9.2: The Pageant main window=t00000133 +3 Section 9.2.1: The key list box=pageant.keylist +3 Section 9.2.2: The ‘Add Key’ button=pageant.addkey +3 Section 9.2.3: The ‘Remove Key’ button=pageant.remkey +2 Section 9.3: The Pageant command line +3 Section 9.3: The Pageant command line=t00000134 +3 Section 9.3.1: Making Pageant automatically load keys on startup=t00000135 +3 Section 9.3.2: Making Pageant run another program=t00000136 +1 Section 9.4: Using agent forwarding=t00000137 +1 Section 9.5: Security considerations=t00000138 +1 Chapter 10: Common error messages +2 Chapter 10: Common error messages=t00000139 +2 Section 10.1: ‘The server's host key is not cached in the registry’=errors.hostkey.absent +2 Section 10.2: ‘WARNING - POTENTIAL SECURITY BREACH!’=errors.hostkey.changed +2 Section 10.3: ‘Out of space for port forwardings’=t00000140 +2 Section 10.4: ‘The first cipher supported by the server is ... below the configured warning threshold’=t00000141 +2 Section 10.5: ‘Server sent disconnect message type 2 (protocol error): "Too many authentication failures for root"’=t00000142 +2 Section 10.6: ‘Out of memory’=t00000143 +2 Section 10.7: ‘Internal error’, ‘Internal fault’, ‘Assertion failed’=t00000144 +2 Section 10.8: ‘Unable to use this private key file’, ‘Couldn't load private key’, ‘Key is of wrong type’=errors.cantloadkey +2 Section 10.9: ‘Server refused our public key’ or ‘Key refused’=t00000145 +2 Section 10.10: ‘Access denied’, ‘Authentication refused’=t00000146 +2 Section 10.11: ‘Incorrect CRC received on packet’ or ‘Incorrect MAC received on packet’=t00000147 +2 Section 10.12: ‘Incoming packet was garbled on decryption’=t00000148 +2 Section 10.13: ‘PuTTY X11 proxy: various errors’=t00000149 +2 Section 10.14: ‘Network error: Software caused connection abort’=t00000150 +2 Section 10.15: ‘Network error: Connection reset by peer’=t00000151 +2 Section 10.16: ‘Network error: Connection refused’=t00000152 +2 Section 10.17: ‘Network error: Connection timed out’=t00000153 +1 Appendix A: PuTTY FAQ +2 Appendix A: PuTTY FAQ=t00000154 +2 Section A.1: Introduction +3 Section A.1: Introduction=t00000155 +3 Question A.1.1: What is PuTTY?=t00000156 +2 Section A.2: Features supported in PuTTY +3 Section A.2: Features supported in PuTTY=t00000157 +3 Question A.2.1: Does PuTTY support SSH-2?=t00000158 +3 Question A.2.2: Does PuTTY support reading OpenSSH or ssh.com SSH-2 private key files?=t00000159 +3 Question A.2.3: Does PuTTY support SSH-1?=t00000160 +3 Question A.2.4: Does PuTTY support local echo?=t00000161 +3 Question A.2.5: Does PuTTY support storing settings, so I don't have to change them every time?=t00000162 +3 Question A.2.6: Does PuTTY support storing its settings in a disk file?=t00000163 +3 Question A.2.7: Does PuTTY support full-screen mode, like a DOS box?=t00000164 +3 Question A.2.8: Does PuTTY have the ability to remember my password so I don't have to type it every time?=t00000165 +3 Question A.2.9: Is there an option to turn off the annoying host key prompts?=t00000166 +3 Question A.2.10: Will you write an SSH server for the PuTTY suite, to go with the client?=t00000167 +3 Question A.2.11: Can PSCP or PSFTP transfer files in ASCII mode?=t00000168 +2 Section A.3: Ports to other operating systems +3 Section A.3: Ports to other operating systems=t00000169 +3 Question A.3.1: What ports of PuTTY exist?=t00000170 +3 Question A.3.2: Is there a port to Unix?=t00000171 +3 Question A.3.3: What's the point of the Unix port? Unix has OpenSSH.=t00000172 +3 Question A.3.4: Will there be a port to Windows CE or PocketPC?=t00000173 +3 Question A.3.5: Is there a port to Windows 3.1?=t00000174 +3 Question A.3.6: Will there be a port to the Mac?=t00000175 +3 Question A.3.7: Will there be a port to EPOC?=t00000176 +2 Section A.4: Embedding PuTTY in other programs +3 Section A.4: Embedding PuTTY in other programs=t00000177 +3 Question A.4.1: Is the SSH or Telnet code available as a DLL?=t00000178 +3 Question A.4.2: Is the SSH or Telnet code available as a Visual Basic component?=t00000179 +3 Question A.4.3: How can I use PuTTY to make an SSH connection from within another program?=t00000180 +2 Section A.5: Details of PuTTY's operation +3 Section A.5: Details of PuTTY's operation=t00000181 +3 Question A.5.1: What terminal type does PuTTY use?=t00000182 +3 Question A.5.2: Where does PuTTY store its data?=t00000183 +2 Section A.6: HOWTO questions +3 Section A.6: HOWTO questions=t00000184 +3 Question A.6.1: What login name / password should I use?=t00000185 +3 Question A.6.2: What commands can I type into my PuTTY terminal window?=t00000186 +3 Question A.6.3: How can I make PuTTY start up maximised?=t00000187 +3 Question A.6.4: How can I create a Windows shortcut to start a particular saved session directly?=t00000188 +3 Question A.6.5: How can I start an SSH session straight from the command line?=t00000189 +3 Question A.6.6: How do I copy and paste between PuTTY and other Windows applications?=t00000190 +3 Question A.6.7: How do I use all PuTTY's features (public keys, proxying, cipher selection, etc.) in PSCP, PSFTP and Plink?=t00000191 +3 Question A.6.8: How do I use PSCP.EXE? When I double-click it gives me a command prompt window which then closes instantly.=t00000192 +3 Question A.6.9: How do I use PSCP to copy a file whose name has spaces in?=t00000193 +2 Section A.7: Troubleshooting +3 Section A.7: Troubleshooting=t00000194 +3 Question A.7.1: Why do I see ‘Incorrect MAC received on packet’?=t00000195 +3 Question A.7.2: Why do I see ‘Fatal: Protocol error: Expected control record’ in PSCP?=t00000196 +3 Question A.7.3: I clicked on a colour in the Colours panel, and the colour didn't change in my terminal.=t00000197 +3 Question A.7.4: Plink on Windows 95 says it can't find WS2_32.DLL.=t00000198 +3 Question A.7.5: After trying to establish an SSH-2 connection, PuTTY says ‘Out of memory’ and dies.=t00000199 +3 Question A.7.6: When attempting a file transfer, either PSCP or PSFTP says ‘Out of memory’ and dies.=t00000200 +3 Question A.7.7: PSFTP transfers files much slower than PSCP.=t00000201 +3 Question A.7.8: When I run full-colour applications, I see areas of black space where colour ought to be, or vice versa.=t00000202 +3 Question A.7.9: When I change some terminal settings, nothing happens.=t00000203 +3 Question A.7.10: My PuTTY sessions unexpectedly close after they are idle for a while.=t00000204 +3 Question A.7.11: PuTTY's network connections time out too quickly when network connectivity is temporarily lost.=t00000205 +3 Question A.7.12: When I cat a binary file, I get ‘PuTTYPuTTYPuTTY’ on my command line.=t00000206 +3 Question A.7.13: When I cat a binary file, my window title changes to a nonsense string.=t00000207 +3 Question A.7.14: My keyboard stops working once PuTTY displays the password prompt.=t00000208 +3 Question A.7.15: One or more function keys don't do what I expected in a server-side application.=t00000209 +3 Question A.7.16: Since my SSH server was upgraded to OpenSSH 3.1p1/3.4p1, I can no longer connect with PuTTY.=t00000210 +3 Question A.7.17: Why do I see ‘Couldn't load private key from ...’? Why can PuTTYgen load my key but not PuTTY?=t00000211 +3 Question A.7.18: When I'm connected to a Red Hat Linux 8.0 system, some characters don't display properly.=t00000212 +3 Question A.7.19: Since I upgraded to PuTTY 0.54, the scrollback has stopped working when I run screen.=t00000213 +3 Question A.7.20: Since I upgraded Windows XP to Service Pack 2, I can't use addresses like 127.0.0.2.=t00000214 +3 Question A.7.21: PSFTP commands seem to be missing a directory separator (slash).=t00000215 +3 Question A.7.22: Do you want to hear about ‘Software caused connection abort’?=t00000216 +3 Question A.7.23: My SSH-2 session locks up for a few seconds every so often.=t00000217 +3 Question A.7.24: PuTTY fails to start up. Windows claims that ‘the application configuration is incorrect’.=t00000218 +2 Section A.8: Security questions +3 Section A.8: Security questions=t00000219 +3 Question A.8.1: Is it safe for me to download PuTTY and use it on a public PC?=t00000220 +3 Question A.8.2: What does PuTTY leave on a system? How can I clean up after it?=t00000221 +3 Question A.8.3: How come PuTTY now supports DSA, when the website used to say how insecure it was?=t00000222 +3 Question A.8.4: Couldn't Pageant use VirtualLock() to stop private keys being written to disk?=t00000223 +2 Section A.9: Administrative questions +3 Section A.9: Administrative questions=t00000224 +3 Question A.9.1: Would you like me to register you a nicer domain name?=t00000225 +3 Question A.9.2: Would you like free web hosting for the PuTTY web site?=t00000226 +3 Question A.9.3: Would you link to my web site from the PuTTY web site?=t00000227 +3 Question A.9.4: Why don't you move PuTTY to SourceForge?=t00000228 +3 Question A.9.5: Why can't I subscribe to the putty-bugs mailing list?=t00000229 +3 Question A.9.6: If putty-bugs isn't a general-subscription mailing list, what is?=t00000230 +3 Question A.9.7: How can I donate to PuTTY development?=t00000231 +3 Question A.9.8: Can I have permission to put PuTTY on a cover disk / distribute it with other software / etc?=t00000232 +3 Question A.9.9: Can you sign an agreement indemnifying us against security problems in PuTTY?=t00000233 +3 Question A.9.10: Can you sign this form granting us permission to use/distribute PuTTY?=t00000234 +3 Question A.9.11: Can you write us a formal notice of permission to use PuTTY?=t00000235 +3 Question A.9.12: Can you sign anything for us?=t00000236 +3 Question A.9.13: If you won't sign anything, can you give us some sort of assurance that you won't make PuTTY closed-source in future?=t00000237 +3 Question A.9.14: Can you provide us with export control information / FIPS certification for PuTTY?=t00000238 +2 Section A.10: Miscellaneous questions +3 Section A.10: Miscellaneous questions=t00000239 +3 Question A.10.1: Is PuTTY a port of OpenSSH, or based on OpenSSH?=t00000240 +3 Question A.10.2: Where can I buy silly putty?=t00000241 +3 Question A.10.3: What does ‘PuTTY’ mean?=t00000242 +3 Question A.10.4: How do I pronounce ‘PuTTY’?=t00000243 +1 Appendix B: Feedback and bug reporting +2 Appendix B: Feedback and bug reporting=t00000244 +2 Section B.1: General guidelines +3 Section B.1: General guidelines=t00000245 +3 Section B.1.1: Sending large attachments=t00000246 +3 Section B.1.2: Other places to ask for help=t00000247 +1 Section B.2: Reporting bugs=t00000248 +1 Section B.3: Requesting extra features=t00000249 +1 Section B.4: Requesting features that have already been requested=t00000250 +1 Section B.5: Support requests=t00000251 +1 Section B.6: Web server administration=t00000252 +1 Section B.7: Asking permission for things=t00000253 +1 Section B.8: Mirroring the PuTTY web site=t00000254 +1 Section B.9: Praise and compliments=t00000255 +1 Section B.10: E-mail address=t00000256 +1 Appendix C: PuTTY Licence +2 Appendix C: PuTTY Licence=t00000257 +1 Appendix D: PuTTY hacking guide +2 Appendix D: PuTTY hacking guide=t00000258 +2 Section D.1: Cross-OS portability=t00000259 +2 Section D.2: Multiple backends treated equally=t00000260 +2 Section D.3: Multiple sessions per process on some platforms=t00000261 +2 Section D.4: C, not C++=t00000262 +2 Section D.5: Security-conscious coding=t00000263 +2 Section D.6: Independence of specific compiler=t00000264 +2 Section D.7: Small code size=t00000265 +2 Section D.8: Single-threaded code=t00000266 +2 Section D.9: Keystrokes sent to the server wherever possible=t00000267 +2 Section D.10: 640×480 friendliness in configuration panels=t00000268 +2 Section D.11: Automatically generated Makefiles=t00000269 +2 Section D.12: Coroutines in ssh.c=t00000270 +2 Section D.13: Single compilation of each source file=t00000271 +2 Section D.14: Do as we say, not as we do=t00000272 +1 Appendix E: PuTTY download keys and signatures +2 Appendix E: PuTTY download keys and signatures=pgpfingerprints +2 Section E.1: Public keys=t00000273 +2 Section E.2: Security details +3 Section E.2: Security details=t00000274 +3 Section E.2.1: The Development Snapshots keys=t00000275 +3 Section E.2.2: The Releases keys=t00000276 +3 Section E.2.3: The Master Keys=t00000277 diff --git a/Build/Automate/VC/PuTTY/putty.exe b/Build/Automate/VC/PuTTY/putty.exe new file mode 100644 index 0000000..38b49b6 Binary files /dev/null and b/Build/Automate/VC/PuTTY/putty.exe differ diff --git a/Build/Automate/VC/PuTTY/putty.hlp b/Build/Automate/VC/PuTTY/putty.hlp new file mode 100644 index 0000000..92cfc98 Binary files /dev/null and b/Build/Automate/VC/PuTTY/putty.hlp differ diff --git a/Build/Automate/VC/PuTTY/puttygen.exe b/Build/Automate/VC/PuTTY/puttygen.exe new file mode 100644 index 0000000..c548873 Binary files /dev/null and b/Build/Automate/VC/PuTTY/puttygen.exe differ diff --git a/Build/Automate/VC/PuTTY/unins000.dat b/Build/Automate/VC/PuTTY/unins000.dat new file mode 100644 index 0000000..1b66fa2 Binary files /dev/null and b/Build/Automate/VC/PuTTY/unins000.dat differ diff --git a/Build/Automate/VC/PuTTY/unins000.exe b/Build/Automate/VC/PuTTY/unins000.exe new file mode 100644 index 0000000..752dd34 Binary files /dev/null and b/Build/Automate/VC/PuTTY/unins000.exe differ diff --git a/Build/Automate/VC/PuTTY/website.url b/Build/Automate/VC/PuTTY/website.url new file mode 100644 index 0000000..4b50369 Binary files /dev/null and b/Build/Automate/VC/PuTTY/website.url differ diff --git a/Build/Automate/VC/Shortcuts.vbs b/Build/Automate/VC/Shortcuts.vbs new file mode 100644 index 0000000..b581225 --- /dev/null +++ b/Build/Automate/VC/Shortcuts.vbs @@ -0,0 +1,24 @@ +set WshShell = WScript.CreateObject("WScript.Shell") +set oShortCutLink = WshShell.CreateShortcut("C:\Users\Public\Desktop\vSphere.lnk") +oShortCutLink.TargetPath = "C:\Program Files (x86)\VMware\Infrastructure\Virtual Infrastructure Client\Launcher\VpxClient.exe" +oShortCutLink.Arguments = "-s vc.lab.local -PassthroughAuth" +oShortCutLink.Save + +set oShortCutLink = WshShell.CreateShortcut("C:\Users\Public\Desktop\VMware vSphere Client.lnk") +oShortCutLink.TargetPath = "C:\Program Files (x86)\VMware\Infrastructure\Virtual Infrastructure Client\Launcher\VpxClient.exe" +oShortCutLink.Save + + +set oShortCutLink = WshShell.CreateShortcut("C:\Users\Public\Desktop\AutoLab Script Menu.lnk") +oShortCutLink.TargetPath = "%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe" +oShortCutLink.Arguments = " c:\ScriptMenu.ps1" +oShortCutLink.Save + +set oShortCutLink = WshShell.CreateShortcut("C:\Users\Public\Desktop\AutoLab Portal.lnk") +oShortCutLink.TargetPath = "C:\Program Files (x86)\Internet Explorer\iexplore.exe" +oShortCutLink.Arguments = " dc.lab.local" +oShortCutLink.Save + +set oShortCutLink = WshShell.CreateShortcut("C:\Users\Public\Desktop\PuTTY.lnk") +oShortCutLink.TargetPath = "C:\Program Files (x86)\PuTTY\PuTTY.exe" +oShortCutLink.Save diff --git a/Build/Automate/VC/VC41.cmd b/Build/Automate/VC/VC41.cmd new file mode 100644 index 0000000..e1ab4dc --- /dev/null +++ b/Build/Automate/VC/VC41.cmd @@ -0,0 +1,17 @@ +@echo off +echo * Install vCenter 4.1 +echo * Install vCenter 4.1 >> c:\buildLog.txt +start /wait B:\VIM_41\vpx\VMware-vcserver.exe /q /s /w /L1033 /v" /qr WARNING_LEVEL=0 USERNAME=\"Lab\" COMPANYNAME=\"lab.local\" DB_SERVER_TYPE=Custom DB_DSN=\"VCenterDB\" DB_USERNAME=\"vpx\" DB_PASSWORD=\"VMware1!\" VPX_USES_SYSTEM_ACCOUNT=\"1\" FORMAT_DB=1 VCS_GROUP_TYPE=Single" +echo ** +echo * Install vSphere Client 4.1 +echo * Install vSphere Client 4.1 >> c:\buildLog.txt +start /wait B:\VIM_41\vpx\VMware-viclient.exe /q /s /w /L1033 /v" /qr" +echo ** +echo * Install vSphere Client 4.1 VUM Plugin +echo * Install vSphere Client 4.1 VUM Plugin >> c:\buildLog.txt +start /wait B:\VIM_41\updateManager\VMware-UMClient.exe /q /s /w /L1033 /v" /qr" +timeout 30 +echo ** +echo * Install vCenter Update Manager 4.1 +echo * Install vCenter Update Manager 4.1 >> c:\buildLog.txt +start /wait B:\VIM_41\updateManager\VMware-UpdateManager.exe /L1033 /v" /qn VMUM_SERVER_SELECT=192.168.199.5 VC_SERVER_IP=vc.lab.local VC_SERVER_ADMIN_USER=\"administrator\" VC_SERVER_ADMIN_PASSWORD=\"VMware1!\" VCI_DB_SERVER_TYPE=Custom VCI_FORMAT_DB=1 DB_DSN=\"VUM\" DB_USERNAME=\"vpx\" DB_PASSWORD=\"VMware1!\" " diff --git a/Build/Automate/VC/VC50.cmd b/Build/Automate/VC/VC50.cmd new file mode 100644 index 0000000..44daad3 --- /dev/null +++ b/Build/Automate/VC/VC50.cmd @@ -0,0 +1,16 @@ +@echo off +echo * Install vCenter 5.0 +echo * Install vCenter 5.0 >> c:\buildLog.txt +start /wait B:\VIM_50\vCenter-Server\VMware-vcserver.exe /q /s /w /L1033 /v" /qr WARNING_LEVEL=0 USERNAME=\"Lab\" COMPANYNAME=\"lab.local\" DB_SERVER_TYPE=Custom DB_DSN=\"VCenterDB\" DB_USERNAME=\"vpx\" DB_PASSWORD=\"VMware1!\" VPX_USES_SYSTEM_ACCOUNT=\"1\" FORMAT_DB=1 VCS_GROUP_TYPE=Single" +echo ** +echo * Install vSphere Client 5.0 +echo * Install vSphere Client 5.0 >> c:\buildLog.txt +start /wait B:\VIM_50\vSphere-Client\VMware-viclient.exe /q /s /w /L1033 /v" /qr" +echo ** +echo * Install vSphere Client 5.0 VUM Plugin +echo * Install vSphere Client 5.0 VUM Plugin >> c:\buildLog.txt +start /wait B:\VIM_50\updateManager\VMware-UMClient.exe /q /s /w /L1033 /v" /qr" +echo ** +echo * Install vCenter Update Manager 5.0 +echo * Install vCenter Update Manager 5.0 >> c:\buildLog.txt +start /wait B:\VIM_50\updateManager\VMware-UpdateManager.exe /L1033 /v" /qn VMUM_SERVER_SELECT=192.168.199.5 VC_SERVER_IP=vc.lab.local VC_SERVER_ADMIN_USER=\"administrator\" VC_SERVER_ADMIN_PASSWORD=\"VMware1!\" VCI_DB_SERVER_TYPE=Custom VCI_FORMAT_DB=1 DB_DSN=\"VUM\" DB_USERNAME=\"vpx\" DB_PASSWORD=\"VMware1lab\" " diff --git a/Build/Automate/VC/VeeamOne.reg b/Build/Automate/VC/VeeamOne.reg new file mode 100644 index 0000000..1ab8e6e Binary files /dev/null and b/Build/Automate/VC/VeeamOne.reg differ diff --git a/Build/Automate/VC/WinTemplate.nvram b/Build/Automate/VC/WinTemplate.nvram new file mode 100644 index 0000000..38d5bf8 Binary files /dev/null and b/Build/Automate/VC/WinTemplate.nvram differ diff --git a/Build/Automate/VC/bfi-nu2lic.txt b/Build/Automate/VC/bfi-nu2lic.txt new file mode 100644 index 0000000..9f7d94f --- /dev/null +++ b/Build/Automate/VC/bfi-nu2lic.txt @@ -0,0 +1,121 @@ +Copyright (c) 2002 Bart Lagerweij. All rights reserved. + + NU2-LICENSE + +1. By using and/or opening any packaging enclosing this +software, expanding any compressed file containing this +software or by utilizing this software, you agree to be +bound by the terms of this license agreement. + +2. The software, documentation and any other materials +accompanying this License whether on disk, in read only +memory, on any other media or in any other form +(collectively the "Software") are licensed, not sold, to you +by Bart Lagerweij, as well as their respective members, +agents, directors, officers, servants and representatives +(collectively "Licensor") for use only under the terms of +this License, and Licensor reserves all rights not expressly +granted to you. The rights granted herein are limited to +Licensor's intellectual property rights in the Software and +do not include any other patents or intellectual property +rights. You own the media on which the Software is recorded +but Licensor retains ownership of the Software itself. The +rights granted under the terms of this License include any +software upgrades that replace and/or supplement the +original Software product, unless such upgrade contains a +separate license. + +3. Permission is hereby granted, free of charge, to any +person obtaining a copy of the Software to use, copy, +publish and distribute the Software, subject to the +conditions of this License. + +4. This license must be included with all copies of the +Software, and may not be modified from its original format +as created by the Licensor. The Software may not be +distributed subject to any other license. + +5. This License is effective until terminated. Your rights +under this License will terminate automatically without +notice from Licensor or if you fail to comply with any +term(s) of this License. Upon the termination of this +License, you shall cease all use of the Software and destroy +all copies of it, whether full or partial. + +6. Selling or charging a fee for the Software is prohibited, +although a fee may be charged for the act of transferring a +copy and/or for the distribution media, but not for the +Software itself. + +7. The Software, in whole or in part, may not be +incorporated with or into any other software product without +written permission from Licensor. + +8. You expressly acknowledge and agree that use of the +software is at your sole risk and that the entire risk as to +satisfactory quality, performance, accuracy and effort is +with you. Licensor does not warrant against interference +with your enjoyment of the software, that the functions +contained in the software will meet your requirements, that +the operation of the software will be uninterrupted or +error-free, or that defects in the software will be +corrected. Should the software prove defective, you assume +the entire cost of all necessary servicing, repair or +correction. + +9. THE SOFTWARE IS PROVIDED "AS IS," WITHOUT WARRANTY OF ANY +KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR +PURPOSE AND NONINFRINGEMENT. No oral or written advice given +by Licensor or by an authorized representative of Licensor +shall create a warranty. + +10. TO THE EXTENT NOT PROHIBITED BY LAW, IN NO EVENT SHALL +THE LICENSOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, INCLUDING BUT NOT LIMITED TO PERSONAL INJURY, OR +ANY INCIDENTAL, SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES +WHATSOEVER, INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS +OF PROFITS, LOSS OF DATA, BUSINESS INTERRUPTION OR ANY OTHER +COMMERCIAL DAMAGES OR LOSSES, ARISING OUT OF OR RELATED TO +YOUR USE OR INABILITY TO USE THE SOFTWARE, HOWEVER CAUSED, +REGARDLESS OF THE THEORY OF LIABILITY (CONTRACT, TORT OR +OTHERWISE) AND EVEN IF LICENSOR HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + +11. THIS SOFTWARE IS NOT INTENDED FOR USE IN ANY APPLICATION +IN WHICH THE FAILURE OF THE SOFTWARE COULD LEAD TO DEATH, +PERSONAL INJURY OR SEVERE PHYSICAL OR ENVIRONMENTAL DAMAGE. + +12. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF IMPLIED +WARRANTIES, LIABILITY OR LIMITATIONS ON APPLICABLE STATUTORY +RIGHTS OF A CONSUMER, SO THE ABOVE EXCLUSIONS AND +LIMITATIONS MAY NOT APPLY TO YOU. IF SUCH EXCLUSIONS FROM +LIABILITY APPLY TO YOU, DO NOT USE THIS SOFTWARE. + +13. In no event shall Licensor's total liability to you for +all damages exceed the amount of $50.00. The foregoing +limitations will apply even if the above stated remedy fails +in its essential purpose. + +14. This License constitutes the entire agreement between +the parties with respect to the use of the Software licensed +hereunder and supersedes all prior or contemporaneous +understandings regarding such subject matter. No amendment +to or modification of this License will be binding unless in +writing and signed by Licensor. Any translation of this +License is done for local requirements and in the event of a +dispute between the English and any non-English versions, +the English version of this License shall govern. + +15. This License will be governed by and construed in +accordance with the laws of the Netherlands, as applied to +agreements entered into and to be performed entirely within +the Netherlands between Dutch residents. This License shall +not be governed by the United Nations Convention on +Contracts for the International Sale of Goods, the +application of which is expressly excluded. + +16. If for any reason a court of competent jurisdiction +finds any provision, or portion thereof, to be +unenforceable, the remainder of this License shall continue +in full force and effect. diff --git a/Build/Automate/VC/bfi.exe b/Build/Automate/VC/bfi.exe new file mode 100644 index 0000000..ef0f734 Binary files /dev/null and b/Build/Automate/VC/bfi.exe differ diff --git a/Build/Automate/VC/mkisofs.exe b/Build/Automate/VC/mkisofs.exe new file mode 100644 index 0000000..f6c9f5d Binary files /dev/null and b/Build/Automate/VC/mkisofs.exe differ diff --git a/Build/Automate/VC/sshAutoConnect/sshAutoConnect.dll b/Build/Automate/VC/sshAutoConnect/sshAutoConnect.dll new file mode 100644 index 0000000..a12fded Binary files /dev/null and b/Build/Automate/VC/sshAutoConnect/sshAutoConnect.dll differ diff --git a/Build/Automate/VC/sshAutoConnect/sshAutoConnect.xml b/Build/Automate/VC/sshAutoConnect/sshAutoConnect.xml new file mode 100644 index 0000000..4bb3ed4 --- /dev/null +++ b/Build/Automate/VC/sshAutoConnect/sshAutoConnect.xml @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="utf-8" ?> +<credentials> + <default> + <login>root</login> + <password>Vk13YXJlMSE=</password> + </default> +</credentials> \ No newline at end of file diff --git a/Build/Automate/VC/vCenter6DB.reg b/Build/Automate/VC/vCenter6DB.reg new file mode 100644 index 0000000..100d55f Binary files /dev/null and b/Build/Automate/VC/vCenter6DB.reg differ diff --git a/Build/Automate/VC/vCenterDB.reg b/Build/Automate/VC/vCenterDB.reg new file mode 100644 index 0000000..0170fe2 Binary files /dev/null and b/Build/Automate/VC/vCenterDB.reg differ diff --git a/Build/Automate/VC/vCentre60.json b/Build/Automate/VC/vCentre60.json new file mode 100644 index 0000000..0ad8ce6 --- /dev/null +++ b/Build/Automate/VC/vCentre60.json @@ -0,0 +1,74 @@ +{ + "INSTALLDIR" : "C:\\Program Files\\VMware\\", + "appliance.net.pnid" : "vc.lab.local", + "appliance.net.ports" : { + "autodeploy.ext.managementport" : 6502, + "autodeploy.ext.serviceport" : 6501, + "cis-license.int.http" : 12080, + "cm.int.cmhttp" : 18090, + "eam.int.http" : 15005, + "eam.int.https" : 15006, + "invsvc.int.http" : 10080, + "mbcs.int.http" : 10201, + "netdumper.ext.serviceport" : 6500, + "netdumper.int.webport" : 8000, + "perfcharts.int.https" : 13080, + "rhttpproxy.ext.port1" : 80, + "rhttpproxy.ext.port2" : 443, + "sca.int.scahttp" : 18091, + "sps.int.pbmhttp" : 8190, + "sps.int.pbmhttps" : 8191, + "sps.int.smshttp" : 22000, + "sps.int.smshttps" : 22100, + "sps.int.spshttp" : 21000, + "sps.int.spshttps" : 21100, + "sts.ext.port1" : 7444, + "sts.int.port1" : 7081, + "syslog.ext.port" : 514, + "syslog.ext.tls.port" : 1514, + "vapi.int.endpoint-http" : 12346, + "vapi.int.endpoint-https" : 12347, + "vapi.int.metadata-http" : 4298, + "vmafd.ext.port1" : 2020, + "vmca.ext.port1" : 2014, + "vmdir.compatibility.ext.port1" : 11711, + "vmdir.compatibility.ext.port2" : 11712, + "vmdir.dcerpc.ext.port1" : 2012, + "vmdir.ext.port1" : 389, + "vmdir.ext.port2" : 636, + "vmkdc.ext.port1" : 88, + "vpostgres.int.healthstat_port" : 5444, + "vpostgres.int.server_port" : 5432, + "vpxd.ext.port1" : 902, + "vpxd.int.sdk-port" : 8085, + "vpxd.int.sdk-tunnel-port" : 8089, + "vsm.int.http" : 15007, + "vsm.int.https" : 15008, + "vsphere-client.ext.port1" : 9443, + "workflow.int.jmx-port" : 19999, + "workflow.int.service-port" : 8088 + }, + "clientlocale" : "en", + "db.clobber" : null, + "db.dsn" : "vCenterDB", + "db.password" : "VMware1!", + "db.type" : "external", + "db.user" : "vpx", + "deployment.node.type" : "embedded", + "machine.cert.replacement" : null, + "silentinstall" : null, + "system.vm0.hostname" : null, + "system.vm0.port" : "443", + "upgrade.import.directory" : null, + "vc.5x.password" : null, + "vc.5x.username" : null, + "vc.svcuser" : "", + "vc.svcuserpassword" : null, + "vmdir.cert.thumbprint" : null, + "vmdir.domain-name" : "vsphere.local", + "vmdir.first-instance" : true, + "vmdir.password" : "VMware1!", + "vmdir.replication-partner-hostname" : null, + "vmdir.site-name" : "Default-First-Site", + "vmware.data.directory" : "C:\\ProgramData\\VMware\\" +} diff --git a/Build/Automate/VC/vSphereClient.reg b/Build/Automate/VC/vSphereClient.reg new file mode 100644 index 0000000..4221114 Binary files /dev/null and b/Build/Automate/VC/vSphereClient.reg differ diff --git a/Build/Automate/VC2/Build.cmd b/Build/Automate/VC2/Build.cmd new file mode 100644 index 0000000..9d91edc --- /dev/null +++ b/Build/Automate/VC2/Build.cmd @@ -0,0 +1,22 @@ +@echo off +echo ************************* +echo * +echo ** +echo * Connect to build share +net use B: \\192.168.199.7\Build >> c:\buildlog.txt +md c:\temp +type b:\automate\version.txt >> c:\buildlog.txt +regedit -s b:\Automate\_Common\ExecuPol.reg +regedit -s b:\Automate\_Common\NoSCRNSave.reg +regedit -s B:\Automate\_Common\ExplorerView.reg +regedit -s b:\Automate\_Common\IExplorer.reg +regedit -s b:\Automate\VC2\vCenterDB.reg +copy b:\automate\_Common\wasp.dll c:\windows\system32 +copy B:\Automate\validate.ps1 C:\ +copy B:\Automate\PSFunctions.ps1 C:\ +copy B:\Automate\VC2\Build.ps1 c:\ +echo * Starting PowerShell script for Phase 2 completion +echo * Starting PowerShell script for Phase 2 completion >> C:\buildlog.txt +powershell c:\Build.ps1 +rem if exist C:\Build.ps1 del c:\Build.ps1 +rem if exist c:\Build.cmd del c:\Build.cmd \ No newline at end of file diff --git a/Build/Automate/VC2/Build.ps1 b/Build/Automate/VC2/Build.ps1 new file mode 100644 index 0000000..f239f98 --- /dev/null +++ b/Build/Automate/VC2/Build.ps1 @@ -0,0 +1,328 @@ +if (Test-Path C:\PSFunctions.ps1) { + . "C:\PSFunctions.ps1" +} else { + Write-Host "PSFunctions.ps1 not found. Please copy all PowerShell files from B:\Automate to C:\ and rerun Build.ps1" + Read-Host "Press <Enter> to exit" + exit +} + +# Start VC2 configuration process +if (Test-Path "B:\Automate\automate.ini") { + Write-BuildLog "Determining automate.ini settings." + $vcinstall = "55" + $vcinstall = ((Select-String -SimpleMatch "VCInstall=" -Path "B:\Automate\automate.ini").line).substring(10) + If ($vcinstall -eq "50") {$vcinstall = "5"} + Write-BuildLog " VMware vCenter install set to $vcinstall." + $viewinstall = "None" + $buildvm = "false" + $buildviewvm = "false" + $timezone = "New Zealand Standard Time" + $timezone = ((Select-String -SimpleMatch "TZ=" -Path "B:\Automate\automate.ini").line).substring(3) + Write-BuildLog " Timezone set to $timezone." + $DeployVUM = $false + $AutoAddHosts = "false" + $AutoAddHosts = ((Select-String -SimpleMatch "AutoAddHosts=" -Path "B:\Automate\automate.ini").line).substring(13) + if ($AutoAddHosts -like "true") { + $AutoAddHosts = $true + Write-BuildLog " Hosts will be automatically added to vCenter after build completes." + } else { + $AutoAddHosts = $false + } + $AutoVCNS = "false" + $AdminPWD = "VMware1!" + $AdminPWD = ((Select-String -SimpleMatch "Adminpwd=" -Path "B:\Automate\automate.ini").line).substring(9) +} else { + Write-BuidLog "Unable to find B:\Automate\automate.ini. Where did it go?" +} +Write-BuildLog "Change default local administrator password" +net user administrator $AdminPWD +B:\automate\_Common\Autologon administrator vc2 $AdminPWD + +Write-BuildLog "Installing 7-zip." +try { + Start-Process msiexec -ArgumentList '/qb /i B:\Automate\_Common\7z920-x64.msi' -Wait +} +catch { + Write-BuildLog "7-zip installation failed." +} +Write-BuildLog "Installing PuTTy." +$null = New-Item -Path "C:\Program Files (x86)\PuTTY" -ItemType Directory -Force +xcopy B:\Automate\VC2\PuTTY\*.* "C:\Program Files (x86)\PuTTY" /s /c /y /q +regedit -s B:\Automate\VC2\PuTTY.reg +try { + Write-BuildLog "Installing Adobe Flash Player." + Start-Process msiexec -ArgumentList '/i b:\Automate\_Common\install_flash_player_11_active_x.msi /qb' -Wait +} +catch { + Write-BuildLog "Adobe Flash Player installation failed." +} + +Write-BuildLog "" +if (Test-Path "b:\VMware-PowerCLI*.exe") { + if (Test-Path "b:\VMware-PowerCLI.exe") { + $PowCLIver = (Get-ChildItem B:\VMware-PowerCLI.exe).VersionInfo.ProductVersion.trim() + If ($PowCLIver -eq "5.0.0.3501") {$PowCLIver = "5.0.0-3501"} + Rename-Item B:\VMware-PowerCLI.exe B:\VMware-PowerCLI-$PowCLIver.exe + } + #Start-Process b:\VMware-PowerCLI.exe -ArgumentList '/q /s /w /L1033 /V" /qb"' -Wait -Verb RunAs + $null = New-Item -Path "C:\Users\vi-admin\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1" -ItemType File -Force + $null = Add-Content -Path "C:\Users\vi-admin\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1" -Value @" +if ((Get-PSSnapin -Name VMware.VimAutomation.Core -ErrorAction SilentlyContinue) -eq `$null) { + try { + Write-Host "Loading PowerCLI plugin, this may take a little while" -foregroundcolor "cyan" + Add-PSSnapin VMware.VimAutomation.Core + `$PCLIVer = Get-PowerCLIVersion + if (((`$PCLIVer.Major * 10 ) + `$PCLIVer.Minor) -ge 51) { + `$null = Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -confirm:`$false -Scope "Session" + } + } + catch { + Write-Host "Unable to load the PowerCLI plugin. Please verify installation or install VMware PowerCLI and run this script again." + Read-Host "Press <Enter> to exit" + exit + } +} +"@ +} else { + Write-BuildLog "VMware PowerCLI installer not found. This will need to be installing before running any AutoLab PowerShell post-install scripts." +} + +switch ($vcinstall) { + 55 { + Write-BuildLog "Starting vCenter 5.5 automation." + if (Test-Path "b:\VIM_55\redist\SQLEXPR\SQLEXPR_x64_ENU.exe") { + Write-BuildLog "SQL Server 2008 R2 Express SP1 for vCenter 5.5 found; installing." + Start-Process b:\VIM_55\redist\SQLEXPR\SQLEXPR_x64_ENU.exe -ArgumentList '/extract:c:\temp /quiet' -Wait -Verb RunAs + if (Test-Path "C:\temp\pcusource\1033_enu_lp\x64\setup\x64\sqlncli.msi") { + copy C:\temp\pcusource\1033_enu_lp\x64\setup\x64\sqlncli.msi c:\temp + } elseif (Test-Path "C:\temp\1033_enu_lp\x64\setup\x64\sqlncli.msi") { + copy C:\temp\1033_enu_lp\x64\setup\x64\sqlncli.msi c:\temp + } + if (Test-Path "C:\temp\sqlncli.msi") { + Write-BuildLog "Installing SQL native client." + Start-Process msiexec -ArgumentList '/i C:\temp\sqlncli.msi ADDLOCAL=ALL IACCEPTSQLNCLILICENSETERMS=YES /qb' -Wait -Verb RunAs + } + } else { + Write-BuildLog "SQL Server 2008 R2 Express SP1 for vCenter 5.5 not found. Exiting." + Read-Host "Press <Enter> to exit" + exit + } + Write-BuildLog "Installing vCenter 5.5 Single Sign On." + start-Process msiexec -argumentList '/i "B:\VIM_55\Single Sign-On\VMware-SSO-Server.msi" /qr SSO_HTTPS_PORT=7444 DEPLOYMODE=FIRSTDOMAIN ADMINPASSWORD=VMware1! SSO_SITE=Lab' -Wait -Verb RunAs + Write-BuildLog "Installing vCenter 5.5 Web Client." + Start-Process B:\VIM_55\vSphere-WebClient\VMware-WebClient.exe -ArgumentList '/L1033 /v" HTTP_PORT=9090 HTTPS_PORT=9443 SSO_ADMIN_USER=administrator@vsphere.local SSO_ADMIN_PASSWORD=VMware1! LS_URL=https://vc2.lab.local:7444/lookupservice/sdk /qr"' -Wait -Verb RunAs + Write-BuildLog "Installing vCenter 5.5 Inventory Service." + Start-Process "B:\VIM_55\Inventory Service\VMware-inventory-service.exe" -argumentList ' /S /L1033 /v" QUERY_SERVICE_NUKE_DATABASE=1 SSO_ADMIN_USER=administrator@vsphere.local SSO_ADMIN_PASSWORD=VMware1! LS_URL=https://vc2.lab.local:7444/lookupservice/sdk /qr"' -Wait -Verb RunAs + Write-BuildLog "Installing vCenter 5.5." + Start-Process B:\VIM_55\vCenter-Server\VMware-vcserver.exe -ArgumentList '/S /W /L1033 /v" /qr /norestart WARNING_LEVEL=0 VCS_GROUP_TYPE=Single VPX_ACCOUNT_TYPE=System DB_SERVER_TYPE=Custom DB_DSN=vCenterDB DB_USERNAME=vpx DB_PASSWORD=VMware1! FORMAT_DB=1 IS_URL="https://localhost:10443" SSO_ADMIN_USER=administrator@vsphere.local SSO_ADMIN_PASSWORD=VMware1! VC_ADMIN_USER=administrators@VC2 VC_ADMIN_IS_GROUP_VPXD_TXT=true LS_URL=https://vc2.lab.local:7444/lookupservice/sdk "' -Wait -Verb RunAs + Write-BuildLog "Installing vSphere Client 5.5." + Start-Process B:\VIM_55\redist\vjredist\x64\vjredist64.exe -ArgumentList '/q:a /c:"install.exe /q"' -Wait -Verb RunAs + Start-Process B:\VIM_55\vSphere-Client\VMware-viclient.exe -ArgumentList '/qb /s /w /L1033 /v" /qr"' -Wait -Verb RunAs + $null = mkdir "C:\Program Files (x86)\VMware\Infrastructure\Virtual Infrastructure Client\Plugins\SSHAutoConnect" + $null = copy B:\Automate\vc\SSHAutoConnect\*.* "C:\Program Files (x86)\VMware\Infrastructure\Virtual Infrastructure Client\Plugins\SSHAutoConnect" + If ($DeployVUM) { + Write-BuildLog "Installing vSphere Client 5.5 VUM Plugin." + Start-Process B:\VIM_55\updateManager\VMware-UMClient.exe -ArgumentList '/qb /s /w /L1033 /v" /qr"' -Wait -Verb RunAs + Write-BuildLog "Installing vCenter Update Manager 5.5." + $Arguments = '""/L1033 /v" /qr VMUM_SERVER_SELECT=vc2.lab.local VC_SERVER_IP=vc2.lab.local VC_SERVER_ADMIN_USER=\"VC\administrator\" VC_SERVER_ADMIN_PASSWORD=' + $AdminPWD +' VCI_DB_SERVER_TYPE=Custom VCI_FORMAT_DB=1 DB_DSN=VUM DB_USERNAME=vpx DB_PASSWORD=VMware1!"' + Start-Process B:\VIM_55\updateManager\VMware-UpdateManager.exe -ArgumentList $Arguments -Wait -Verb RunAs + } + Write-BuildLog "Installing vSphere Web Client Integration plugin." + copy "C:\Program Files\VMware\Infrastructure\vSphereWebClient\server\work\deployer\s\global\72\0\container-app-war-5.5.0.war\vmrc\VMware-ClientIntegrationPlugin-5.5.0.exe" c:\ + Start-Process C:\VMware-ClientIntegrationPlugin-5.5.0.exe -ArgumentList '/v/qn' -Wait -Verb RunAs + if (Test-Path "b:\VMware-PowerCLI-5.5.*.exe") { + Write-BuildLog "VMware PowerCLI installer found; installing." + Start-Process (Get-ChildItem b:\VMware-PowerCLI-5.5.*.exe).FullName -ArgumentList '/q /s /w /L1033 /V" /qb"' -Wait -Verb RunAs + } elseif (Test-Path "b:\VMware-PowerCLI-5.0.*.exe"){ + Write-BuildLog "PowerCLI installer is out of date, installing anyway." + Start-Process (Get-ChildItem b:\VMware-PowerCLI-5.0.*.exe).FullName -ArgumentList '/q /s /w /L1033 /V" /qb"' -Wait -Verb RunAs + } else {Write-BuildLog "PowerCLI installer not found."} + } + 51 { + Write-BuildLog "Starting vCenter 5.1 automation." + if (Test-Path "b:\VIM_51\redist\SQLEXPR\SQLEXPR_x64_ENU.exe") { + Write-BuildLog "SQL Server 2008 R2 Express SP1 for vCenter 5.1 found; installing." + Start-Process b:\VIM_51\redist\SQLEXPR\SQLEXPR_x64_ENU.exe -ArgumentList '/extract:c:\temp /quiet' -Wait -Verb RunAs + if (Test-Path "C:\temp\pcusource\1033_enu_lp\x64\setup\x64\sqlncli.msi") { + copy C:\temp\pcusource\1033_enu_lp\x64\setup\x64\sqlncli.msi c:\temp + } elseif (Test-Path "C:\temp\1033_enu_lp\x64\setup\x64\sqlncli.msi") { + copy C:\temp\1033_enu_lp\x64\setup\x64\sqlncli.msi c:\temp + } + if (Test-Path "C:\temp\sqlncli.msi") { + Write-BuildLog "Installing SQL native client." + Start-Process msiexec -ArgumentList '/i C:\temp\sqlncli.msi ADDLOCAL=ALL IACCEPTSQLNCLILICENSETERMS=YES /qb' -Wait -Verb RunAs + } + } else { + Write-BuildLog "SQL Server 2008 R2 Express SP1 for vCenter 5.1 not found. Exiting." + Read-Host "Press <Enter> to exit" + exit + } + Write-BuildLog "Installing vCenter 5.1 Single Sign On" + Start-Process "B:\VIM_51\Single Sign On\VMware-SSO-Server.exe" -ArgumentList '/L1033 /v"/qb MASTER_PASSWORD=VMware1! CONFIRM_MASTER_PASSWORD=VMware1! CONFIG_TYPE=Setup SETUP_TYPE=Basic SSO_DB_SERVER_TYPE=\"Custom\" JDBC_DBTYPE=Mssql JDBC_DBNAME=RSA JDBC_HOSTNAME_OR_IP=DC2 JDBC_HOST_PORT=1433 JDBC_USERNAME=RSA_USER JDBC_PASSWORD=VMware1! SKIP_DB_USER_CREATION=1 DBA_JDBC_USERNAME=RSA_DBA DBA_JDBC_PASSWORD=VMware1! COMPUTER_FQDN=vc2.lab.local IS_SSPI_NETWORK_SERVICE_ACCOUNT=1 SSO_HTTPS_PORT=7444"' -Wait -Verb RunAs + Write-BuildLog "Installing vCenter 5.1 Web Client" + Start-Process B:\VIM_51\vSphere-WebClient\VMware-WebClient.exe -ArgumentList '/L1033 /v" HTTP_PORT=9090 HTTPS_PORT=9443 SSO_ADMIN_USER=admin@System-Domain SSO_ADMIN_PASSWORD=VMware1! LS_URL=https://vc2.lab.local:7444/lookupservice/sdk /qr"' -Wait -Verb RunAs + Write-BuildLog "Add AD to SSO since the installer failed to add" + Start-Process "C:\Program Files\VMware\Infrastructure\SSOServer\utils\rsautil" -ArgumentList ' manage-identity-sources -a create -u admin -p VMware1! -r ldap://dc.lab.local --ldap-port 3268 -d lab.local -l LAB --principal-base-dn dc=lab,dc=local --group-base-dn dc=lab,dc=local -f ldap://dc2.lab.local -L administrator@lab.local -P VMware1!' -Wait -Verb RunAs + Write-BuildLog "Installing vCenter 5.1 Inventory Service" + Start-Process "B:\VIM_51\Inventory Service\VMware-inventory-service.exe" -ArgumentList '/L1033 /v" HTTPS_PORT=10443 XDB_PORT=10109 FEDERATION_PORT=10111 QUERY_SERVICE_NUKE_DATABASE=1 TOMCAT_MAX_MEMORY_OPTION=S SSO_ADMIN_USER=admin@System-Domain SSO_ADMIN_PASSWORD=VMware1! LS_URL=https://vc2.lab.local:7444/lookupservice/sdk /qr"' -Wait -Verb RunAs + Write-BuildLog "Installing vCenter 5.1" + Start-Process B:\VIM_51\vCenter-Server\VMware-vcserver.exe -ArgumentList '/L1033 /v" /qr DB_SERVER_TYPE=Custom DB_DSN=vCenterDB DB_USERNAME=vpx DB_PASSWORD=VMware1! FORMAT_DB=1 JVM_MEMORY_OPTION=S SSO_ADMIN_USER=admin@System-Domain SSO_ADMIN_PASSWORD=VMware1! LS_URL=https://vc2.lab.local:7444/lookupservice/sdk IS_URL=https://vc2.lab.local:10443 VC_ADMIN_USER=vi-admin@lab VC_ADMIN_IS_GROUP_VPXD_TXT=0 VPX_USES_SYSTEM_ACCOUNT=1 VCS_GROUP_TYPE=Single VCS_ADAM_LDAP_PORT=389 VCS_ADAM_SSL_PORT=636 VCS_HTTPS_PORT=443 VCS_HTTP_PORT=80 TC_HTTP_PORT=8080 TC_HTTPS_PORT=8443 VCS_WSCNS_PORT=60099 VCS_HEARTBEAT_PORT=902"' -Wait -Verb RunAs + Write-BuildLog "Installing vSphere Client 5.1" + Start-Process B:\VIM_51\redist\vjredist\x64\vjredist64.exe -ArgumentList '/q:a /c:"install.exe /q"' -Wait -Verb RunAs + Start-Process B:\VIM_51\vSphere-Client\VMware-viclient.exe -ArgumentList '/qb /s /w /L1033 /v" /qr"' -Wait -Verb RunAs + Write-BuildLog "Installing vSphere Web Client Integration plugin" + copy "C:\Program Files\VMware\Infrastructure\vSphereWebClient\server\work\org.eclipse.virgo.kernel.deployer_3.0.3.RELEASE\staging\global\bundle\com.vmware.vsphere.client.containerapp\5.1.0\container-app-war-5.1.0.war\vmrc\VMware-ClientIntegrationPlugin-5.1.0.exe" c:\ + Start-Process C:\VMware-ClientIntegrationPlugin-5.1.0.exe -ArgumentList '/v/qn' -Wait -Verb RunAs + if (Test-Path "b:\VMware-PowerCLI-5.1.*.exe") { + Write-BuildLog "VMware PowerCLI installer found; installing." + Start-Process (Get-ChildItem b:\VMware-PowerCLI-5.1.*.exe).FullName -ArgumentList '/q /s /w /L1033 /V" /qb"' -Wait -Verb RunAs + } Elseif (Test-Path "b:\VMware-PowerCLI-5.0.*.exe"){ + Write-BuildLog "PowerCLI installer is out of date, installing anyway" + Start-Process (Get-ChildItem b:\VMware-PowerCLI-5.0.*.exe).FullName -ArgumentList '/q /s /w /L1033 /V" /qb"' -Wait -Verb RunAs + } Else {Write-BuildLog "PowerCLI installer not found."} + } + 5 { + Write-BuildLog "Starting vCenter 5 automation." + if (Test-Path "b:\VIM_50\redist\SQLEXPR\SQLEXPR_x64_ENU.exe") { + Write-BuildLog "SQL Server 2008 R2 Express SP1 for vCenter 5.0 found; installing." + Start-Process b:\VIM_50\redist\SQLEXPR\SQLEXPR_x64_ENU.exe -ArgumentList '/extract:c:\temp /quiet' -Wait -Verb RunAs + if (Test-Path "C:\temp\pcusource\1033_enu_lp\x64\setup\x64\sqlncli.msi") { + Write-BuildLog "Installing SQL native client." + Start-Process msiexec -ArgumentList ' /i C:\temp\pcusource\1033_enu_lp\x64\setup\x64\sqlncli.msi ADDLOCAL=ALL IACCEPTSQLNCLILICENSETERMS=YES /qb' -Wait -Verb RunAs + } elseif (Test-Path "C:\temp\1033_enu_lp\x64\setup\x64\sqlncli.msi") { + Write-BuildLog "Installing SQL native client." + Start-Process msiexec -ArgumentList '/i C:\temp\1033_enu_lp\x64\setup\x64\sqlncli.msi ADDLOCAL=ALL IACCEPTSQLNCLILICENSETERMS=YES /qb' -Wait -Verb RunAs + } + } else { + Write-BuildLog "SQL Server 2008 R2 Express SP1 for vCenter 5.0 not found. Exiting." + Read-Host "Press <Enter> to exit" + exit + } + Write-BuildLog "Install vCentre and vSphere client" + copy b:\automate\VC2\vc50.cmd c:\ + start-process c:\vc50.cmd -Wait -verb RunAs + if (Test-Path "b:\VMware-PowerCLI-5.0.*.exe"){ + Write-BuildLog "VMware PowerCLI installer found; installing." + Start-Process (Get-ChildItem b:\VMware-PowerCLI-5.0.*.exe).FullName -ArgumentList '/q /s /w /L1033 /V" /qb"' -Wait -Verb RunAs + } Else {Write-BuildLog "PowerCLI installer not found."} +} + 4 { + Write-BuildLog "Starting vCenter 4.1 automation." + if (Test-Path "b:\VIM_51\redist\SQLEXPR\SQLEXPR_x64_ENU.exe") { + Write-BuildLog "SQL Server 2008 R2 Express SP1 for vCenter 5.1 found; installing." + Start-Process b:\VIM_51\redist\SQLEXPR\SQLEXPR_x64_ENU.exe -ArgumentList '/extract:c:\temp /quiet' -Wait -Verb RunAs + if (Test-Path "C:\temp\pcusource\1033_enu_lp\x64\setup\x64\sqlncli.msi") { + copy C:\temp\pcusource\1033_enu_lp\x64\setup\x64\sqlncli.msi c:\temp + } elseif (Test-Path "C:\temp\1033_enu_lp\x64\setup\x64\sqlncli.msi") { + copy C:\temp\1033_enu_lp\x64\setup\x64\sqlncli.msi c:\temp + } + if (Test-Path "C:\temp\sqlncli.msi") { + Write-BuildLog "Installing SQL native client." + Start-Process msiexec -ArgumentList '/i C:\temp\sqlncli.msi ADDLOCAL=ALL IACCEPTSQLNCLILICENSETERMS=YES /qb' -Wait -Verb RunAs + } + } Elseif (Test-Path "b:\VIM_50\redist\SQLEXPR\SQLEXPR_x64_ENU.exe") { + Write-BuildLog "SQL Server 2008 R2 Express SP1 for vCenter 5.0 found; installing." + Start-Process b:\VIM_50\redist\SQLEXPR\SQLEXPR_x64_ENU.exe -ArgumentList '/extract:c:\temp /quiet' -Wait -Verb RunAs + if (Test-Path "C:\temp\pcusource\1033_enu_lp\x64\setup\x64\sqlncli.msi") { + Write-BuildLog "Installing SQL native client." + Start-Process msiexec -ArgumentList ' /i C:\temp\pcusource\1033_enu_lp\x64\setup\x64\sqlncli.msi ADDLOCAL=ALL IACCEPTSQLNCLILICENSETERMS=YES /qb' -Wait -Verb RunAs + } elseif (Test-Path "C:\temp\1033_enu_lp\x64\setup\x64\sqlncli.msi") { + Write-BuildLog "Installing SQL native client." + Start-Process msiexec -ArgumentList '/i C:\temp\1033_enu_lp\x64\setup\x64\sqlncli.msi ADDLOCAL=ALL IACCEPTSQLNCLILICENSETERMS=YES /qb' -Wait -Verb RunAs + } + } else { + Write-BuildLog "SQL Server 2008 Express not found. Exiting." + Read-Host "Press <Enter> to exit" + exit + } + copy b:\automate\VC2\vc41.cmd c:\ + start-process c:\vc41.cmd -Wait -verb RunAs + if (Test-Path "b:\VMware-PowerCLI-5.0.*.exe"){ + Write-BuildLog "VMware PowerCLI installer found; installing." + Start-Process (Get-ChildItem b:\VMware-PowerCLI-5.0.*.exe).FullName -ArgumentList '/q /s /w /L1033 /V" /qb"' -Wait -Verb RunAs + } Else {Write-BuildLog "PowerCLI installer not found."} +} + Base { + if (Test-Path "b:\VIM_51\redist\SQLEXPR\SQLEXPR_x64_ENU.exe") { + Write-BuildLog "SQL Server 2008 R2 Express SP1 for vCenter 5.1 found; installing." + Start-Process b:\VIM_51\redist\SQLEXPR\SQLEXPR_x64_ENU.exe -ArgumentList '/extract:c:\temp /quiet' -Wait -Verb RunAs + if (Test-Path "C:\temp\pcusource\1033_enu_lp\x64\setup\x64\sqlncli.msi") { + copy C:\temp\pcusource\1033_enu_lp\x64\setup\x64\sqlncli.msi c:\temp + } elseif (Test-Path "C:\temp\1033_enu_lp\x64\setup\x64\sqlncli.msi") { + copy C:\temp\1033_enu_lp\x64\setup\x64\sqlncli.msi c:\temp + } + if (Test-Path "C:\temp\sqlncli.msi") { + Write-BuildLog "Installing SQL native client." + Start-Process msiexec -ArgumentList '/i C:\temp\sqlncli.msi ADDLOCAL=ALL IACCEPTSQLNCLILICENSETERMS=YES /qb' -Wait -Verb RunAs + } + } Elseif (Test-Path "b:\VIM_50\redist\SQLEXPR\SQLEXPR_x64_ENU.exe") { + Write-BuildLog "SQL Server 2008 R2 Express SP1 for vCenter 5.0 found; installing." + Start-Process b:\VIM_50\redist\SQLEXPR\SQLEXPR_x64_ENU.exe -ArgumentList '/extract:c:\temp /quiet' -Wait -Verb RunAs + if (Test-Path "C:\temp\pcusource\1033_enu_lp\x64\setup\x64\sqlncli.msi") { + Write-BuildLog "Installing SQL native client." + Start-Process msiexec -ArgumentList ' /i C:\temp\pcusource\1033_enu_lp\x64\setup\x64\sqlncli.msi ADDLOCAL=ALL IACCEPTSQLNCLILICENSETERMS=YES /qb' -Wait -Verb RunAs + } elseif (Test-Path "C:\temp\1033_enu_lp\x64\setup\x64\sqlncli.msi") { + Write-BuildLog "Installing SQL native client." + Start-Process msiexec -ArgumentList '/i C:\temp\1033_enu_lp\x64\setup\x64\sqlncli.msi ADDLOCAL=ALL IACCEPTSQLNCLILICENSETERMS=YES /qb' -Wait -Verb RunAs + } + } elseif (Test-Path "b:\VIM_41\redist\SQLEXPR\x64\SQLEXPR.EXE") { + Write-BuildLog "SQL Server 2005 Express for vCenter 4.1 found; installing." + Start-Process b:\VIM_41\redist\SQLEXPR\x64\SQLEXPR.EXE -ArgumentList '/extract:c:\temp /quiet' -Wait -Verb RunAs + if (Test-Path c:\temp\setup\sqlncli_x64.msi) { + Start-Process msiexec -ArgumentList '/i C:\temp\setup\sqlncli_x64.msi ADDLOCAL=ALL IACCEPTSQLNCLILICENSETERMS=YES /qb' -Wait -Verb RunAs + } + } + } + None {} +} + +if (Test-Path "b:\VMware-vSphere-CLI.exe") { + Write-BuildLog "VMware vSphere CLI installer found; installing." + Start-Process b:\VMware-vSphere-CLI.exe -ArgumentList '/S /v/qb' -Wait -Verb RunAs +} else { + Write-BuildLog "VMware vSphere CLI installer not found." +} + +Write-BuildLog "Adding Domain Admins to vCenter administrators role and setting PowerCLI certificate warning." +if (!(($vcinstall -eq "None") -or ($vcinstall -eq "Base"))) { + Write-Host "Loading PowerCLI plugin, this will take a little while." -foregroundcolor "cyan" + Add-PSSnapin VMware.VimAutomation.Core + if ((($PCLIVer.Major * 10 ) + $PCLIVer.Minor) -ge 51) { + $null = Set-PowerCLIConfiguration -InvalidCertificateAction Ignore -confirm:$false -Scope "AllUsers" + } + If ($vcinstall -eq "55") { + Write-BuildLog "vCentre 5.5 doesn't allow us to setup security" + } Else { + $null = connect-viserver vc2.lab.local -user lab\Vi-Admin -password VMware1! + $null = New-VIPermission -Role Admin -Principal 'lab\Domain Admins' -Entity Datacenters + $null = New-VIPermission -Role Admin -Principal 'Administrator' -Entity Datacenters + $PCLIVer = Get-PowerCLIVersion + $null = Disconnect-VIServer -Server * -confirm:$false + } +} + +Write-BuildLog "Cleanup and creating Desktop shortcuts." +regedit -s b:\Automate\vc2\vSphereClient.reg +Remove-Item "C:\Users\Public\Desktop\*.lnk" +Remove-Item c:\eula*.* +Remove-Item c:\install*.* +Remove-Item c:\VC* +Remove-Item c:\VMware-ClientIntegrationPlugin*.exe +Remove-Item c:\temp -Force -Recurse +copy b:\Automate\vc2\Shortcuts.vbs c:\Shortcuts.vbs +wscript c:\Shortcuts.vbs +copy b:\Automate\*.ps1 c:\ +If (($AutoAddHosts -eq "True") -and (Test-Path "c:\Addhosts.ps1")){ + Write-BuildLog " " + Write-BuildLog "Automatically running AddHosts script" + Write-BuildLog " " + Start-Process c:\windows\syswow64\WindowsPowerShell\v1.0\powershell.exe -ArgumentList " C:\AddHosts.ps1" -wait +} +Write-BuildLog "Installing VMware tools, build complete after reboot." +if (Test-Path B:\VMTools\setup64.exe) { + Start-Process B:\VMTools\setup64.exe -ArgumentList '/s /v "/qn"' -verb RunAs -Wait + Start-Sleep -Seconds 30 +} + +Read-Host "Press <Enter> to exit" +exit \ No newline at end of file diff --git a/Build/Automate/VC2/PuTTY.reg b/Build/Automate/VC2/PuTTY.reg new file mode 100644 index 0000000..76de9ec Binary files /dev/null and b/Build/Automate/VC2/PuTTY.reg differ diff --git a/Build/Automate/VC2/PuTTY/LICENCE b/Build/Automate/VC2/PuTTY/LICENCE new file mode 100644 index 0000000..1960cc2 --- /dev/null +++ b/Build/Automate/VC2/PuTTY/LICENCE @@ -0,0 +1,25 @@ +PuTTY is copyright 1997-2007 Simon Tatham. + +Portions copyright Robert de Bath, Joris van Rantwijk, Delian +Delchev, Andreas Schultz, Jeroen Massar, Wez Furlong, Nicolas Barry, +Justin Bradford, Ben Harris, Malcolm Smith, Ahmad Khalifa, Markus +Kuhn, and CORE SDI S.A. + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation files +(the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of the Software, +and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE +FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF +CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/Build/Automate/VC2/PuTTY/README.txt b/Build/Automate/VC2/PuTTY/README.txt new file mode 100644 index 0000000..b4b5fba --- /dev/null +++ b/Build/Automate/VC2/PuTTY/README.txt @@ -0,0 +1,40 @@ +PuTTY README +============ + +This is the README file for the PuTTY installer distribution. If +you're reading this, you've probably just run our installer and +installed PuTTY on your system. + +What should I do next? +---------------------- + +If you want to use PuTTY to connect to other computers, or use PSFTP +to transfer files, you should just be able to run them from the +Start menu. + +If you want to use the command-line-only file transfer utility PSCP, +you will probably want to put the PuTTY installation directory on +your PATH. How you do this depends on your version of Windows. On +Windows NT, 2000, and XP, you can set it using Control Panel > System; +on Windows 95, 98, and Me, you will need to edit AUTOEXEC.BAT. Consult +your Windows manuals for details. + +Some versions of Windows will refuse to run HTML Help files (.CHM) +if they are installed on a network drive. If you have installed +PuTTY on a network drive, you might want to check that the help file +works properly. If not, see http://support.microsoft.com/kb/896054 +for information on how to solve this problem. + +What do I do if it doesn't work? +-------------------------------- + +The PuTTY home web site is + + http://www.chiark.greenend.org.uk/~sgtatham/putty/ + +Here you will find our list of known bugs and pending feature +requests. If your problem is not listed in there, or in the FAQ, or +in the manuals, read the Feedback page to find out how to report +bugs to us. PLEASE read the Feedback page carefully: it is there to +save you time as well as us. Do not send us one-line bug reports +telling us `it doesn't work'. diff --git a/Build/Automate/VC2/PuTTY/pageant.exe b/Build/Automate/VC2/PuTTY/pageant.exe new file mode 100644 index 0000000..ea2379b Binary files /dev/null and b/Build/Automate/VC2/PuTTY/pageant.exe differ diff --git a/Build/Automate/VC2/PuTTY/plink.exe b/Build/Automate/VC2/PuTTY/plink.exe new file mode 100644 index 0000000..a27bf36 Binary files /dev/null and b/Build/Automate/VC2/PuTTY/plink.exe differ diff --git a/Build/Automate/VC2/PuTTY/pscp.exe b/Build/Automate/VC2/PuTTY/pscp.exe new file mode 100644 index 0000000..e511e5b Binary files /dev/null and b/Build/Automate/VC2/PuTTY/pscp.exe differ diff --git a/Build/Automate/VC2/PuTTY/psftp.exe b/Build/Automate/VC2/PuTTY/psftp.exe new file mode 100644 index 0000000..1f986e7 Binary files /dev/null and b/Build/Automate/VC2/PuTTY/psftp.exe differ diff --git a/Build/Automate/VC2/PuTTY/putty.chm b/Build/Automate/VC2/PuTTY/putty.chm new file mode 100644 index 0000000..6f769ad Binary files /dev/null and b/Build/Automate/VC2/PuTTY/putty.chm differ diff --git a/Build/Automate/VC2/PuTTY/putty.cnt b/Build/Automate/VC2/PuTTY/putty.cnt new file mode 100644 index 0000000..84d15ef --- /dev/null +++ b/Build/Automate/VC2/PuTTY/putty.cnt @@ -0,0 +1,492 @@ +:Title PuTTY User Manual +1 Title page=Top +1 Chapter 1: Introduction to PuTTY +2 Chapter 1: Introduction to PuTTY=t00000000 +2 Section 1.1: What are SSH, Telnet and Rlogin?=t00000001 +2 Section 1.2: How do SSH, Telnet and Rlogin differ?=t00000002 +1 Chapter 2: Getting started with PuTTY +2 Chapter 2: Getting started with PuTTY=t00000003 +2 Section 2.1: Starting a session=t00000004 +2 Section 2.2: Verifying the host key (SSH only)=t00000005 +2 Section 2.3: Logging in=t00000006 +2 Section 2.4: After logging in=t00000007 +2 Section 2.5: Logging out=t00000008 +1 Chapter 3: Using PuTTY +2 Chapter 3: Using PuTTY=t00000009 +2 Section 3.1: During your session +3 Section 3.1: During your session=t00000010 +3 Section 3.1.1: Copying and pasting text=t00000011 +3 Section 3.1.2: Scrolling the screen back=t00000012 +3 Section 3.1.3: The System menu +4 Section 3.1.3: The System menu=t00000013 +4 Section 3.1.3.1: The PuTTY Event Log=t00000014 +4 Section 3.1.3.2: Special commands=t00000015 +4 Section 3.1.3.3: Starting new sessions=t00000016 +4 Section 3.1.3.4: Changing your session settings=t00000017 +4 Section 3.1.3.5: Copy All to Clipboard=t00000018 +4 Section 3.1.3.6: Clearing and resetting the terminal=t00000019 +4 Section 3.1.3.7: Full screen mode=t00000020 +1 Section 3.2: Creating a log file of your session=t00000021 +1 Section 3.3: Altering your character set configuration=t00000022 +1 Section 3.4: Using X11 forwarding in SSH=t00000023 +1 Section 3.5: Using port forwarding in SSH=t00000024 +1 Section 3.6: Making raw TCP connections=t00000025 +1 Section 3.7: Connecting to a local serial line=t00000026 +2 Section 3.8: The PuTTY command line +3 Section 3.8: The PuTTY command line=t00000027 +3 Section 3.8.1: Starting a session from the command line=t00000028 +3 Section 3.8.2: -cleanup=options.cleanup +3 Section 3.8.3: Standard command-line options +4 Section 3.8.3: Standard command-line options=t00000029 +4 Section 3.8.3.1: -load: load a saved session=t00000030 +4 Section 3.8.3.2: Selecting a protocol: -ssh, -telnet, -rlogin, -raw=t00000031 +4 Section 3.8.3.3: -v: increase verbosity=t00000032 +4 Section 3.8.3.4: -l: specify a login name=t00000033 +4 Section 3.8.3.5: -L, -R and -D: set up port forwardings=t00000034 +4 Section 3.8.3.6: -m: read a remote command or script from a file=t00000035 +4 Section 3.8.3.7: -P: specify a port number=t00000036 +4 Section 3.8.3.8: -pw: specify a password=t00000037 +4 Section 3.8.3.9: -agent and -noagent: control use of Pageant for authentication=t00000038 +4 Section 3.8.3.10: -A and -a: control agent forwarding=t00000039 +4 Section 3.8.3.11: -X and -x: control X11 forwarding=t00000040 +4 Section 3.8.3.12: -t and -T: control pseudo-terminal allocation=t00000041 +4 Section 3.8.3.13: -N: suppress starting a shell or command=t00000042 +4 Section 3.8.3.14: -nc: make a remote network connection in place of a remote shell or command=t00000043 +4 Section 3.8.3.15: -C: enable compression=t00000044 +4 Section 3.8.3.16: -1 and -2: specify an SSH protocol version=t00000045 +4 Section 3.8.3.17: -4 and -6: specify an Internet protocol version=t00000046 +4 Section 3.8.3.18: -i: specify an SSH private key=t00000047 +4 Section 3.8.3.19: -pgpfp: display PGP key fingerprints=t00000048 +1 Chapter 4: Configuring PuTTY +2 Chapter 4: Configuring PuTTY=t00000049 +2 Section 4.1: The Session panel +3 Section 4.1: The Session panel=t00000050 +3 Section 4.1.1: The host name section=session.hostname +3 Section 4.1.2: Loading and storing saved sessions=session.saved +3 Section 4.1.3: ‘Close Window on Exit’=session.coe +2 Section 4.2: The Logging panel +3 Section 4.2: The Logging panel=logging.main +3 Section 4.2.1: ‘Log file name’=logging.filename +3 Section 4.2.2: ‘What to do if the log file already exists’=logging.exists +3 Section 4.2.3: ‘Flush log file frequently’=logging.flush +3 Section 4.2.4: Options specific to SSH packet logging +4 Section 4.2.4: Options specific to SSH packet logging=t00000051 +4 Section 4.2.4.1: ‘Omit known password fields’=logging.ssh.omitpassword +4 Section 4.2.4.2: ‘Omit session data’=logging.ssh.omitdata +2 Section 4.3: The Terminal panel +3 Section 4.3: The Terminal panel=t00000052 +3 Section 4.3.1: ‘Auto wrap mode initially on’=terminal.autowrap +3 Section 4.3.2: ‘DEC Origin Mode initially on’=terminal.decom +3 Section 4.3.3: ‘Implicit CR in every LF’=terminal.lfhascr +3 Section 4.3.4: ‘Use background colour to erase screen’=terminal.bce +3 Section 4.3.5: ‘Enable blinking text’=terminal.blink +3 Section 4.3.6: ‘Answerback to ^E’=terminal.answerback +3 Section 4.3.7: ‘Local echo’=terminal.localecho +3 Section 4.3.8: ‘Local line editing’=terminal.localedit +3 Section 4.3.9: Remote-controlled printing=terminal.printing +2 Section 4.4: The Keyboard panel +3 Section 4.4: The Keyboard panel=t00000053 +3 Section 4.4.1: Changing the action of the Backspace key=keyboard.backspace +3 Section 4.4.2: Changing the action of the Home and End keys=keyboard.homeend +3 Section 4.4.3: Changing the action of the function keys and keypad=keyboard.funkeys +3 Section 4.4.4: Controlling Application Cursor Keys mode=keyboard.appcursor +3 Section 4.4.5: Controlling Application Keypad mode=keyboard.appkeypad +3 Section 4.4.6: Using NetHack keypad mode=keyboard.nethack +3 Section 4.4.7: Enabling a DEC-like Compose key=keyboard.compose +3 Section 4.4.8: ‘Control-Alt is different from AltGr’=keyboard.ctrlalt +2 Section 4.5: The Bell panel +3 Section 4.5: The Bell panel=t00000054 +3 Section 4.5.1: ‘Set the style of bell’=bell.style +3 Section 4.5.2: ‘Taskbar/caption indication on bell’=bell.taskbar +3 Section 4.5.3: ‘Control the bell overload behaviour’=bell.overload +2 Section 4.6: The Features panel +3 Section 4.6: The Features panel=t00000055 +3 Section 4.6.1: Disabling application keypad and cursor keys=features.application +3 Section 4.6.2: Disabling xterm-style mouse reporting=features.mouse +3 Section 4.6.3: Disabling remote terminal resizing=features.resize +3 Section 4.6.4: Disabling switching to the alternate screen=features.altscreen +3 Section 4.6.5: Disabling remote window title changing=features.retitle +3 Section 4.6.6: Response to remote window title querying=features.qtitle +3 Section 4.6.7: Disabling destructive backspace=features.dbackspace +3 Section 4.6.8: Disabling remote character set configuration=features.charset +3 Section 4.6.9: Disabling Arabic text shaping=features.arabicshaping +3 Section 4.6.10: Disabling bidirectional text display=features.bidi +2 Section 4.7: The Window panel +3 Section 4.7: The Window panel=t00000056 +3 Section 4.7.1: Setting the size of the PuTTY window=window.size +3 Section 4.7.2: What to do when the window is resized=window.resize +3 Section 4.7.3: Controlling scrollback=window.scrollback +3 Section 4.7.4: ‘Push erased text into scrollback’=window.erased +2 Section 4.8: The Appearance panel +3 Section 4.8: The Appearance panel=t00000057 +3 Section 4.8.1: Controlling the appearance of the cursor=appearance.cursor +3 Section 4.8.2: Controlling the font used in the terminal window=appearance.font +3 Section 4.8.3: ‘Hide mouse pointer when typing in window’=appearance.hidemouse +3 Section 4.8.4: Controlling the window border=appearance.border +2 Section 4.9: The Behaviour panel +3 Section 4.9: The Behaviour panel=t00000058 +3 Section 4.9.1: Controlling the window title=appearance.title +3 Section 4.9.2: ‘Warn before closing window’=behaviour.closewarn +3 Section 4.9.3: ‘Window closes on ALT-F4’=behaviour.altf4 +3 Section 4.9.4: ‘System menu appears on ALT-Space’=behaviour.altspace +3 Section 4.9.5: ‘System menu appears on Alt alone’=behaviour.altonly +3 Section 4.9.6: ‘Ensure window is always on top’=behaviour.alwaysontop +3 Section 4.9.7: ‘Full screen on Alt-Enter’=behaviour.altenter +2 Section 4.10: The Translation panel +3 Section 4.10: The Translation panel=t00000059 +3 Section 4.10.1: Controlling character set translation=translation.codepage +3 Section 4.10.2: ‘Treat CJK ambiguous characters as wide’=translation.cjkambigwide +3 Section 4.10.3: ‘Caps Lock acts as Cyrillic switch’=translation.cyrillic +3 Section 4.10.4: Controlling display of line-drawing characters=translation.linedraw +3 Section 4.10.5: Controlling copy and paste of line drawing characters=selection.linedraw +2 Section 4.11: The Selection panel +3 Section 4.11: The Selection panel=t00000060 +3 Section 4.11.1: Pasting in Rich Text Format=selection.rtf +3 Section 4.11.2: Changing the actions of the mouse buttons=selection.buttons +3 Section 4.11.3: ‘Shift overrides application's use of mouse’=selection.shiftdrag +3 Section 4.11.4: Default selection mode=selection.rect +3 Section 4.11.5: Configuring word-by-word selection=selection.charclasses +2 Section 4.12: The Colours panel +3 Section 4.12: The Colours panel=t00000061 +3 Section 4.12.1: ‘Allow terminal to specify ANSI colours’=colours.ansi +3 Section 4.12.2: ‘Allow terminal to use xterm 256-colour mode’=colours.xterm256 +3 Section 4.12.3: ‘Bolded text is a different colour’=colours.bold +3 Section 4.12.4: ‘Attempt to use logical palettes’=colours.logpal +3 Section 4.12.5: ‘Use system colours’=colours.system +3 Section 4.12.6: Adjusting the colours in the terminal window=colours.config +2 Section 4.13: The Connection panel +3 Section 4.13: The Connection panel=t00000062 +3 Section 4.13.1: Using keepalives to prevent disconnection=connection.keepalive +3 Section 4.13.2: ‘Disable Nagle's algorithm’=connection.nodelay +3 Section 4.13.3: ‘Enable TCP keepalives’=connection.tcpkeepalive +3 Section 4.13.4: ‘Internet protocol’=connection.ipversion +2 Section 4.14: The Data panel +3 Section 4.14: The Data panel=t00000063 +3 Section 4.14.1: ‘Auto-login username’=connection.username +3 Section 4.14.2: ‘Terminal-type string’=connection.termtype +3 Section 4.14.3: ‘Terminal speeds’=connection.termspeed +3 Section 4.14.4: Setting environment variables on the server=telnet.environ +2 Section 4.15: The Proxy panel +3 Section 4.15: The Proxy panel=proxy.main +3 Section 4.15.1: Setting the proxy type=proxy.type +3 Section 4.15.2: Excluding parts of the network from proxying=proxy.exclude +3 Section 4.15.3: Name resolution when using a proxy=proxy.dns +3 Section 4.15.4: Username and password=proxy.auth +3 Section 4.15.5: Specifying the Telnet or Local proxy command=proxy.command +2 Section 4.16: The Telnet panel +3 Section 4.16: The Telnet panel=t00000064 +3 Section 4.16.1: ‘Handling of OLD_ENVIRON ambiguity’=telnet.oldenviron +3 Section 4.16.2: Passive and active Telnet negotiation modes=telnet.passive +3 Section 4.16.3: ‘Keyboard sends Telnet special commands’=telnet.specialkeys +3 Section 4.16.4: ‘Return key sends Telnet New Line instead of ^M’=telnet.newline +2 Section 4.17: The Rlogin panel +3 Section 4.17: The Rlogin panel=t00000065 +3 Section 4.17.1: ‘Local username’=rlogin.localuser +2 Section 4.18: The SSH panel +3 Section 4.18: The SSH panel=t00000066 +3 Section 4.18.1: Executing a specific command on the server=ssh.command +3 Section 4.18.2: ‘Don't start a shell or command at all’=ssh.noshell +3 Section 4.18.3: ‘Enable compression’=ssh.compress +3 Section 4.18.4: ‘Preferred SSH protocol version’=ssh.protocol +3 Section 4.18.5: Encryption algorithm selection=ssh.ciphers +2 Section 4.19: The Kex panel +3 Section 4.19: The Kex panel=t00000067 +3 Section 4.19.1: Key exchange algorithm selection=ssh.kex.order +3 Section 4.19.2: Repeat key exchange=ssh.kex.repeat +2 Section 4.20: The Auth panel +3 Section 4.20: The Auth panel=t00000068 +3 Section 4.20.1: ‘Bypass authentication entirely’=ssh.auth.bypass +3 Section 4.20.2: ‘Attempt authentication using Pageant’=ssh.auth.pageant +3 Section 4.20.3: ‘Attempt TIS or CryptoCard authentication’=ssh.auth.tis +3 Section 4.20.4: ‘Attempt keyboard-interactive authentication’=ssh.auth.ki +3 Section 4.20.5: ‘Allow agent forwarding’=ssh.auth.agentfwd +3 Section 4.20.6: ‘Allow attempted changes of username in SSH-2’=ssh.auth.changeuser +3 Section 4.20.7: ‘Private key file for authentication’=ssh.auth.privkey +2 Section 4.21: The TTY panel +3 Section 4.21: The TTY panel=t00000069 +3 Section 4.21.1: ‘Don't allocate a pseudo-terminal’=ssh.nopty +3 Section 4.21.2: Sending terminal modes=ssh.ttymodes +2 Section 4.22: The X11 panel +3 Section 4.22: The X11 panel=ssh.tunnels.x11 +3 Section 4.22.1: Remote X11 authentication=ssh.tunnels.x11auth +2 Section 4.23: The Tunnels panel +3 Section 4.23: The Tunnels panel=ssh.tunnels.portfwd +3 Section 4.23.1: Controlling the visibility of forwarded ports=ssh.tunnels.portfwd.localhost +3 Section 4.23.2: Selecting Internet protocol version for forwarded ports=ssh.tunnels.portfwd.ipversion +2 Section 4.24: The Bugs panel +3 Section 4.24: The Bugs panel=t00000070 +3 Section 4.24.1: ‘Chokes on SSH-1 ignore messages’=ssh.bugs.ignore1 +3 Section 4.24.2: ‘Refuses all SSH-1 password camouflage’=ssh.bugs.plainpw1 +3 Section 4.24.3: ‘Chokes on SSH-1 RSA authentication’=ssh.bugs.rsa1 +3 Section 4.24.4: ‘Miscomputes SSH-2 HMAC keys’=ssh.bugs.hmac2 +3 Section 4.24.5: ‘Miscomputes SSH-2 encryption keys’=ssh.bugs.derivekey2 +3 Section 4.24.6: ‘Requires padding on SSH-2 RSA signatures’=ssh.bugs.rsapad2 +3 Section 4.24.7: ‘Misuses the session ID in SSH-2 PK auth’=ssh.bugs.pksessid2 +3 Section 4.24.8: ‘Handles SSH-2 key re-exchange badly’=ssh.bugs.rekey2 +2 Section 4.25: The Serial panel +3 Section 4.25: The Serial panel=t00000071 +3 Section 4.25.1: Selecting a serial line to connect to=serial.line +3 Section 4.25.2: Selecting the speed of your serial line=serial.speed +3 Section 4.25.3: Selecting the number of data bits=serial.databits +3 Section 4.25.4: Selecting the number of stop bits=serial.stopbits +3 Section 4.25.5: Selecting the serial parity checking scheme=serial.parity +3 Section 4.25.6: Selecting the serial flow control scheme=serial.flow +1 Section 4.26: Storing configuration in a file=t00000072 +1 Chapter 5: Using PSCP to transfer files securely +2 Chapter 5: Using PSCP to transfer files securely=t00000073 +2 Section 5.1: Starting PSCP=t00000074 +2 Section 5.2: PSCP Usage +3 Section 5.2: PSCP Usage=t00000075 +3 Section 5.2.1: The basics +4 Section 5.2.1: The basics=t00000076 +4 Section 5.2.1.1: user=t00000077 +4 Section 5.2.1.2: host=t00000078 +4 Section 5.2.1.3: source=t00000079 +4 Section 5.2.1.4: target=t00000080 +3 Section 5.2.2: Options +4 Section 5.2.2: Options=t00000081 +4 Section 5.2.2.1: -ls list remote files=t00000082 +4 Section 5.2.2.2: -p preserve file attributes=t00000083 +4 Section 5.2.2.3: -q quiet, don't show statistics=t00000084 +4 Section 5.2.2.4: -r copies directories recursively=t00000085 +4 Section 5.2.2.5: -batch avoid interactive prompts=t00000086 +4 Section 5.2.2.6: -sftp, -scp force use of particular protocol=t00000087 +2 Section 5.2.3: Return value=t00000088 +2 Section 5.2.4: Using public key authentication with PSCP=t00000089 +1 Chapter 6: Using PSFTP to transfer files securely +2 Chapter 6: Using PSFTP to transfer files securely=t00000090 +2 Section 6.1: Starting PSFTP +3 Section 6.1: Starting PSFTP=t00000091 +3 Section 6.1.1: -b: specify a file containing batch commands=t00000092 +3 Section 6.1.2: -bc: display batch commands as they are run=t00000093 +3 Section 6.1.3: -be: continue batch processing on errors=t00000094 +3 Section 6.1.4: -batch: avoid interactive prompts=t00000095 +2 Section 6.2: Running PSFTP +3 Section 6.2: Running PSFTP=t00000096 +3 Section 6.2.1: General quoting rules for PSFTP commands=t00000097 +3 Section 6.2.2: Wildcards in PSFTP=t00000098 +3 Section 6.2.3: The open command: start a session=t00000099 +3 Section 6.2.4: The quit command: end your session=t00000100 +3 Section 6.2.5: The close command: close your connection=t00000101 +3 Section 6.2.6: The help command: get quick online help=t00000102 +3 Section 6.2.7: The cd and pwd commands: changing the remote working directory=t00000103 +3 Section 6.2.8: The lcd and lpwd commands: changing the local working directory=t00000104 +3 Section 6.2.9: The get command: fetch a file from the server=t00000105 +3 Section 6.2.10: The put command: send a file to the server=t00000106 +3 Section 6.2.11: The mget and mput commands: fetch or send multiple files=t00000107 +3 Section 6.2.12: The reget and reput commands: resuming file transfers=t00000108 +3 Section 6.2.13: The dir command: list remote files=t00000109 +3 Section 6.2.14: The chmod command: change permissions on remote files=t00000110 +3 Section 6.2.15: The del command: delete remote files=t00000111 +3 Section 6.2.16: The mkdir command: create remote directories=t00000112 +3 Section 6.2.17: The rmdir command: remove remote directories=t00000113 +3 Section 6.2.18: The mv command: move and rename remote files=t00000114 +3 Section 6.2.19: The ! command: run a local Windows command=t00000115 +1 Section 6.3: Using public key authentication with PSFTP=t00000116 +1 Chapter 7: Using the command-line connection tool Plink +2 Chapter 7: Using the command-line connection tool Plink=t00000117 +2 Section 7.1: Starting Plink=t00000118 +2 Section 7.2: Using Plink +3 Section 7.2: Using Plink=t00000119 +3 Section 7.2.1: Using Plink for interactive logins=t00000120 +3 Section 7.2.2: Using Plink for automated connections=t00000121 +3 Section 7.2.3: Plink command line options +4 Section 7.2.3: Plink command line options=t00000122 +4 Section 7.2.3.1: -batch: disable all interactive prompts=t00000123 +4 Section 7.2.3.2: -s: remote command is SSH subsystem=t00000124 +1 Section 7.3: Using Plink in batch files and scripts=t00000125 +1 Section 7.4: Using Plink with CVS=t00000126 +1 Section 7.5: Using Plink with WinCVS=t00000127 +1 Chapter 8: Using public keys for SSH authentication +2 Chapter 8: Using public keys for SSH authentication=t00000128 +2 Section 8.1: Public key authentication - an introduction=t00000129 +2 Section 8.2: Using PuTTYgen, the PuTTY key generator +3 Section 8.2: Using PuTTYgen, the PuTTY key generator=puttygen.general +3 Section 8.2.1: Generating a new key=t00000130 +3 Section 8.2.2: Selecting the type of key=puttygen.keytype +3 Section 8.2.3: Selecting the size (strength) of the key=puttygen.bits +3 Section 8.2.4: The ‘Generate’ button=puttygen.generate +3 Section 8.2.5: The ‘Key fingerprint’ box=puttygen.fingerprint +3 Section 8.2.6: Setting a comment for your key=puttygen.comment +3 Section 8.2.7: Setting a passphrase for your key=puttygen.passphrase +3 Section 8.2.8: Saving your private key to a disk file=puttygen.savepriv +3 Section 8.2.9: Saving your public key to a disk file=puttygen.savepub +3 Section 8.2.10: ‘Public key for pasting into authorized_keys file’=puttygen.pastekey +3 Section 8.2.11: Reloading a private key=puttygen.load +3 Section 8.2.12: Dealing with private keys in other formats=puttygen.conversions +1 Section 8.3: Getting ready for public key authentication=t00000131 +1 Chapter 9: Using Pageant for authentication +2 Chapter 9: Using Pageant for authentication=pageant.general +2 Section 9.1: Getting started with Pageant=t00000132 +2 Section 9.2: The Pageant main window +3 Section 9.2: The Pageant main window=t00000133 +3 Section 9.2.1: The key list box=pageant.keylist +3 Section 9.2.2: The ‘Add Key’ button=pageant.addkey +3 Section 9.2.3: The ‘Remove Key’ button=pageant.remkey +2 Section 9.3: The Pageant command line +3 Section 9.3: The Pageant command line=t00000134 +3 Section 9.3.1: Making Pageant automatically load keys on startup=t00000135 +3 Section 9.3.2: Making Pageant run another program=t00000136 +1 Section 9.4: Using agent forwarding=t00000137 +1 Section 9.5: Security considerations=t00000138 +1 Chapter 10: Common error messages +2 Chapter 10: Common error messages=t00000139 +2 Section 10.1: ‘The server's host key is not cached in the registry’=errors.hostkey.absent +2 Section 10.2: ‘WARNING - POTENTIAL SECURITY BREACH!’=errors.hostkey.changed +2 Section 10.3: ‘Out of space for port forwardings’=t00000140 +2 Section 10.4: ‘The first cipher supported by the server is ... below the configured warning threshold’=t00000141 +2 Section 10.5: ‘Server sent disconnect message type 2 (protocol error): "Too many authentication failures for root"’=t00000142 +2 Section 10.6: ‘Out of memory’=t00000143 +2 Section 10.7: ‘Internal error’, ‘Internal fault’, ‘Assertion failed’=t00000144 +2 Section 10.8: ‘Unable to use this private key file’, ‘Couldn't load private key’, ‘Key is of wrong type’=errors.cantloadkey +2 Section 10.9: ‘Server refused our public key’ or ‘Key refused’=t00000145 +2 Section 10.10: ‘Access denied’, ‘Authentication refused’=t00000146 +2 Section 10.11: ‘Incorrect CRC received on packet’ or ‘Incorrect MAC received on packet’=t00000147 +2 Section 10.12: ‘Incoming packet was garbled on decryption’=t00000148 +2 Section 10.13: ‘PuTTY X11 proxy: various errors’=t00000149 +2 Section 10.14: ‘Network error: Software caused connection abort’=t00000150 +2 Section 10.15: ‘Network error: Connection reset by peer’=t00000151 +2 Section 10.16: ‘Network error: Connection refused’=t00000152 +2 Section 10.17: ‘Network error: Connection timed out’=t00000153 +1 Appendix A: PuTTY FAQ +2 Appendix A: PuTTY FAQ=t00000154 +2 Section A.1: Introduction +3 Section A.1: Introduction=t00000155 +3 Question A.1.1: What is PuTTY?=t00000156 +2 Section A.2: Features supported in PuTTY +3 Section A.2: Features supported in PuTTY=t00000157 +3 Question A.2.1: Does PuTTY support SSH-2?=t00000158 +3 Question A.2.2: Does PuTTY support reading OpenSSH or ssh.com SSH-2 private key files?=t00000159 +3 Question A.2.3: Does PuTTY support SSH-1?=t00000160 +3 Question A.2.4: Does PuTTY support local echo?=t00000161 +3 Question A.2.5: Does PuTTY support storing settings, so I don't have to change them every time?=t00000162 +3 Question A.2.6: Does PuTTY support storing its settings in a disk file?=t00000163 +3 Question A.2.7: Does PuTTY support full-screen mode, like a DOS box?=t00000164 +3 Question A.2.8: Does PuTTY have the ability to remember my password so I don't have to type it every time?=t00000165 +3 Question A.2.9: Is there an option to turn off the annoying host key prompts?=t00000166 +3 Question A.2.10: Will you write an SSH server for the PuTTY suite, to go with the client?=t00000167 +3 Question A.2.11: Can PSCP or PSFTP transfer files in ASCII mode?=t00000168 +2 Section A.3: Ports to other operating systems +3 Section A.3: Ports to other operating systems=t00000169 +3 Question A.3.1: What ports of PuTTY exist?=t00000170 +3 Question A.3.2: Is there a port to Unix?=t00000171 +3 Question A.3.3: What's the point of the Unix port? Unix has OpenSSH.=t00000172 +3 Question A.3.4: Will there be a port to Windows CE or PocketPC?=t00000173 +3 Question A.3.5: Is there a port to Windows 3.1?=t00000174 +3 Question A.3.6: Will there be a port to the Mac?=t00000175 +3 Question A.3.7: Will there be a port to EPOC?=t00000176 +2 Section A.4: Embedding PuTTY in other programs +3 Section A.4: Embedding PuTTY in other programs=t00000177 +3 Question A.4.1: Is the SSH or Telnet code available as a DLL?=t00000178 +3 Question A.4.2: Is the SSH or Telnet code available as a Visual Basic component?=t00000179 +3 Question A.4.3: How can I use PuTTY to make an SSH connection from within another program?=t00000180 +2 Section A.5: Details of PuTTY's operation +3 Section A.5: Details of PuTTY's operation=t00000181 +3 Question A.5.1: What terminal type does PuTTY use?=t00000182 +3 Question A.5.2: Where does PuTTY store its data?=t00000183 +2 Section A.6: HOWTO questions +3 Section A.6: HOWTO questions=t00000184 +3 Question A.6.1: What login name / password should I use?=t00000185 +3 Question A.6.2: What commands can I type into my PuTTY terminal window?=t00000186 +3 Question A.6.3: How can I make PuTTY start up maximised?=t00000187 +3 Question A.6.4: How can I create a Windows shortcut to start a particular saved session directly?=t00000188 +3 Question A.6.5: How can I start an SSH session straight from the command line?=t00000189 +3 Question A.6.6: How do I copy and paste between PuTTY and other Windows applications?=t00000190 +3 Question A.6.7: How do I use all PuTTY's features (public keys, proxying, cipher selection, etc.) in PSCP, PSFTP and Plink?=t00000191 +3 Question A.6.8: How do I use PSCP.EXE? When I double-click it gives me a command prompt window which then closes instantly.=t00000192 +3 Question A.6.9: How do I use PSCP to copy a file whose name has spaces in?=t00000193 +2 Section A.7: Troubleshooting +3 Section A.7: Troubleshooting=t00000194 +3 Question A.7.1: Why do I see ‘Incorrect MAC received on packet’?=t00000195 +3 Question A.7.2: Why do I see ‘Fatal: Protocol error: Expected control record’ in PSCP?=t00000196 +3 Question A.7.3: I clicked on a colour in the Colours panel, and the colour didn't change in my terminal.=t00000197 +3 Question A.7.4: Plink on Windows 95 says it can't find WS2_32.DLL.=t00000198 +3 Question A.7.5: After trying to establish an SSH-2 connection, PuTTY says ‘Out of memory’ and dies.=t00000199 +3 Question A.7.6: When attempting a file transfer, either PSCP or PSFTP says ‘Out of memory’ and dies.=t00000200 +3 Question A.7.7: PSFTP transfers files much slower than PSCP.=t00000201 +3 Question A.7.8: When I run full-colour applications, I see areas of black space where colour ought to be, or vice versa.=t00000202 +3 Question A.7.9: When I change some terminal settings, nothing happens.=t00000203 +3 Question A.7.10: My PuTTY sessions unexpectedly close after they are idle for a while.=t00000204 +3 Question A.7.11: PuTTY's network connections time out too quickly when network connectivity is temporarily lost.=t00000205 +3 Question A.7.12: When I cat a binary file, I get ‘PuTTYPuTTYPuTTY’ on my command line.=t00000206 +3 Question A.7.13: When I cat a binary file, my window title changes to a nonsense string.=t00000207 +3 Question A.7.14: My keyboard stops working once PuTTY displays the password prompt.=t00000208 +3 Question A.7.15: One or more function keys don't do what I expected in a server-side application.=t00000209 +3 Question A.7.16: Since my SSH server was upgraded to OpenSSH 3.1p1/3.4p1, I can no longer connect with PuTTY.=t00000210 +3 Question A.7.17: Why do I see ‘Couldn't load private key from ...’? Why can PuTTYgen load my key but not PuTTY?=t00000211 +3 Question A.7.18: When I'm connected to a Red Hat Linux 8.0 system, some characters don't display properly.=t00000212 +3 Question A.7.19: Since I upgraded to PuTTY 0.54, the scrollback has stopped working when I run screen.=t00000213 +3 Question A.7.20: Since I upgraded Windows XP to Service Pack 2, I can't use addresses like 127.0.0.2.=t00000214 +3 Question A.7.21: PSFTP commands seem to be missing a directory separator (slash).=t00000215 +3 Question A.7.22: Do you want to hear about ‘Software caused connection abort’?=t00000216 +3 Question A.7.23: My SSH-2 session locks up for a few seconds every so often.=t00000217 +3 Question A.7.24: PuTTY fails to start up. Windows claims that ‘the application configuration is incorrect’.=t00000218 +2 Section A.8: Security questions +3 Section A.8: Security questions=t00000219 +3 Question A.8.1: Is it safe for me to download PuTTY and use it on a public PC?=t00000220 +3 Question A.8.2: What does PuTTY leave on a system? How can I clean up after it?=t00000221 +3 Question A.8.3: How come PuTTY now supports DSA, when the website used to say how insecure it was?=t00000222 +3 Question A.8.4: Couldn't Pageant use VirtualLock() to stop private keys being written to disk?=t00000223 +2 Section A.9: Administrative questions +3 Section A.9: Administrative questions=t00000224 +3 Question A.9.1: Would you like me to register you a nicer domain name?=t00000225 +3 Question A.9.2: Would you like free web hosting for the PuTTY web site?=t00000226 +3 Question A.9.3: Would you link to my web site from the PuTTY web site?=t00000227 +3 Question A.9.4: Why don't you move PuTTY to SourceForge?=t00000228 +3 Question A.9.5: Why can't I subscribe to the putty-bugs mailing list?=t00000229 +3 Question A.9.6: If putty-bugs isn't a general-subscription mailing list, what is?=t00000230 +3 Question A.9.7: How can I donate to PuTTY development?=t00000231 +3 Question A.9.8: Can I have permission to put PuTTY on a cover disk / distribute it with other software / etc?=t00000232 +3 Question A.9.9: Can you sign an agreement indemnifying us against security problems in PuTTY?=t00000233 +3 Question A.9.10: Can you sign this form granting us permission to use/distribute PuTTY?=t00000234 +3 Question A.9.11: Can you write us a formal notice of permission to use PuTTY?=t00000235 +3 Question A.9.12: Can you sign anything for us?=t00000236 +3 Question A.9.13: If you won't sign anything, can you give us some sort of assurance that you won't make PuTTY closed-source in future?=t00000237 +3 Question A.9.14: Can you provide us with export control information / FIPS certification for PuTTY?=t00000238 +2 Section A.10: Miscellaneous questions +3 Section A.10: Miscellaneous questions=t00000239 +3 Question A.10.1: Is PuTTY a port of OpenSSH, or based on OpenSSH?=t00000240 +3 Question A.10.2: Where can I buy silly putty?=t00000241 +3 Question A.10.3: What does ‘PuTTY’ mean?=t00000242 +3 Question A.10.4: How do I pronounce ‘PuTTY’?=t00000243 +1 Appendix B: Feedback and bug reporting +2 Appendix B: Feedback and bug reporting=t00000244 +2 Section B.1: General guidelines +3 Section B.1: General guidelines=t00000245 +3 Section B.1.1: Sending large attachments=t00000246 +3 Section B.1.2: Other places to ask for help=t00000247 +1 Section B.2: Reporting bugs=t00000248 +1 Section B.3: Requesting extra features=t00000249 +1 Section B.4: Requesting features that have already been requested=t00000250 +1 Section B.5: Support requests=t00000251 +1 Section B.6: Web server administration=t00000252 +1 Section B.7: Asking permission for things=t00000253 +1 Section B.8: Mirroring the PuTTY web site=t00000254 +1 Section B.9: Praise and compliments=t00000255 +1 Section B.10: E-mail address=t00000256 +1 Appendix C: PuTTY Licence +2 Appendix C: PuTTY Licence=t00000257 +1 Appendix D: PuTTY hacking guide +2 Appendix D: PuTTY hacking guide=t00000258 +2 Section D.1: Cross-OS portability=t00000259 +2 Section D.2: Multiple backends treated equally=t00000260 +2 Section D.3: Multiple sessions per process on some platforms=t00000261 +2 Section D.4: C, not C++=t00000262 +2 Section D.5: Security-conscious coding=t00000263 +2 Section D.6: Independence of specific compiler=t00000264 +2 Section D.7: Small code size=t00000265 +2 Section D.8: Single-threaded code=t00000266 +2 Section D.9: Keystrokes sent to the server wherever possible=t00000267 +2 Section D.10: 640×480 friendliness in configuration panels=t00000268 +2 Section D.11: Automatically generated Makefiles=t00000269 +2 Section D.12: Coroutines in ssh.c=t00000270 +2 Section D.13: Single compilation of each source file=t00000271 +2 Section D.14: Do as we say, not as we do=t00000272 +1 Appendix E: PuTTY download keys and signatures +2 Appendix E: PuTTY download keys and signatures=pgpfingerprints +2 Section E.1: Public keys=t00000273 +2 Section E.2: Security details +3 Section E.2: Security details=t00000274 +3 Section E.2.1: The Development Snapshots keys=t00000275 +3 Section E.2.2: The Releases keys=t00000276 +3 Section E.2.3: The Master Keys=t00000277 diff --git a/Build/Automate/VC2/PuTTY/putty.exe b/Build/Automate/VC2/PuTTY/putty.exe new file mode 100644 index 0000000..38b49b6 Binary files /dev/null and b/Build/Automate/VC2/PuTTY/putty.exe differ diff --git a/Build/Automate/VC2/PuTTY/putty.hlp b/Build/Automate/VC2/PuTTY/putty.hlp new file mode 100644 index 0000000..92cfc98 Binary files /dev/null and b/Build/Automate/VC2/PuTTY/putty.hlp differ diff --git a/Build/Automate/VC2/PuTTY/puttygen.exe b/Build/Automate/VC2/PuTTY/puttygen.exe new file mode 100644 index 0000000..c548873 Binary files /dev/null and b/Build/Automate/VC2/PuTTY/puttygen.exe differ diff --git a/Build/Automate/VC2/PuTTY/unins000.dat b/Build/Automate/VC2/PuTTY/unins000.dat new file mode 100644 index 0000000..1b66fa2 Binary files /dev/null and b/Build/Automate/VC2/PuTTY/unins000.dat differ diff --git a/Build/Automate/VC2/PuTTY/unins000.exe b/Build/Automate/VC2/PuTTY/unins000.exe new file mode 100644 index 0000000..752dd34 Binary files /dev/null and b/Build/Automate/VC2/PuTTY/unins000.exe differ diff --git a/Build/Automate/VC2/PuTTY/website.url b/Build/Automate/VC2/PuTTY/website.url new file mode 100644 index 0000000..4b50369 Binary files /dev/null and b/Build/Automate/VC2/PuTTY/website.url differ diff --git a/Build/Automate/VC2/Shortcuts.vbs b/Build/Automate/VC2/Shortcuts.vbs new file mode 100644 index 0000000..ecf3b04 --- /dev/null +++ b/Build/Automate/VC2/Shortcuts.vbs @@ -0,0 +1,24 @@ +set WshShell = WScript.CreateObject("WScript.Shell") +set oShortCutLink = WshShell.CreateShortcut("C:\Users\Public\Desktop\vSphere.lnk") +oShortCutLink.TargetPath = "C:\Program Files (x86)\VMware\Infrastructure\Virtual Infrastructure Client\Launcher\VpxClient.exe" +oShortCutLink.Arguments = "-s vc2.lab.local -PassthroughAuth" +oShortCutLink.Save + +set oShortCutLink = WshShell.CreateShortcut("C:\Users\Public\Desktop\VMware vSphere Client.lnk") +oShortCutLink.TargetPath = "C:\Program Files (x86)\VMware\Infrastructure\Virtual Infrastructure Client\Launcher\VpxClient.exe" +oShortCutLink.Save + + +set oShortCutLink = WshShell.CreateShortcut("C:\Users\Public\Desktop\AutoLab Script Menu.lnk") +oShortCutLink.TargetPath = "%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe" +oShortCutLink.Arguments = " c:\ScriptMenu.ps1" +oShortCutLink.Save + +set oShortCutLink = WshShell.CreateShortcut("C:\Users\Public\Desktop\AutoLab Portal.lnk") +oShortCutLink.TargetPath = "C:\Program Files (x86)\Internet Explorer\iexplore.exe" +oShortCutLink.Arguments = " dc.lab.local" +oShortCutLink.Save + +set oShortCutLink = WshShell.CreateShortcut("C:\Users\Public\Desktop\PuTTY.lnk") +oShortCutLink.TargetPath = "C:\Program Files (x86)\PuTTY\PuTTY.exe" +oShortCutLink.Save diff --git a/Build/Automate/VC2/VC41.cmd b/Build/Automate/VC2/VC41.cmd new file mode 100644 index 0000000..e1ab4dc --- /dev/null +++ b/Build/Automate/VC2/VC41.cmd @@ -0,0 +1,17 @@ +@echo off +echo * Install vCenter 4.1 +echo * Install vCenter 4.1 >> c:\buildLog.txt +start /wait B:\VIM_41\vpx\VMware-vcserver.exe /q /s /w /L1033 /v" /qr WARNING_LEVEL=0 USERNAME=\"Lab\" COMPANYNAME=\"lab.local\" DB_SERVER_TYPE=Custom DB_DSN=\"VCenterDB\" DB_USERNAME=\"vpx\" DB_PASSWORD=\"VMware1!\" VPX_USES_SYSTEM_ACCOUNT=\"1\" FORMAT_DB=1 VCS_GROUP_TYPE=Single" +echo ** +echo * Install vSphere Client 4.1 +echo * Install vSphere Client 4.1 >> c:\buildLog.txt +start /wait B:\VIM_41\vpx\VMware-viclient.exe /q /s /w /L1033 /v" /qr" +echo ** +echo * Install vSphere Client 4.1 VUM Plugin +echo * Install vSphere Client 4.1 VUM Plugin >> c:\buildLog.txt +start /wait B:\VIM_41\updateManager\VMware-UMClient.exe /q /s /w /L1033 /v" /qr" +timeout 30 +echo ** +echo * Install vCenter Update Manager 4.1 +echo * Install vCenter Update Manager 4.1 >> c:\buildLog.txt +start /wait B:\VIM_41\updateManager\VMware-UpdateManager.exe /L1033 /v" /qn VMUM_SERVER_SELECT=192.168.199.5 VC_SERVER_IP=vc.lab.local VC_SERVER_ADMIN_USER=\"administrator\" VC_SERVER_ADMIN_PASSWORD=\"VMware1!\" VCI_DB_SERVER_TYPE=Custom VCI_FORMAT_DB=1 DB_DSN=\"VUM\" DB_USERNAME=\"vpx\" DB_PASSWORD=\"VMware1!\" " diff --git a/Build/Automate/VC2/VC50.cmd b/Build/Automate/VC2/VC50.cmd new file mode 100644 index 0000000..4f2286b --- /dev/null +++ b/Build/Automate/VC2/VC50.cmd @@ -0,0 +1,16 @@ +@echo off +echo * Install vCenter 5.0 +echo * Install vCenter 5.0 >> c:\buildLog.txt +start /wait B:\VIM_50\vCenter-Server\VMware-vcserver.exe /q /s /w /L1033 /v" /qr WARNING_LEVEL=0 USERNAME=\"Lab\" COMPANYNAME=\"lab.local\" DB_SERVER_TYPE=Custom DB_DSN=\"VCenterDB\" DB_USERNAME=\"vpx\" DB_PASSWORD=\"VMware1!\" VPX_USES_SYSTEM_ACCOUNT=\"1\" FORMAT_DB=1 VCS_GROUP_TYPE=Single" +echo ** +echo * Install vSphere Client 5.0 +echo * Install vSphere Client 5.0 >> c:\buildLog.txt +start /wait B:\VIM_50\vSphere-Client\VMware-viclient.exe /q /s /w /L1033 /v" /qr" +echo ** +echo * Install vSphere Client 5.0 VUM Plugin +echo * Install vSphere Client 5.0 VUM Plugin >> c:\buildLog.txt +start /wait B:\VIM_50\updateManager\VMware-UMClient.exe /q /s /w /L1033 /v" /qr" +echo ** +echo * Install vCenter Update Manager 5.0 +echo * Install vCenter Update Manager 5.0 >> c:\buildLog.txt +start /wait B:\VIM_50\updateManager\VMware-UpdateManager.exe /L1033 /v" /qn VMUM_SERVER_SELECT=192.168.199.5 VC_SERVER_IP=vc.lab.local VC_SERVER_ADMIN_USER=\"administrator\" VC_SERVER_ADMIN_PASSWORD=\"VMware1!\" VCI_DB_SERVER_TYPE=Custom VCI_FORMAT_DB=1 DB_DSN=\"VUM\" DB_USERNAME=\"vpx\" DB_PASSWORD=\"VMware1!\" " diff --git a/Build/Automate/VC2/VeeamOne.reg b/Build/Automate/VC2/VeeamOne.reg new file mode 100644 index 0000000..1ab8e6e Binary files /dev/null and b/Build/Automate/VC2/VeeamOne.reg differ diff --git a/Build/Automate/VC2/WinTemplate.nvram b/Build/Automate/VC2/WinTemplate.nvram new file mode 100644 index 0000000..38d5bf8 Binary files /dev/null and b/Build/Automate/VC2/WinTemplate.nvram differ diff --git a/Build/Automate/VC2/bfi-nu2lic.txt b/Build/Automate/VC2/bfi-nu2lic.txt new file mode 100644 index 0000000..9f7d94f --- /dev/null +++ b/Build/Automate/VC2/bfi-nu2lic.txt @@ -0,0 +1,121 @@ +Copyright (c) 2002 Bart Lagerweij. All rights reserved. + + NU2-LICENSE + +1. By using and/or opening any packaging enclosing this +software, expanding any compressed file containing this +software or by utilizing this software, you agree to be +bound by the terms of this license agreement. + +2. The software, documentation and any other materials +accompanying this License whether on disk, in read only +memory, on any other media or in any other form +(collectively the "Software") are licensed, not sold, to you +by Bart Lagerweij, as well as their respective members, +agents, directors, officers, servants and representatives +(collectively "Licensor") for use only under the terms of +this License, and Licensor reserves all rights not expressly +granted to you. The rights granted herein are limited to +Licensor's intellectual property rights in the Software and +do not include any other patents or intellectual property +rights. You own the media on which the Software is recorded +but Licensor retains ownership of the Software itself. The +rights granted under the terms of this License include any +software upgrades that replace and/or supplement the +original Software product, unless such upgrade contains a +separate license. + +3. Permission is hereby granted, free of charge, to any +person obtaining a copy of the Software to use, copy, +publish and distribute the Software, subject to the +conditions of this License. + +4. This license must be included with all copies of the +Software, and may not be modified from its original format +as created by the Licensor. The Software may not be +distributed subject to any other license. + +5. This License is effective until terminated. Your rights +under this License will terminate automatically without +notice from Licensor or if you fail to comply with any +term(s) of this License. Upon the termination of this +License, you shall cease all use of the Software and destroy +all copies of it, whether full or partial. + +6. Selling or charging a fee for the Software is prohibited, +although a fee may be charged for the act of transferring a +copy and/or for the distribution media, but not for the +Software itself. + +7. The Software, in whole or in part, may not be +incorporated with or into any other software product without +written permission from Licensor. + +8. You expressly acknowledge and agree that use of the +software is at your sole risk and that the entire risk as to +satisfactory quality, performance, accuracy and effort is +with you. Licensor does not warrant against interference +with your enjoyment of the software, that the functions +contained in the software will meet your requirements, that +the operation of the software will be uninterrupted or +error-free, or that defects in the software will be +corrected. Should the software prove defective, you assume +the entire cost of all necessary servicing, repair or +correction. + +9. THE SOFTWARE IS PROVIDED "AS IS," WITHOUT WARRANTY OF ANY +KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE +WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR +PURPOSE AND NONINFRINGEMENT. No oral or written advice given +by Licensor or by an authorized representative of Licensor +shall create a warranty. + +10. TO THE EXTENT NOT PROHIBITED BY LAW, IN NO EVENT SHALL +THE LICENSOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, INCLUDING BUT NOT LIMITED TO PERSONAL INJURY, OR +ANY INCIDENTAL, SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES +WHATSOEVER, INCLUDING WITHOUT LIMITATION, DAMAGES FOR LOSS +OF PROFITS, LOSS OF DATA, BUSINESS INTERRUPTION OR ANY OTHER +COMMERCIAL DAMAGES OR LOSSES, ARISING OUT OF OR RELATED TO +YOUR USE OR INABILITY TO USE THE SOFTWARE, HOWEVER CAUSED, +REGARDLESS OF THE THEORY OF LIABILITY (CONTRACT, TORT OR +OTHERWISE) AND EVEN IF LICENSOR HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + +11. THIS SOFTWARE IS NOT INTENDED FOR USE IN ANY APPLICATION +IN WHICH THE FAILURE OF THE SOFTWARE COULD LEAD TO DEATH, +PERSONAL INJURY OR SEVERE PHYSICAL OR ENVIRONMENTAL DAMAGE. + +12. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OF IMPLIED +WARRANTIES, LIABILITY OR LIMITATIONS ON APPLICABLE STATUTORY +RIGHTS OF A CONSUMER, SO THE ABOVE EXCLUSIONS AND +LIMITATIONS MAY NOT APPLY TO YOU. IF SUCH EXCLUSIONS FROM +LIABILITY APPLY TO YOU, DO NOT USE THIS SOFTWARE. + +13. In no event shall Licensor's total liability to you for +all damages exceed the amount of $50.00. The foregoing +limitations will apply even if the above stated remedy fails +in its essential purpose. + +14. This License constitutes the entire agreement between +the parties with respect to the use of the Software licensed +hereunder and supersedes all prior or contemporaneous +understandings regarding such subject matter. No amendment +to or modification of this License will be binding unless in +writing and signed by Licensor. Any translation of this +License is done for local requirements and in the event of a +dispute between the English and any non-English versions, +the English version of this License shall govern. + +15. This License will be governed by and construed in +accordance with the laws of the Netherlands, as applied to +agreements entered into and to be performed entirely within +the Netherlands between Dutch residents. This License shall +not be governed by the United Nations Convention on +Contracts for the International Sale of Goods, the +application of which is expressly excluded. + +16. If for any reason a court of competent jurisdiction +finds any provision, or portion thereof, to be +unenforceable, the remainder of this License shall continue +in full force and effect. diff --git a/Build/Automate/VC2/bfi.exe b/Build/Automate/VC2/bfi.exe new file mode 100644 index 0000000..ef0f734 Binary files /dev/null and b/Build/Automate/VC2/bfi.exe differ diff --git a/Build/Automate/VC2/mkisofs.exe b/Build/Automate/VC2/mkisofs.exe new file mode 100644 index 0000000..f6c9f5d Binary files /dev/null and b/Build/Automate/VC2/mkisofs.exe differ diff --git a/Build/Automate/VC2/vCenterDB.reg b/Build/Automate/VC2/vCenterDB.reg new file mode 100644 index 0000000..2be827b Binary files /dev/null and b/Build/Automate/VC2/vCenterDB.reg differ diff --git a/Build/Automate/VC2/vSphereClient.reg b/Build/Automate/VC2/vSphereClient.reg new file mode 100644 index 0000000..247ac71 Binary files /dev/null and b/Build/Automate/VC2/vSphereClient.reg differ diff --git a/Build/Automate/Validate.ps1 b/Build/Automate/Validate.ps1 new file mode 100644 index 0000000..69d4bdd --- /dev/null +++ b/Build/Automate/Validate.ps1 @@ -0,0 +1,375 @@ +# Build Validation script for vSphere 6.0 AutoLab +# +# Version 2.6 +# +# +# Include the functions script, this is used to keep this script clean +if (Test-Path C:\PSFunctions.ps1) { + . "C:\PSFunctions.ps1" +} else { + Write-Host "PSFunctions.ps1 not found. Please copy all PowerShell files from B:\Automate to C:\ and rerun AddHosts.ps1" + Read-Host "Press <Enter> to exit" + exit +} + +$Global:Pass = $true + +if (Test-Administrator) { + Write-Host "Great, script is running as administrator" -foregroundcolor "Green" +} else { + Start-Process PowerShell.exe -Verb Runas -ArgumentList " c:\validate.ps1" + exit +} +# make script window as tall as possible + +$a = (Get-Host).UI.RawUI +$b = $a.WindowSize +$b.Height = $a.MaxWindowSize.Height - 1 +$a.WindowSize = $b +Import-Module C:\windows\system32\WASP.dll +Select-Window -Title "Administrator:" | set-windowposition -left 3 -top 3 +If (!(Test-Path "B:\*")) { + net use B: \\192.168.199.7\Build +} +$CompName = gc env:computername +Write-Host "Validating" $CompName -foregroundcolor "cyan" +Write-Host "Error events from system eventlog on " $CompName -foregroundcolor "cyan" +get-eventlog -LogName System -entrytype Error -ErrorAction SilentlyContinue | Format-table -property TimeGenerated, Message -autosize +if ($CompName -eq "DC") { + Write-Host "Validating required Build share components." -foregroundcolor "cyan" + $AdminPWD = ((Select-String -SimpleMatch "Adminpwd=" -Path "B:\Automate\automate.ini").line).substring(9) + If ($AdminPWD -eq "VMware1!") { + Write-Host "Default admin password set, this isn't safe." -foregroundcolor "Red" + $NewPWD = Read-Host "Enter a new admin password" + If ($NewPWD -ne "") { + Write-Host "Setting new password" -foregroundcolor "Green" + $OldAdminPWD = $AdminPWD + $AdminPWD = $NewPWD + $FileContent = get-content B:\Automate\automate.ini + Set-Content B:\Automate\automate.ini "" + Foreach ($Line in $FileContent){ + If ($Line.StartsWith("Adminpwd")) { $Line = "Adminpwd=$NewPWD"} + Add-Content B:\Automate\automate.ini $Line + } + 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 + net user ada $AdminPWD >> C:\AD-Users.log 2>> C:\Error.log + net user alan $AdminPWD >> C:\AD-Users.log 2>> C:\Error.log + net user grace $AdminPWD >> C:\AD-Users.log 2>> C:\Error.log + net user charles $AdminPWD >> C:\AD-Users.log 2>> C:\Error.log + B:\automate\_Common\Autologon administrator lab $AdminPWD + $TempContent = Get-Content B:\Automate\Hosts\esx1-4.cfg |%{$_ -replace $OldAdminPWD,$AdminPWD} + $TempContent | Set-Content B:\Automate\Hosts\esx1-4.cfg + $TempContent = Get-Content B:\Automate\Hosts\esx1-5.cfg |%{$_ -replace $OldAdminPWD,$AdminPWD} + $TempContent | Set-Content B:\Automate\Hosts\esx1-5.cfg + $TempContent = Get-Content B:\Automate\Hosts\esx2-4.cfg |%{$_ -replace $OldAdminPWD,$AdminPWD} + $TempContent | Set-Content B:\Automate\Hosts\esx2-4.cfg + $TempContent = Get-Content B:\Automate\Hosts\esx2-4c.cfg |%{$_ -replace $OldAdminPWD,$AdminPWD} + $TempContent | Set-Content B:\Automate\Hosts\esx2-4c.cfg + $TempContent = Get-Content B:\Automate\Hosts\esx2-5.cfg |%{$_ -replace $OldAdminPWD,$AdminPWD} + $TempContent | Set-Content B:\Automate\Hosts\esx2-5.cfg + $TempContent = Get-Content B:\Automate\Hosts\esx3-5.cfg |%{$_ -replace $OldAdminPWD,$AdminPWD} + $TempContent | Set-Content B:\Automate\Hosts\esx3-5.cfg + $TempContent = Get-Content B:\Automate\Hosts\esx4-5.cfg |%{$_ -replace $OldAdminPWD,$AdminPWD} + $TempContent | Set-Content B:\Automate\Hosts\esx4-5.cfg + $TempContent = Get-Content B:\Automate\Hosts\esx11-5.cfg |%{$_ -replace $OldAdminPWD,$AdminPWD} + $TempContent | Set-Content B:\Automate\Hosts\esx11-5.cfg + $TempContent = Get-Content B:\Automate\Hosts\esx12-5.cfg |%{$_ -replace $OldAdminPWD,$AdminPWD} + $TempContent | Set-Content B:\Automate\Hosts\esx12-5.cfg + $service = gwmi win32_service -filter "name='MSSQL`$SQLEXPRESS'" + $null = $service.change($null,$null,$null,$null,$null,$null,$null,$AdminPWD) + Write-Host "Restarting SQL Express with new password" -foregroundcolor "Green" + $null = Restart-Service "MSSQL`$SQLEXPRESS" -force + } + } + If ((Get-WmiObject Win32_BIOS).Manufacturer.Tolower() -like "bochs*") { + Write-Host "Building on Ravello, set some build options." -foregroundcolor "green" + $AutoAddHosts = (Read-Host "Automatically add hosts to vCentre when it builds (y/n)").ToLower() + If ($AutoAddHosts -eq "n") { + $TempContent = Get-Content B:\Automate\Automate.ini |%{$_ -replace "AutoAddHosts=true","AutoAddHosts=false"} + $TempContent | Set-Content B:\Automate\Automate.ini + } + If ($AutoAddHosts -eq "y") { + $TempContent = Get-Content B:\Automate\Automate.ini |%{$_ -replace "AutoAddHosts=false","AutoAddHosts=true"} + $TempContent | Set-Content B:\Automate\Automate.ini + Write-Host "Make sure the ESXi hosts are properly built & restart cleanly" -foregroundcolor "cyan" + } + } + $vSpherePaths = @{"ESX41"="\\192.168.199.7\Build\ESX41\*";"ESXi41"="\\192.168.199.7\Build\ESXi41\*";"vCenter41"="\\192.168.199.7\Build\VIM_41\*";"ESXi50"="\\192.168.199.7\Build\ESXi50\*";"vCenter50"="\\192.168.199.7\Build\VIM_50\*";"ESXi51"="\\192.168.199.7\Build\ESXi51\*";"vCenter51"="\\192.168.199.7\Build\VIM_51\*";"ESXi55"="\\192.168.199.7\Build\ESXi55\*";"vCenter55"="\\192.168.199.7\Build\VIM_55\*";"ESXi60"="\\192.168.199.7\Build\ESXi60\*";"vCenter60"="\\192.168.199.7\Build\VIM_60\*"} + $vSpherePaths.GetEnumerator() | % {if (!(Test-Path $_.Value)) {New-Variable -Name $_.Name -Value $false -force} else {New-Variable -Name $_.Name -Value $true -force}} + if ($vCenter41 -and ($ESXi41 -or $ESX41)) { + Write-Host "vCenter 4.1 & ESXi 4.1 found." -foregroundcolor "green" + $vSphere41 = $true + } elseif ($vCenter41 -or ($ESXi41 -or $ESX41)) { + Write-Host "vSphere 4.1 installation requirements not met. Please verify that both vCenter 4.1 & ESXi 4.1 exist on Build share." -foregroundcolor "red" + $vSphere41 = $false + } else { + Write-Host "vCenter 4.1 & ESXi 4.1 not found." -foregroundcolor "cyan" + $vSphere41 = $false + } + if ($vCenter50 -and $ESXi50) { + Write-Host "vCenter 5.0 & ESXi 5.0 found." -foregroundcolor "green" + $vSphere50 = $true + } elseif ($vCenter50 -or $ESXi50) { + Write-Host "vSphere 5.0 installation requirements not met. Please verify that both vCenter 5.0 & ESXi 5.0 exist on Build share." -foregroundcolor "red" + $vSphere50 = $false + } else { + Write-Host "vCenter 5.0 & ESXi 5.0 not found." -foregroundcolor "cyan" + $vSphere50 = $false + } + if ($vCenter51 -and $ESXi51) { + Write-Host "vCenter 5.1 & ESXi 5.1 found." -foregroundcolor "green" + $vSphere51 = $true + } elseif ($vCenter51 -or $ESXi51) { + Write-Host "vSphere 5.1 installation requirements not met. Please verify that both vCenter 5.1 & ESXi 5.1 exist on Build share." -foregroundcolor "red" + $vSphere51 = $false + } else { + Write-Host "vCenter 5.1 & ESXi 5.1 not found." -foregroundcolor "cyan" + $vSphere51 = $false + } + if ($vCenter55 -and $ESXi55) { + Write-Host "vCenter 5.5 & ESXi 5.5 found." -foregroundcolor "green" + $vSphere55 = $true + } elseif ($vCenter55 -or $ESXi55) { + Write-Host "vSphere 5.5 installation requirements not met. Please verify that both vCenter 5.5 & ESXi 5.5 exist on Build share." -foregroundcolor "red" + $vSphere55 = $false + } else { + Write-Host "vCenter 5.5 & ESXi 5.5 not found." -foregroundcolor "cyan" + $vSphere55 = $false + } + if ($vCenter60 -and $ESXi60) { + Write-Host "vCenter 6.0 & ESXi 6.0 found." -foregroundcolor "green" + $vSphere60 = $true + } elseif ($vCenter60 -or $ESXi60) { + Write-Host "vSphere 6.0 installation requirements not met. Please verify that both vCenter 6.0 & ESXi 6.0 exist on Build share." -foregroundcolor "red" + $vSphere60 = $false + } else { + Write-Host "vCenter 6.0 & ESXi 6.0 not found." -foregroundcolor "cyan" + $vSphere60 = $false + } + if (!($vSphere41 -or $vSphere50 -or $vSphere51 -or $vSphere55 -or $vSphere60)) { + Write-Host "Matching vCenter & ESXi distributions not found. Please check the Build share." -foregroundcolor "red" + $Global:Pass = $false + } + Check-File "\\192.168.199.7\Build\VMware-PowerCLI*.exe" "PowerCLI installer" + If (!(Test-Path "\\192.168.199.7\Build\VMware-PowerCLI*.exe")) { + If ((Read-Host "Would you like to go to the PowerCLI download site (y/n)?") -like "y") { + $IE=new-object -com internetexplorer.application + if ((([System.Environment]::OSVersion.Version.Major *10) +[System.Environment]::OSVersion.Version.Minor) -ge 62) {$IE.navigate2("https://my.vmware.com/group/vmware/get-download?downloadGroup=PCLI600R1")} + if ((([System.Environment]::OSVersion.Version.Major *10) +[System.Environment]::OSVersion.Version.Minor) -le 62) {$IE.navigate2("https://my.vmware.com/group/vmware/get-download?downloadGroup=PCLI58R1")} + $IE.visible=$true + } Else { + Write-Host "OK, but the VC build will not work correctly without PowerCLI" + } + } + if (Test-Path "b:\VMware-PowerCLI-5*.exe") { + If (($vSphere50 -and ((Get-ChildItem B:\VMware-PowerCLI-*.exe | where {$_.VersionInfo.ProductVersion -like "5.0*"}) -eq $Null))) {Write-Host "vSphere 5.0 found, matching PowerCLI version missing. Please check the Build share." -foregroundcolor "Yellow"} + If (($vSphere51 -and ((Get-ChildItem B:\VMware-PowerCLI-*.exe | where {$_.VersionInfo.ProductVersion -like "5.1*"}) -eq $Null))) {Write-Host "vSphere 5.1 found, matching PowerCLI version missing. Please check the Build share." -foregroundcolor "Yellow"} + If (($vSphere55 -and (((Get-ChildItem B:\VMware-PowerCLI-*.exe | where {$_.VersionInfo.ProductVersion -like "5.5*"}) -eq $Null) -or !((Get-ChildItem B:\VMware-PowerCLI-*.exe | where {$_.VersionInfo.ProductVersion -like "5.8*"}) -eq $Null)))) {Write-Host "vSphere 5.5 found, matching PowerCLI version missing. Please check the Build share." -foregroundcolor "Yellow"} + } + Check-OptionalFile "\\192.168.199.7\Build\Win2K3.iso" "Windows Server 2003 ISO" + Check-OptionalFile "\\192.168.199.7\Build\WinXP.iso" "Windows XP ISO" + Write-Host "Validate SQL & TFTP Install" -foregroundcolor "cyan" + if (Test-Path -LiteralPath "C:\Program Files\Microsoft SQL Server\MSSQL10_50.SQLEXPRESS\MSSQL\DATA\") { + Check-File "C:\Program Files\Microsoft SQL Server\MSSQL10_50.SQLEXPRESS\MSSQL\DATA\vCenter.mdf" "vCenter Database" + Check-File "C:\Program Files\Microsoft SQL Server\MSSQL10_50.SQLEXPRESS\MSSQL\DATA\VUM.mdf" "vCenter Update Manager Database" + } elseif (Test-Path -LiteralPath "C:\Program Files (x86)\Microsoft SQL Server\MSSQL.1\MSSQL\Data\") { + Check-File "C:\Program Files (x86)\Microsoft SQL Server\MSSQL.1\MSSQL\Data\vCenter.mdf" "vCenter Database" + Check-File "C:\Program Files (x86)\Microsoft SQL Server\MSSQL.1\MSSQL\Data\VUM.mdf" "vCenter Update Manager Database" + } + Check-File "C:\Program Files\Tftpd64_SE\Tftpd64_SVC.exe" "TFTP Server" + Check-File "C:\TFTP-Root\pxelinux.0" "PXE boot file" + Check-File "C:\TFTP-Root\pxelinux.cfg" "PXE boot configuration file" + if ($ESX41 -and (Test-Path "C:\TFTP-Root\ESX41\*")) { + Write-Host "ESX 4.1 TFTP files found." -foregroundcolor "green" + } elseif ($ESX41 -and !(Test-Path "C:\TFTP-Root\ESX41\*")) { + Write-Host "ESX 4.1 TFTP files not found on DC, but they exist on Build share." -foregroundcolor "red" + $Global:Pass = $false + } + if ($ESXi41 -and (Test-Path "C:\TFTP-Root\ESXi41\*")) { + Write-Host "ESXi 4.1 TFTP files found." -foregroundcolor "green" + } elseif ($ESXi41 -and !(Test-Path "C:\TFTP-Root\ESXi41\*")) { + Write-Host "ESXi 4.1 TFTP files not found on DC, but they exist on Build share." -foregroundcolor "red" + $Global:Pass = $false + } + if ($ESXi50 -and (Test-Path "C:\TFTP-Root\ESXi50\*")) { + Write-Host "ESXi 5.0 TFTP files found." -foregroundcolor "green" + } elseif ($ESXi50 -and !(Test-Path "C:\TFTP-Root\ESXi50\*")) { + Write-Host "ESXi 5.0 TFTP files not found on DC, but they exist on Build share." -foregroundcolor "red" + $Global:Pass = $false + } + if ($ESXi51 -and (Test-Path "C:\TFTP-Root\ESXi51\*")) { + Write-Host "ESXi 5.1 TFTP files found." -foregroundcolor "green" + } elseif ($ESXi51 -and !(Test-Path "C:\TFTP-Root\ESXi51\*")) { + Write-Host "ESXi 5.1 TFTP files not found on DC, but they exist on Build share." -foregroundcolor "red" + $Global:Pass = $false + } + $vcinstall = ((Select-String -SimpleMatch "VCInstall=" -Path "B:\Automate\automate.ini").line).substring(10) + If ($vcinstall -eq "50") {$vcinstall = "5"} + If (!($vSphere50) -and ($vcinstall -eq "5")) { + Write-Host "You wish to install vSphere 5.0 but the installers aren't on the build share" -foregroundcolor "red" + $Global:Pass = $false + } + If (!($vSphere51) -and ($vcinstall -eq "51")) { + Write-Host "You wish to install vSphere 5.1 but the installers aren't on the build share" -foregroundcolor "red" + $Global:Pass = $false + } + If (!($vSphere55) -and ($vcinstall -eq "55")) { + Write-Host "You wish to install vSphere 5.5 but the installers aren't on the build share" -foregroundcolor "red" + $Global:Pass = $false + } + Write-Host "Check Domain" -foregroundcolor "cyan" + $domain = [System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain() + if ($domain.Name -eq "lab.local") { + Write-Host ("Correct Domain") -foregroundcolor "green" + } else { + Write-Host ("Domain Broken") -foregroundcolor "red" + $Global:Pass = $false + } + Write-Host "Check Services" -foregroundcolor "cyan" + Check-ServiceRunning "Active Directory Domain Services" + Check-ServiceRunning "DHCP Server" + Check-ServiceRunning "DNS Server" + Check-ServiceRunning "Netlogon" + Check-ServiceRunning "Tftpd32_svc" + Check-ServiceRunning "SQL Server (SQLEXPRESS)" + Check-ServiceRunning "SQLBrowser" + If ((Get-VMPlatform) -eq "VMware") {Check-ServiceRunning "VMTools"} + Write-Host "Check DNS" -foregroundcolor "cyan" + Check-DNSRecord ("dc.lab.local") + Check-DNSRecord ("vc.lab.local") + Check-DNSRecord ("vma.lab.local") + 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") + Check-DNSRecord ("192.168.199.7") + Check-DNSRecord ("192.168.199.11") + Check-DNSRecord ("192.168.199.12") + Check-DNSRecord ("192.168.199.38") + Check-DNSRecord ("192.168.199.39") + Check-DNSRecord ("192.168.199.40") +} +if ($CompName -eq "VC") { + $HaveXP = test-Path("\\192.168.199.7\Build\WinXP.iso") + $Have2K3 = test-Path("\\192.168.199.7\Build\Win2K3.iso") + If ((Get-VMPlatform) -eq "VMware") {Check-ServiceRunning "VMTools"} + $VCPath = "None" + If (Test-path "C:\ProgramData\VMware\VMware VirtualCenter") { + $VCPath = "C:\ProgramData\VMware\VMware VirtualCenter" + $VCVer = (Get-ItemProperty -Path "HKLM:\SOFTWARE\VMware, Inc.\VMware VirtualCenter").InstalledVersion + } + If (Test-path "C:\ProgramData\VMware\vCenterServer") { + $VCPath = "C:\ProgramData\VMware\vCenterServer\cfg\vmware-vpx" + $VCVer = (Get-ItemProperty -Path "HKLM:\SOFTWARE\VMware, Inc.\vCenter Server").ProductVersion + } + Write-Host "VC version $VCVer" + If (!($VCPath -eq "None")) { + Write-Host "Check Files" -foregroundcolor "cyan" + if ($Have2K3 -eq $True) {Check-File "$VCPath\sysprep\svr2003\sysprep.exe" "Windows 2003 SysPrep" } + if ($HaveXP -eq $True) { Check-File "$VCPath\sysprep\xp\sysprep.exe" "Windows XP SysPrep" } + if (Test-Path "B:\Automate\automate.ini") { + if ($VCVer.StartsWith("4")) { + if ((((Select-String -SimpleMatch "DeployVUM=" -Path "B:\Automate\automate.ini").line).substring(10)) -like "true") {Check-ServiceRunning "VMware vCenter Update Manager Service"} + Check-ServiceRunning "ADAM_VMwareVCMSDS" + Check-ServiceRunning "VMware VirtualCenter Management Webservices" + Check-ServiceRunning "VMware VirtualCenter Server" + } + if ($VCVer.StartsWith("5")) { + if ((((Select-String -SimpleMatch "DeployVUM=" -Path "B:\Automate\automate.ini").line).substring(10)) -like "true") {Check-ServiceRunning "VMware vSphere Update Manager Service"} + Check-ServiceRunning "ADAM_VMwareVCMSDS" + Check-ServiceRunning "VMware VirtualCenter Management Webservices" + Check-ServiceRunning "VMware VirtualCenter Server" + } + if ($VCVer.StartsWith("6")) { + if ((((Select-String -SimpleMatch "DeployVUM=" -Path "B:\Automate\automate.ini").line).substring(10)) -like "true") {Check-ServiceRunning "VMware vSphere Update Manager Service"} + Check-ServiceRunning "VMware VirtualCenter Server" + } + } + + } Else { + Write-Host "vCenter is not installed" -foregroundcolor "Yellow" + } + if ($Have2K3 -eq $true) { + Check-OptionalFile "\\192.168.199.7\Build\Windows2K3.iso" "Lightly automated Windows Server 2003 ISO" + Check-OptionalFile "\\192.168.199.7\Build\Auto2K3.iso" "Fully automated Windows Server 2003 ISO" + } + if ($HaveXP -eq $true) {Check-OptionalFile "\\192.168.199.7\Build\AutoXP.iso" "Fully automated Windows XP ISO"} +} +if ($CompName -eq "DC2") { + Write-Host "Check Domain" -foregroundcolor "cyan" + $domain = [System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain() + if ($domain.Name -eq "lab.local") { + Write-Host ("Correct Domain") -foregroundcolor "green" + } else { + Write-Host ("Domain Broken") -foregroundcolor "red" + $Global:Pass = $false + } + Write-Host "Check Services" -foregroundcolor "cyan" + Check-ServiceRunning "Active Directory Domain Services" + Check-ServiceRunning "DNS Server" + Check-ServiceRunning "Netlogon" + Check-ServiceRunning "SQL Server (SQLEXPRESS)" + Check-ServiceRunning "SQLBrowser" + If ((Get-VMPlatform) -eq "VMware") {Check-ServiceRunning "VMTools"} + Write-Host "Check DNS" -foregroundcolor "cyan" + Check-DNSRecord ("dc.lab.local") + Check-DNSRecord ("vc.lab.local") + Check-DNSRecord ("vma.lab.local") + 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") + Check-DNSRecord ("192.168.199.7") + Check-DNSRecord ("192.168.199.11") + Check-DNSRecord ("192.168.199.12") + Check-DNSRecord ("192.168.199.38") + Check-DNSRecord ("192.168.199.39") + Check-DNSRecord ("192.168.199.40") +} +if ($CompName -eq "VC2") { + + If ((Get-VMPlatform) -eq "VMware") {Check-ServiceRunning "VMTools"} + If (Test-path "C:\ProgramData\VMware\VMware VirtualCenter") { + Write-Host "Check Services" -foregroundcolor "cyan" + Check-ServiceRunning "VMware VirtualCenter Management Webservices" + Check-ServiceRunning "VMware VirtualCenter Server" + Check-ServiceRunning "ADAM_VMwareVCMSDS" + } Else { + Write-Host "vCenter is not installed" -foregroundcolor "Yellow" + } +} + +Write-Host "The final result" -foregroundcolor "cyan" +if ($Global:Pass -eq $false ) { + Write-Host ("*****************************************") -foregroundcolor "red" + Write-Host ("*") -foregroundcolor "red" + Write-Host ("* Oh dear, we seem to have a problem") -foregroundcolor "red" + Write-Host ("*") -foregroundcolor "red" + Write-Host ("* Check the build log to see what failed") -foregroundcolor "red" + Write-Host ("*") -foregroundcolor "red" + Write-Host ("*****************************************") -foregroundcolor "red" +} else { + Write-Host ("**************************************") -foregroundcolor "green" + Write-Host ("*") -foregroundcolor "green" + Write-Host ("* Build looks good") -foregroundcolor "green" + Write-Host ("*") -foregroundcolor "green" + Write-Host ("* Move on to the next stage") -foregroundcolor "green" + Write-Host ("*") -foregroundcolor "green" + Write-Host ("**************************************") -foregroundcolor "green" +} +Read-host " Press <Enter> to exit" \ No newline at end of file diff --git a/Build/Automate/Version.txt b/Build/Automate/Version.txt new file mode 100644 index 0000000..2322ecb --- /dev/null +++ b/Build/Automate/Version.txt @@ -0,0 +1,7 @@ +** +* Autolab V2.6 +** +* Released April 2015 +** +* New versions and updates at www.labguides.com +** diff --git a/Build/Automate/ViewSetup.ps1 b/Build/Automate/ViewSetup.ps1 new file mode 100644 index 0000000..f6d7e42 --- /dev/null +++ b/Build/Automate/ViewSetup.ps1 @@ -0,0 +1,9 @@ +# +Write-Host "Loading View Powershell Plugin" +Add-PSSnapin VMware.View.Broker +Write-Host "Add VC as vCenter and View Composer server" +$VC = add-viewvc -serverName "vc.lab.local" -user "lab\VI-Admin" -Password "VMware1!" -useSSL $True -port 443 -useComposer $True -useComposerSSL $True -composerPort 18443 +# $CS1 = Get-ConnectionBroker -broker_ID "CS1" +# Want to set View Composer credentials & configure EventsDB connection +# Update-ConnectionBroker $CS1 +Write-Host "Done with View setup" diff --git a/Build/Automate/_Common/Auto2K3.cmd b/Build/Automate/_Common/Auto2K3.cmd new file mode 100644 index 0000000..6067287 --- /dev/null +++ b/Build/Automate/_Common/Auto2K3.cmd @@ -0,0 +1,22 @@ +@echo off +echo ** +echo * Install dotnet 3.5 +if exist \\192.168.199.7\build\VIM_60\redist\dotnet\dotnetfx35.exe ( +start /wait \\192.168.199.7\build\VIM_60\redist\dotnet\dotnetfx35.exe /qb /norestart +) +if exist \\192.168.199.7\build\VIM_50\redist\dotnet\dotnetfx35.exe ( +start /wait \\192.168.199.7\build\VIM_50\redist\dotnet\dotnetfx35.exe /qb /norestart +) +if exist \\192.168.199.7\build\VIM_51\redist\dotnet\dotnetfx35.exe ( +start /wait \\192.168.199.7\build\VIM_51\redist\dotnet\dotnetfx35.exe /qb /norestart +) +echo ** +echo * Install Load Storm by Andrew Mitchel +start /wait msiexec /i "\\192.168.199.7\build\Automate\VC\Floppy\Load Storm.msi" /q +echo ** +echo * Disable screen lock +regedit /s \\192.168.199.7\build\Automate\_Common\NoSCRNSave.reg +echo ** +echo * Install VMware Tools and reboot +start /wait \\192.168.199.7\build\VMTools\Setup.exe /s /v "/qn" +timeout 60 diff --git a/Build/Automate/_Common/Auto2K3.sif b/Build/Automate/_Common/Auto2K3.sif new file mode 100644 index 0000000..d51c97c --- /dev/null +++ b/Build/Automate/_Common/Auto2K3.sif @@ -0,0 +1,58 @@ +;SetupMgrTag +[UserData] + FullName="Lab" + OrgName="Lab Local" + ComputerName=Auto2K3 + ProductID=xxxxx-xxxxx-xxxxx-xxxxx-xxxxx + +[GuiUnattended] + TimeZone=35 + OEMSkipRegional=1 + OemSkipWelcome=1 + AdminPassword="VMware1!" + EncryptedAdminPassword=NO + AutoLogon=Yes + AutoLogonCount=99 + +[Unattended] + Repartition=yes + DriverSigningPolicy=Ignore + UnattendMode=FullUnattended + FileSystem=ConvertNTFS + ExtendOemPartition=1 + OemSkipEula=Yes + OemPreinstall=Yes + UnattendSwitch=Yes + TargetPath=\WINDOWS + +[GUIRunOnce] + Build="D:\Auto2K3.cmd" + +[Data] + AutoPartition=1 + MsDosInitiated="0" + UnattendedInstall="Yes" + AutomaticUpdates="no" + +[Display] + BitsPerPel=32 + Xresolution=800 + YResolution=600 + Vrefresh=75 + +[LicenseFilePrintData] + AutoMode=PerSeat + +[Networking] + InstallDefaultComponents=Yes + +[Branding] + BrandIEUsingUnattended=Yes + +[Proxy] + Proxy_Enable=0 + Use_Same_Proxy=0 + +[Identification] + JoinWorkgroup=Lab + diff --git a/Build/Automate/_Common/AutoXP.cmd b/Build/Automate/_Common/AutoXP.cmd new file mode 100644 index 0000000..2ececbf --- /dev/null +++ b/Build/Automate/_Common/AutoXP.cmd @@ -0,0 +1,8 @@ +@echo off +echo ** +echo * Disable screen lock +regedit /s \\192.168.199.7\build\Automate\_Common\NoSCRNSave.reg +echo ** +echo * Install VMware Tools and reboot +start /wait \\192.168.199.7\build\VMTools\Setup.exe /s /v "/qn" +timeout 60 diff --git a/Build/Automate/_Common/AutoXP.sif b/Build/Automate/_Common/AutoXP.sif new file mode 100644 index 0000000..2218a2e --- /dev/null +++ b/Build/Automate/_Common/AutoXP.sif @@ -0,0 +1,64 @@ +;SetupMgrTag +[UserData] + FullName="Lab" + OrgName="Lab Local" + ComputerName=AutoXP + ProductID=xxxxx-xxxxx-xxxxx-xxxxx-xxxxx + +[GuiUnattended] + TimeZone=35 + OemSkipWelcome=1 + AdminPassword="VMware1!" + EncryptedAdminPassword=NO + AutoLogon=Yes + AutoLogonCount=99 + +[Unattended] + Repartition=yes + DriverSigningPolicy=ignore + UnattendMode=FullUnattended + FileSystem=ConvertNTFS + ExtendOemPartition=1 + OemSkipEula=Yes + OemPreinstall=no + UnattendSwitch=Yes + TargetPath=\WINDOWS + DUDisable=no + +[GUIRunOnce] + Build=D:\AutoXP.cmd + +[Data] + AutoPartition=1 + MsDosInitiated="0" + UnattendedInstall="Yes" + AutomaticUpdates=no + +[Display] + BitsPerPel=32 + Xresolution=800 + YResolution=600 + Vrefresh=75 + +[Networking] + InstallDefaultComponents=Yes + +[Branding] + BrandIEUsingUnattended=Yes + +[Proxy] + Proxy_Enable=0 + Use_Same_Proxy=0 + +[Identification] + JoinWorkgroup=Lab + +[MassStorageDrivers] + "VMware SCSI Controller"=OEM + "IDE CD-ROM (ATAPI 1.2)/PCI IDE Controller" = "RETAIL" + +[OEMBootFiles] + txtsetup.oem + vmscsi.cat + vmscsi.inf + vmscsi.sys \ No newline at end of file diff --git a/Build/Automate/_Common/Autologon.exe b/Build/Automate/_Common/Autologon.exe new file mode 100644 index 0000000..3a7d531 Binary files /dev/null and b/Build/Automate/_Common/Autologon.exe differ diff --git a/Build/Automate/_Common/CPUBusy.vbs b/Build/Automate/_Common/CPUBusy.vbs new file mode 100644 index 0000000..5c4f83e --- /dev/null +++ b/Build/Automate/_Common/CPUBusy.vbs @@ -0,0 +1,12 @@ +Dim goal, before, x, y, i +goal = 5000000 +Do While True + before = Timer + For i = 0 to goal + x = 0.000001 + y = sin(x) + y = y + 0.00001 + Next + y = y + 0.01 + WScript.Echo "I did five million sines in " & Int(Timer - before + 0.5) & " seconds!" +Loop diff --git a/Build/Automate/_Common/ExecuPol.reg b/Build/Automate/_Common/ExecuPol.reg new file mode 100644 index 0000000..93a125d Binary files /dev/null and b/Build/Automate/_Common/ExecuPol.reg differ diff --git a/Build/Automate/_Common/ExplorerView.reg b/Build/Automate/_Common/ExplorerView.reg new file mode 100644 index 0000000..c4db8e5 Binary files /dev/null and b/Build/Automate/_Common/ExplorerView.reg differ diff --git a/Build/Automate/_Common/ExtPart.exe b/Build/Automate/_Common/ExtPart.exe new file mode 100644 index 0000000..f4f54d8 Binary files /dev/null and b/Build/Automate/_Common/ExtPart.exe differ diff --git a/Build/Automate/_Common/IExplorer.reg b/Build/Automate/_Common/IExplorer.reg new file mode 100644 index 0000000..71c1170 Binary files /dev/null and b/Build/Automate/_Common/IExplorer.reg differ diff --git a/Build/Automate/_Common/Lab2K3.sif b/Build/Automate/_Common/Lab2K3.sif new file mode 100644 index 0000000..97dfb5c --- /dev/null +++ b/Build/Automate/_Common/Lab2K3.sif @@ -0,0 +1,55 @@ +;SetupMgrTag +[UserData] + FullName="Lab" + OrgName="Lab Local" + ComputerName=Lab2K3 + ProductID=xxxxx-xxxxx-xxxxx-xxxxx-xxxxx + +[GuiUnattended] + TimeZone=35 + OEMSkipRegional=1 + OemSkipWelcome=1 + AdminPassword="VMware1!" + EncryptedAdminPassword=NO + AutoLogon=Yes + AutoLogonCount=99 + +[Unattended] + Repartition=yes + DriverSigningPolicy=Ignore + UnattendMode=FullUnattended + FileSystem=ConvertNTFS + ExtendOemPartition=1 + OemSkipEula=Yes + OemPreinstall=Yes + UnattendSwitch=Yes + TargetPath=\WINDOWS + +[Data] + AutoPartition=1 + MsDosInitiated="0" + UnattendedInstall="Yes" + AutomaticUpdates="no" + +[Display] + BitsPerPel=32 + Xresolution=800 + YResolution=600 + Vrefresh=75 + +[LicenseFilePrintData] + AutoMode=PerSeat + +[Networking] + InstallDefaultComponents=Yes + +[Branding] + BrandIEUsingUnattended=Yes + +[Proxy] + Proxy_Enable=0 + Use_Same_Proxy=0 + +[Identification] + JoinWorkgroup=Lab + diff --git a/Build/Automate/_Common/Nested.reg b/Build/Automate/_Common/Nested.reg new file mode 100644 index 0000000..217bdeb Binary files /dev/null and b/Build/Automate/_Common/Nested.reg differ diff --git a/Build/Automate/_Common/NoSCRNSave.reg b/Build/Automate/_Common/NoSCRNSave.reg new file mode 100644 index 0000000..73ea10d Binary files /dev/null and b/Build/Automate/_Common/NoSCRNSave.reg differ diff --git a/Build/Automate/_Common/WASP.dll b/Build/Automate/_Common/WASP.dll new file mode 100644 index 0000000..32fe957 Binary files /dev/null and b/Build/Automate/_Common/WASP.dll differ diff --git a/Build/Automate/_Common/XPDrivers/disk.tag b/Build/Automate/_Common/XPDrivers/disk.tag new file mode 100644 index 0000000..e69de29 diff --git a/Build/Automate/_Common/XPDrivers/txtsetup.oem b/Build/Automate/_Common/XPDrivers/txtsetup.oem new file mode 100644 index 0000000..36d36da --- /dev/null +++ b/Build/Automate/_Common/XPDrivers/txtsetup.oem @@ -0,0 +1,21 @@ +[Disks] +disk = "VMware SCSI Controller Installation Disk", \disk.tag, \ + +[Defaults] +scsi = VMSCSI + +[scsi] +VMSCSI = "VMware SCSI Controller" + +[Files.scsi.VMSCSI] +driver = vmdisk, vmscsi.sys, VMSCSI +inf = vmdisk, vmscsi.inf +catalog = vmdisk, vmscsi.cat + +[Config.VMSCSI] +value = "", Tag, REG_DWORD, 5 +value = Parameters\PnpInterface, 5 ,REG_DWORD, 1 +value = Parameters\Device, NumberOfRequests, REG_DWORD, 128 + +[HardwareIds.scsi.VMSCSI] +id = "PCI\VEN_104B&DEV_1040", "VMscsi" diff --git a/Build/Automate/_Common/XPDrivers/vmscsi.cat b/Build/Automate/_Common/XPDrivers/vmscsi.cat new file mode 100644 index 0000000..6ea69ab Binary files /dev/null and b/Build/Automate/_Common/XPDrivers/vmscsi.cat differ diff --git a/Build/Automate/_Common/XPDrivers/vmscsi.inf b/Build/Automate/_Common/XPDrivers/vmscsi.inf new file mode 100644 index 0000000..bd835dc --- /dev/null +++ b/Build/Automate/_Common/XPDrivers/vmscsi.inf @@ -0,0 +1,86 @@ +;vmscsi.INF +;This file contains the information required to load the driver for the VMware SCSI Controller + +; Copyright (c) 2001 - 2004, VMware, Inc. + +[version] +Signature="$Windows NT$" +Class=SCSIAdapter +ClassGuid={4D36E97B-E325-11CE-BFC1-08002BE10318} +Provider=%VMWARE% +DriverVer=08/17/2005,1.2.0.4 +CatalogFile=vmscsi.cat + + + +[SourceDisksNames.x86] +1 = %DSKID1%,,,"" + +[SourceDisksFiles] +; Files for disk VMware SCSI Controller Installation Disk #1 (SCSIAdapter) +vmscsi.sys = 1,, + +[DestinationDirs] +DefaultDestDir=12 + + + +[Manufacturer] +%VMWARE%=VMware.Mfg + + + +[VMware.Mfg] +%DEVICE%=DDInstall,PCI\VEN_104B&DEV_1040 + + + +[DDInstall] +CopyFiles=@vmscsi.sys + + + +[DDInstall.Services] +AddService=vmscsi,0x00000002,Service_Install,EventLog_Install + + + +[Service_Install] +DisplayName=vmscsi +ServiceType=0x01 ;KERNEL Driver +StartType=0 ;Boot Time +ErrorControl=1 ;Display Errors +ServiceBinary=%12%\vmscsi.sys +LoadOrderGroup=SCSI Miniport + +AddReg=pnpsafe_pci_addreg + +AddReg=os_hba_queue_limit_addreg + + +[os_hba_queue_limit_addreg] +HKR, "Parameters\Device", "NumberofRequests", %REG_DWORD%, 128 + + + +[pnpsafe_pci_addreg] +HKR, "Parameters\PnpInterface", "5", 0x00010001, 0x00000001 + + + +[EventLog_Install] +AddReg = EventLog_AddReg + +[EventLog_AddReg] +HKR,,EventMessageFile,%REG_EXPAND_SZ%,"%%SystemRoot%%\System32\IoLogMsg.dll" +HKR,,TypesSupported,%REG_DWORD%,7 + + + +[strings] +VMWARE="VMware, Inc." +VMSCSI="VMscsi" +DEVICE="VMware SCSI Controller" +DSKID1="VMware SCSI Controller Installation Disk #1 (SCSIAdapter)" +REG_EXPAND_SZ=0x00020000 +REG_DWORD=0x00010001 diff --git a/Build/Automate/_Common/XPDrivers/vmscsi.sys b/Build/Automate/_Common/XPDrivers/vmscsi.sys new file mode 100644 index 0000000..6d2a243 Binary files /dev/null and b/Build/Automate/_Common/XPDrivers/vmscsi.sys differ diff --git a/Build/Automate/_Common/iometer.exe b/Build/Automate/_Common/iometer.exe new file mode 100644 index 0000000..e45c883 Binary files /dev/null and b/Build/Automate/_Common/iometer.exe differ diff --git a/Build/Automate/_Common/wget.exe b/Build/Automate/_Common/wget.exe new file mode 100644 index 0000000..7b76bb2 Binary files /dev/null and b/Build/Automate/_Common/wget.exe differ diff --git a/Build/Automate/automate.ini b/Build/Automate/automate.ini new file mode 100644 index 0000000..7c16231 --- /dev/null +++ b/Build/Automate/automate.ini @@ -0,0 +1,22 @@ +[Automation] +TZ=New Zealand Standard Time + +VCInstall=60 +VCInstallOptions=4,5,51,55,60,None,Base +AutoAddHosts=false +AutoVCNS=No +DeployVUM=true +Adminpwd=VMware1! + +BuildDatastores=True +BuildVM=true +BuildOptions=True,False +ProductKey=XXXXX-XXXXX-XXXXX-XXXXX-XXXXX + +ViewInstall=None +ViewInstallOptions=50,51,52,53,60,None +BuildViewVM=true +ViewVMProductKey=XXXXX-XXXXX-XXXXX-XXXXX-XXXXX + +KMSIP=0.0.0.0 + diff --git a/Build/Automate/popbuild.sh b/Build/Automate/popbuild.sh new file mode 100644 index 0000000..63cf8b1 --- /dev/null +++ b/Build/Automate/popbuild.sh @@ -0,0 +1,42 @@ +#!/bin/sh + +mkdir /mnt/cd0 +mkdir /mnt/cd1 +mount /dev/sr0 /mnt/cd0 +mount /dev/sr1 /mnt/cd1 + +if [ -f "/mnt/LABVOL/Build/ESXi60/vmware-esx-base-readme" ] +then + echo "Already have ESXi 6.0 installer" +else + if [ -f "/mnt/cd0/vmware-esx-base-readme" ] + then + echo "Found ESXi installer on CD0" + cp -r /mnt/cd0/* /mnt/LABVOL/Build/ESXi60 + fi + if [ -f "/mnt/cd1/vmware-esx-base-readme" ] + then + echo "Found ESXi installer on CD1" + cp -r /mnt/cd1/* /mnt/LABVOL/Build/ESXi60 + fi +fi + +if [ -f "/mnt/LABVOL/Build/VIM_60/autorun.exe" ] +then + echo "Already have vCentre 6.0 installer" +else + if [ -f "/mnt/cd0/autorun.exe" ] + then + echo "Found vCentre installer on CD0" + cp -r /mnt/cd0/* /mnt/LABVOL/Build/VIM_60 + fi + if [ -f "/mnt/cd1/autorun.exe" ] + then + echo "Found vCentre installer on CD1" + cp -r /mnt/cd1/* /mnt/LABVOL/Build/VIM_60 + fi +fi +umount -f /dev/sr0 +umount -f /dev/sr1 + + diff --git a/Build/Automate/vCloud/vcd15-install b/Build/Automate/vCloud/vcd15-install new file mode 100644 index 0000000..9c4e37a --- /dev/null +++ b/Build/Automate/vCloud/vcd15-install @@ -0,0 +1,172 @@ +#!/bin/bash + +# vcd15-install Install vCloud Director 1.5 for AutoLab v1.1 +# +# vCloud Director Installation Script +# William Lam +# www.virtuallyghetto.com +# +# Damian Karlson +# www.damiankarlson.com +# www.labguides.com +# www.professionalvmware.com/brownbags +# +# chkconfig: 3 99 99 +# description: Automated vCloud Director installation on AutoLab + +#################### +# FILE DEFINITIONS # +#################### +# vCloud Director 1.5.x +VMWARE_VCD_BIN=`find /root/vmware-vcloud-director-1.5*.bin` +VCLOUD_VERSION=1.5.x + +##################### +# SECOND IP ADDRESS # +##################### +IP_ADDRESS_2=192.168.199.39 +IP_ADDRESS_2_NETMASK=255.255.255.0 + +################# +# KEYSTORE INFO # +################# +KEYSTORE_PASSWORD=vcloud +KEYSTORE_ORG_UNIT_NAME=AutoLab +KEYSTORE_ORG=AutoLab +KEYSTORE_CITY=AutoLab +KEYSTORE_STATE=AutoLab +KEYSTORE_COUNTRY=US + +################################ +# SQL 2008 R2 SP1 EXPRESS CONF # +################################ +SQL_VCLOUD_USERNAME=vcloud15 +SQL_VCLOUD_PASSWORD=VMware1! +SQL_VCLOUD_DATABASE=vCloud15 + +verify() { + if [ ${UID} -ne 0 ]; then + echo "Installer must run as root!" >> /root/vcd15-install.log + exit 1 + fi + if [ ! -f ${VMWARE_VCD_BIN} ]; then + echo "Unable to find ${VMWARE_VCD_BIN}!" >> /root/vcd15-install.log + exit 1 + fi + + echo "Proceeding with the installation of VMware vCD ${VCLOUD_VERSION}" >> /root/vcd15-install.log +} + +generateCertificates() { + HTTP_IP=$(grep IPADDR /etc/sysconfig/network-scripts/ifcfg-eth0 | awk -F "=" '{print $2}' | sed 's/"//g') + CONSOLEPROXY_IP=$(grep IPADDR /etc/sysconfig/network-scripts/ifcfg-eth1 | awk -F "=" '{print $2}' | sed 's/"//g') + HTTP_HOSTNAME=$(host ${HTTP_IP} | awk '{print $5}' | sed 's/.$//g') + CONSOLEPROXY_HOSTNAME=$(host ${CONSOLEPROXY_IP} | awk '{print $5}' | sed 's/.$//g') + + if [ ! -f /opt/keystore/certificates.ks ]; then + echo "Creating keystore certificate for http using ${HTTP_HOSTNAME}" >> /root/vcd15-install.log + keytool -keystore certificates.ks -storetype JCEKS -storepass ${KEYSTORE_PASSWORD} -keypass ${KEYSTORE_PASSWORD} -genkey -keyalg RSA -alias http -dname "CN=${HTTP_HOSTNAME}, OU=${KEYSTORE_ORG_UNIT_NAME}, O=${KEYSTORE_ORG}, L=${KEYSTORE_CITY},S=${KEYSTORE_STATE}, C=${KEYSTORE_COUNTRY}" 2>&1 >> /root/vcd15-install.log + keytool -keystore certificates.ks -storetype JCEKS -storepass ${KEYSTORE_PASSWORD} -keypass ${KEYSTORE_PASSWORD} -certreq -alias http -file http.csr 2>&1 >> /root/vcd15-install.log + + echo "Creating keystore certificate for consoleproxy using ${CONSOLEPROXY_HOSTNAME}" >> /root/vcd15-install.log + keytool -keystore certificates.ks -storetype JCEKS -storepass ${KEYSTORE_PASSWORD} -keypass ${KEYSTORE_PASSWORD} -genkey -keyalg RSA -alias consoleproxy -dname "CN=${HTTP_HOSTNAME}, OU=${KEYSTORE_ORG_UNIT_NAME}, O=${KEYSTORE_ORG}, L=${KEYSTORE_CITY},S=${KEYSTORE_STATE}, C=${KEYSTORE_COUNTRY}" 2>&1 >> /root/vcd15-install.log + keytool -keystore certificates.ks -storetype JCEKS -storepass ${KEYSTORE_PASSWORD} -keypass ${KEYSTORE_PASSWORD} -certreq -alias consoleproxy -file consoleproxy.csr 2>&1 >> /root/vcd15-install.log + + echo "Moving certificates.ks to /opt/keystore" >> /root/vcd15-install.log + if [ -f certificates.ks ]; then + mkdir -p /opt/keystore + mv certificates.ks /opt/keystore + else + echo "Error! Unable to locate certificates.ks in current working directory, certificates may not have been generated correctly!" >> /root/vcd15-install.log + fi + else + echo "Looks like /opt/keystore/certificates.ks exists already! Will not generate vCD keystores!" >> /root/vcd15-install.log + fi +} + +installvCD() { + VCD_INSTALL_RESPONSE_FILE=/tmp/vcd15-install-$$.response + + rpm -qa | grep -i "vmware-vcloud-director" > /dev/null 2>&1 + if [ $? -eq 1 ]; then + echo "Installing VMware vCloud Director ${VCLOUD_VERSION}" >> /root/vcd15-install.log + cat > ${VCD_INSTALL_RESPONSE_FILE} << __VCD_INSTALL__ +y +n +__VCD_INSTALL__ + + chmod u+x ${VMWARE_VCD_BIN} + ${VMWARE_VCD_BIN} < ${VCD_INSTALL_RESPONSE_FILE} 2>&1 >> /root/vcd15-install.log + + rm -f ${VCD_INSTALL_RESPONSE_FILE} + else + echo "VMware vCloud Director ${VCLOUD_VERSION} is already installed!" >> /root/vcd15-install.log + fi + } + +configurevCD() { + VCD_CONFIG_RESPONSE_FILE=/tmp/vcd-configure-$$.response + VCD_PATH=/opt/vmware/vcloud-director + + cat > ${VCD_CONFIG_RESPONSE_FILE} << __VCD_CONFIGURE__ +1 +1 +/opt/keystore/certificates.ks +${KEYSTORE_PASSWORD} + +2 +192.168.199.4 +1433 +${SQL_VCLOUD_DATABASE} + +${SQL_VCLOUD_USERNAME} +${SQL_VCLOUD_PASSWORD} +y +__VCD_CONFIGURE__ + + service vmware-vcd status > /dev/null 2>&1 + if [ $? -eq 0 ]; then + service vmware-vcd stop + fi + echo "Configuring vCloud Director" >> /root/vcd15-install.log + ${VCD_PATH}/bin/configure < ${VCD_CONFIG_RESPONSE_FILE} + + rm -f ${VCD_CONFIG_RESPONSE_FILE} + + echo "Completed installation of vCloud Director!" >> /root/vcd15-install.log + echo "Starting vCloud Director" >> /root/vcd15-install.log + ${VCD_PATH}/bin/vmware-vcd start + echo "Waiting for vCloud Director to finish initialization" >> /root/vcd15-install.log + VCD_START_SUCCESS=0 + VCD_START_COUNT=0 + VCD_START_MAX_COUNT=24 + while [ 1 ]; + do + grep -i "Application Initialization: Complete" ${VCD_PATH}/logs/vcloud-container-info.log > /dev/null 2>&1 + if [ $? -eq 0 ]; then + echo "vCloud Director is up and running! You can now go to https://${HTTP_HOSTNAME}" >> /root/vcd15-install.log + break + else + if [ ${VCD_START_COUNT} = ${VCD_START_MAX_COUNT} ]; then + echo "Unable to start vCloud Director, something went wrong! Please take a look at ${VCD_PATH}/logs/vcloud-container-info.log for more info" >> /root/vcd15-install.log + break + fi + VCD_START_COUNT=$((VCD_START_COUNT+1)) + sleep 5 + fi + done +} + +case "$1" in + start) + verify + generateCertificates + installvCD + configurevCD + chkconfig vcd15-install off + ;; + stop|status|restart|reload|force-reload) + # do nothing + ;; +esac +exit \ No newline at end of file diff --git a/Build/Automate/vCloud/vcd15-ks-min.cfg b/Build/Automate/vCloud/vcd15-ks-min.cfg new file mode 100644 index 0000000..80087f5 --- /dev/null +++ b/Build/Automate/vCloud/vcd15-ks-min.cfg @@ -0,0 +1,82 @@ +#version=DEVEL +install +text +url --url http://mirrors.kernel.org/centos/6.3/os/x86_64/ +lang en_US.UTF-8 +keyboard us +skipx +reboot +network --onboot yes --device eth0 --bootproto static --ip 192.168.199.38 --netmask 255.255.255.0 --gateway 192.168.199.2 --noipv6 --nameserver 192.168.199.4 --hostname vcd.lab.local --activate +network --onboot yes --device eth1 --bootproto static --ip 192.168.199.39 --netmask 255.255.255.0 --gateway 192.168.199.2 --noipv6 --nameserver 192.168.199.4 --hostname vcd.lab.local --activate +rootpw --iscrypted $6$mhXX4f4VoZQd17Zi$92QTGG0zjyPpybH/AeSEKZKELgh5a/gvJZUZDa3kxmbij.QKLHHCWXdBJOur.qxeq0EfARQf7bewzujFYRhsp. +firewall --disabled +authconfig --enableshadow --passalgo=sha512 +selinux --disabled +timezone --utc America/Chicago +bootloader --location=mbr --driveorder=sda +zerombr +clearpart --all --initlabel --drives=sda +part /boot --fstype=ext4 --asprimary --size=200 +part / --fstype=ext4 --asprimary --size=10240 +part swap --asprimary --size=4608 + +%packages +-firmware* +-openfwwf* +nfs-utils +libICE +libSM +libXdmcp +libXt +libXtst +redhat-lsb +java-1.6.0-openjdk +%end + +%post --log=/root/anaconda_post.log +ifdown eth0 +ifup eth0 +ping -c 4 google.com > /dev/null 2>&1 +if [ $? -eq 0 ]; then + echo "External network connection is available!" >> /root/anaconda_post.log + yum -y update + wget http://packages.vmware.com/tools/keys/VMWARE-PACKAGING-GPG-DSA-KEY.pub + wget http://packages.vmware.com/tools/keys/VMWARE-PACKAGING-GPG-RSA-KEY.pub + rpm --import VMWARE-PACKAGING-GPG-DSA-KEY.pub + rpm --import VMWARE-PACKAGING-GPG-RSA-KEY.pub +else + echo "External network connection is not available. Skipping operating system updates & VMware RPM key download." >> /root/anaconda_post.log + +fi +sed -i "s/\b quiet\b//g" /boot/grub/grub.conf +sed -i "s/\b rhgb\b//g" /boot/grub/grub.conf +echo 'DOMAIN="lab.local"' >> /etc/sysconfig/network-scripts/ifcfg-eth0 +echo 'DOMAIN="lab.local"' >> /etc/sysconfig/network-scripts/ifcfg-eth1 +%end + +%post +service rpcbind start +mkdir /mnt/tmp +mount -t nfs 192.168.199.7:/mnt/LABVOL/Build /mnt/tmp +if [ $? -eq 0 ]; then + echo "Mounted AutoLab Build share to /mnt/tmp" >> /root/anaconda_post.log + cp /mnt/tmp/Automate/vCloud/vcd15-install /etc/init.d + chmod 755 /etc/init.d/vcd15-install + cp /mnt/tmp/vCD_15/vmware-vcloud-director-1.5*.bin /root/ + chmod +x /root/vmware-vcloud-director-1.5*.bin + echo "Copied vCloud 1.5 installation script and binary installer to /root/." +fi +sed -ie 's/^SELINUX=.*/SELINUX=disabled/g' /etc/selinux/config +chkconfig atd off +chkconfig cpuspeed off +chkconfig cups off +chkconfig ip6tables off +chkconfig iptables off +chkconfig kdump off +chkconfig lvm2-monitor off +chkconfig mdmonitor off +chkconfig ntpd on +chkconfig postfix off +chkconfig smartd off +chkconfig vcd15-install on +%end \ No newline at end of file diff --git a/Build/Automate/vCloud/vcd15-ks.cfg b/Build/Automate/vCloud/vcd15-ks.cfg new file mode 100644 index 0000000..7cbf4f1 --- /dev/null +++ b/Build/Automate/vCloud/vcd15-ks.cfg @@ -0,0 +1,82 @@ +#version=DEVEL +install +text +cdrom +lang en_US.UTF-8 +keyboard us +skipx +reboot +network --onboot yes --device eth0 --bootproto static --ip 192.168.199.38 --netmask 255.255.255.0 --gateway 192.168.199.2 --noipv6 --nameserver 192.168.199.4 --hostname vcd.lab.local --activate +network --onboot yes --device eth1 --bootproto static --ip 192.168.199.39 --netmask 255.255.255.0 --gateway 192.168.199.2 --noipv6 --nameserver 192.168.199.4 --hostname vcd.lab.local --activate +rootpw --iscrypted $6$mhXX4f4VoZQd17Zi$92QTGG0zjyPpybH/AeSEKZKELgh5a/gvJZUZDa3kxmbij.QKLHHCWXdBJOur.qxeq0EfARQf7bewzujFYRhsp. +firewall --disabled +authconfig --enableshadow --passalgo=sha512 +selinux --disabled +timezone --utc America/Chicago +bootloader --location=mbr --driveorder=sda +zerombr +clearpart --all --initlabel --drives=sda +part /boot --fstype=ext4 --asprimary --size=200 +part / --fstype=ext4 --asprimary --size=10240 +part swap --asprimary --size=4608 + +%packages +-firmware* +-openfwwf* +nfs-utils +libICE +libSM +libXdmcp +libXt +libXtst +redhat-lsb +java-1.6.0-openjdk +%end + +%post --log=/root/anaconda_post.log +ifdown eth0 +ifup eth0 +ping -c 4 google.com > /dev/null 2>&1 +if [ $? -eq 0 ]; then + echo "External network connection is available!" >> /root/anaconda_post.log + yum -y update + wget http://packages.vmware.com/tools/keys/VMWARE-PACKAGING-GPG-DSA-KEY.pub + wget http://packages.vmware.com/tools/keys/VMWARE-PACKAGING-GPG-RSA-KEY.pub + rpm --import VMWARE-PACKAGING-GPG-DSA-KEY.pub + rpm --import VMWARE-PACKAGING-GPG-RSA-KEY.pub +else + echo "External network connection is not available. Skipping operating system updates & VMware RPM key download." >> /root/anaconda_post.log + +fi +sed -i "s/\b quiet\b//g" /boot/grub/grub.conf +sed -i "s/\b rhgb\b//g" /boot/grub/grub.conf +echo 'DOMAIN="lab.local"' >> /etc/sysconfig/network-scripts/ifcfg-eth0 +echo 'DOMAIN="lab.local"' >> /etc/sysconfig/network-scripts/ifcfg-eth1 +%end + +%post +service rpcbind start +mkdir /mnt/tmp +mount -t nfs 192.168.199.7:/mnt/LABVOL/Build /mnt/tmp +if [ $? -eq 0 ]; then + echo "Mounted AutoLab Build share to /mnt/tmp" >> /root/anaconda_post.log + cp /mnt/tmp/Automate/vCloud/vcd15-install /etc/init.d + chmod 755 /etc/init.d/vcd15-install + cp /mnt/tmp/vCD_15/vmware-vcloud-director-1.5*.bin /root/ + chmod +x /root/vmware-vcloud-director-1.5*.bin + echo "Copied vCloud 1.5 installation script and binary installer to /root/." +fi +sed -ie 's/^SELINUX=.*/SELINUX=disabled/g' /etc/selinux/config +chkconfig atd off +chkconfig cpuspeed off +chkconfig cups off +chkconfig ip6tables off +chkconfig iptables off +chkconfig kdump off +chkconfig lvm2-monitor off +chkconfig mdmonitor off +chkconfig ntpd on +chkconfig postfix off +chkconfig smartd off +chkconfig vcd15-install on +%end \ No newline at end of file diff --git a/Build/Automate/vCloud/vcd51-install b/Build/Automate/vCloud/vcd51-install new file mode 100644 index 0000000..2af8428 --- /dev/null +++ b/Build/Automate/vCloud/vcd51-install @@ -0,0 +1,172 @@ +#!/bin/bash + +# vcd51-install Install vCloud Director 5.1 for AutoLab v1.1 +# +# vCloud Director Installation Script +# William Lam +# www.virtuallyghetto.com +# +# Damian Karlson +# www.damiankarlson.com +# www.labguides.com +# www.professionalvmware.com/brownbags +# +# chkconfig: 3 99 99 +# description: Automated vCloud Director installation on AutoLab + +#################### +# FILE DEFINITIONS # +#################### +# vCloud Director 5.1.x +VMWARE_VCD_BIN=`find /root/vmware-vcloud-director-5.1*.bin` +VCLOUD_VERSION=5.1.x + +##################### +# SECOND IP ADDRESS # +##################### +IP_ADDRESS_2=192.168.199.39 +IP_ADDRESS_2_NETMASK=255.255.255.0 + +################# +# KEYSTORE INFO # +################# +KEYSTORE_PASSWORD=vcloud +KEYSTORE_ORG_UNIT_NAME=AutoLab +KEYSTORE_ORG=AutoLab +KEYSTORE_CITY=AutoLab +KEYSTORE_STATE=AutoLab +KEYSTORE_COUNTRY=US + +################################ +# SQL 2008 R2 SP1 EXPRESS CONF # +################################ +SQL_VCLOUD_USERNAME=vcloud51 +SQL_VCLOUD_PASSWORD=VMware1! +SQL_VCLOUD_DATABASE=vCloud51 + +verify() { + if [ ${UID} -ne 0 ]; then + echo "Installer must run as root!" >> /root/vcd51-install.log + exit 1 + fi + if [ ! -f ${VMWARE_VCD_BIN} ]; then + echo "Unable to find ${VMWARE_VCD_BIN}!" >> /root/vcd51-install.log + exit 1 + fi + + echo "Proceeding with the installation of VMware vCD ${VCLOUD_VERSION}" >> /root/vcd51-install.log +} + +generateCertificates() { + HTTP_IP=$(grep IPADDR /etc/sysconfig/network-scripts/ifcfg-eth0 | awk -F "=" '{print $2}' | sed 's/"//g') + CONSOLEPROXY_IP=$(grep IPADDR /etc/sysconfig/network-scripts/ifcfg-eth1 | awk -F "=" '{print $2}' | sed 's/"//g') + HTTP_HOSTNAME=$(host ${HTTP_IP} | awk '{print $5}' | sed 's/.$//g') + CONSOLEPROXY_HOSTNAME=$(host ${CONSOLEPROXY_IP} | awk '{print $5}' | sed 's/.$//g') + + if [ ! -f /opt/keystore/certificates.ks ]; then + echo "Creating keystore certificate for http using ${HTTP_HOSTNAME}" >> /root/vcd51-install.log + keytool -keystore certificates.ks -storetype JCEKS -storepass ${KEYSTORE_PASSWORD} -keypass ${KEYSTORE_PASSWORD} -genkey -keyalg RSA -alias http -dname "CN=${HTTP_HOSTNAME}, OU=${KEYSTORE_ORG_UNIT_NAME}, O=${KEYSTORE_ORG}, L=${KEYSTORE_CITY},S=${KEYSTORE_STATE}, C=${KEYSTORE_COUNTRY}" 2>&1 >> /root/vcd51-install.log + keytool -keystore certificates.ks -storetype JCEKS -storepass ${KEYSTORE_PASSWORD} -keypass ${KEYSTORE_PASSWORD} -certreq -alias http -file http.csr 2>&1 >> /root/vcd51-install.log + + echo "Creating keystore certificate for consoleproxy using ${CONSOLEPROXY_HOSTNAME}" + keytool -keystore certificates.ks -storetype JCEKS -storepass ${KEYSTORE_PASSWORD} -keypass ${KEYSTORE_PASSWORD} -genkey -keyalg RSA -alias consoleproxy -dname "CN=${HTTP_HOSTNAME}, OU=${KEYSTORE_ORG_UNIT_NAME}, O=${KEYSTORE_ORG}, L=${KEYSTORE_CITY},S=${KEYSTORE_STATE}, C=${KEYSTORE_COUNTRY}" 2>&1 >> /root/vcd51-install.log + keytool -keystore certificates.ks -storetype JCEKS -storepass ${KEYSTORE_PASSWORD} -keypass ${KEYSTORE_PASSWORD} -certreq -alias consoleproxy -file consoleproxy.csr 2>&1 >> /root/vcd51-install.log + + echo "Moving certificates.ks to /opt/keystore" >> /root/vcd51-install.log + if [ -f certificates.ks ]; then + mkdir -p /opt/keystore + mv certificates.ks /opt/keystore + else + echo "Error! Unable to locate certificates.ks in current working directory, certificates may not have been generated correctly!" >> /root/vcd51-install.log + fi + else + echo "Looks like /opt/keystore/certificates.ks exists already! Will not generate vCD keystores!" >> /root/vcd51-install.log + fi +} + +installvCD() { + VCD_INSTALL_RESPONSE_FILE=/tmp/vcd51-install-$$.response + + rpm -qa | grep -i "vmware-vcloud-director" > /dev/null 2>&1 + if [ $? -eq 1 ]; then + echo "Installing VMware vCloud Director ${VCLOUD_VERSION}" >> /root/vcd51-install.log + cat > ${VCD_INSTALL_RESPONSE_FILE} << __VCD_INSTALL__ +y +n +__VCD_INSTALL__ + + chmod u+x ${VMWARE_VCD_BIN} + ${VMWARE_VCD_BIN} < ${VCD_INSTALL_RESPONSE_FILE} 2>&1 >> /root/vcd51-install.log + + rm -f ${VCD_INSTALL_RESPONSE_FILE} + else + echo "VMware vCloud Director ${VCLOUD_VERSION} is already installed!" >> /root/vcd51-install.log + fi + } + +configurevCD() { + VCD_CONFIG_RESPONSE_FILE=/tmp/vcd-configure-$$.response + VCD_PATH=/opt/vmware/vcloud-director + + cat > ${VCD_CONFIG_RESPONSE_FILE} << __VCD_CONFIGURE__ +1 +1 +/opt/keystore/certificates.ks +${KEYSTORE_PASSWORD} + +2 +192.168.199.4 +1433 +${SQL_VCLOUD_DATABASE} + +${SQL_VCLOUD_USERNAME} +${SQL_VCLOUD_PASSWORD} +y +__VCD_CONFIGURE__ + + service vmware-vcd status > /dev/null 2>&1 + if [ $? -eq 0 ]; then + service vmware-vcd stop + fi + echo "Configuring vCloud Director" >> /root/vcd51-install.log + ${VCD_PATH}/bin/configure < ${VCD_CONFIG_RESPONSE_FILE} + + rm -f ${VCD_CONFIG_RESPONSE_FILE} + + echo "Completed installation of vCloud Director!" >> /root/vcd51-install.log + echo "Starting vCloud Director" >> /root/vcd51-install.log + ${VCD_PATH}/bin/vmware-vcd start + echo "Waiting for vCloud Director to finish initialization" >> /root/vcd51-install.log + VCD_START_SUCCESS=0 + VCD_START_COUNT=0 + VCD_START_MAX_COUNT=24 + while [ 1 ]; + do + grep -i "Application Initialization: Complete" ${VCD_PATH}/logs/vcloud-container-info.log > /dev/null 2>&1 + if [ $? -eq 0 ]; then + echo "vCloud Director is up and running! You can now go to https://${HTTP_HOSTNAME}" >> /root/vcd51-install.log + break + else + if [ ${VCD_START_COUNT} = ${VCD_START_MAX_COUNT} ]; then + echo "Unable to start vCloud Director, something went wrong! Please take a look at ${VCD_PATH}/logs/vcloud-container-info.log for more info" >> /root/vcd51-install.log + break + fi + VCD_START_COUNT=$((VCD_START_COUNT+1)) + sleep 5 + fi + done +} + +case "$1" in + start) + verify + generateCertificates + installvCD + configurevCD + chkconfig vcd51-install off + ;; + stop|status|restart|reload|force-reload) + # do nothing + ;; +esac +exit \ No newline at end of file diff --git a/Build/Automate/vCloud/vcd51-ks-min.cfg b/Build/Automate/vCloud/vcd51-ks-min.cfg new file mode 100644 index 0000000..65d2a7c --- /dev/null +++ b/Build/Automate/vCloud/vcd51-ks-min.cfg @@ -0,0 +1,82 @@ +#version=DEVEL +install +text +url --url http://mirrors.kernel.org/centos/6.3/os/x86_64/ +lang en_US.UTF-8 +keyboard us +skipx +reboot +network --onboot yes --device eth0 --bootproto static --ip 192.168.199.38 --netmask 255.255.255.0 --gateway 192.168.199.2 --noipv6 --nameserver 192.168.199.4 --hostname vcd.lab.local --activate +network --onboot yes --device eth1 --bootproto static --ip 192.168.199.39 --netmask 255.255.255.0 --gateway 192.168.199.2 --noipv6 --nameserver 192.168.199.4 --hostname vcd.lab.local --activate +rootpw --iscrypted $6$mhXX4f4VoZQd17Zi$92QTGG0zjyPpybH/AeSEKZKELgh5a/gvJZUZDa3kxmbij.QKLHHCWXdBJOur.qxeq0EfARQf7bewzujFYRhsp. +firewall --disabled +authconfig --enableshadow --passalgo=sha512 +selinux --disabled +timezone --utc America/Chicago +bootloader --location=mbr --driveorder=sda +zerombr +clearpart --all --initlabel --drives=sda +part /boot --fstype=ext4 --asprimary --size=200 +part / --fstype=ext4 --asprimary --size=10240 +part swap --asprimary --size=4608 + +%packages +-firmware* +-openfwwf* +nfs-utils +libICE +libSM +libXdmcp +libXt +libXtst +redhat-lsb +java-1.6.0-openjdk +%end + +%post --log=/root/anaconda_post.log +ifdown eth0 +ifup eth0 +ping -c 4 google.com > /dev/null 2>&1 +if [ $? -eq 0 ]; then + echo "External network connection is available!" >> /root/anaconda_post.log + yum -y update + wget http://packages.vmware.com/tools/keys/VMWARE-PACKAGING-GPG-DSA-KEY.pub + wget http://packages.vmware.com/tools/keys/VMWARE-PACKAGING-GPG-RSA-KEY.pub + rpm --import VMWARE-PACKAGING-GPG-DSA-KEY.pub + rpm --import VMWARE-PACKAGING-GPG-RSA-KEY.pub +else + echo "External network connection is not available. Skipping operating system updates & VMware RPM key download." >> /root/anaconda_post.log + +fi +sed -i "s/\b quiet\b//g" /boot/grub/grub.conf +sed -i "s/\b rhgb\b//g" /boot/grub/grub.conf +echo 'DOMAIN="lab.local"' >> /etc/sysconfig/network-scripts/ifcfg-eth0 +echo 'DOMAIN="lab.local"' >> /etc/sysconfig/network-scripts/ifcfg-eth1 +%end + +%post +service rpcbind start +mkdir /mnt/tmp +mount -t nfs 192.168.199.7:/mnt/LABVOL/Build /mnt/tmp +if [ $? -eq 0 ]; then + echo "Mounted AutoLab Build share to /mnt/tmp" >> /root/anaconda_post.log + cp /mnt/tmp/Automate/vCloud/vcd51-install /etc/init.d + chmod 755 /etc/init.d/vcd51-install + cp /mnt/tmp/vCD_51/vmware-vcloud-director-5.1*.bin /root/ + chmod +x /root/vmware-vcloud-director-5.1*.bin + echo "Copied vCloud 5.1 installation script and binary installer to /root/." +fi +sed -ie 's/^SELINUX=.*/SELINUX=disabled/g' /etc/selinux/config +chkconfig atd off +chkconfig cpuspeed off +chkconfig cups off +chkconfig ip6tables off +chkconfig iptables off +chkconfig kdump off +chkconfig lvm2-monitor off +chkconfig mdmonitor off +chkconfig ntpd on +chkconfig postfix off +chkconfig smartd off +chkconfig vcd51-install on +%end \ No newline at end of file diff --git a/Build/Automate/vCloud/vcd51-ks.cfg b/Build/Automate/vCloud/vcd51-ks.cfg new file mode 100644 index 0000000..2c01090 --- /dev/null +++ b/Build/Automate/vCloud/vcd51-ks.cfg @@ -0,0 +1,82 @@ +#version=DEVEL +install +text +cdrom +lang en_US.UTF-8 +keyboard us +skipx +reboot +network --onboot yes --device eth0 --bootproto static --ip 192.168.199.38 --netmask 255.255.255.0 --gateway 192.168.199.2 --noipv6 --nameserver 192.168.199.4 --hostname vcd.lab.local --activate +network --onboot yes --device eth1 --bootproto static --ip 192.168.199.39 --netmask 255.255.255.0 --gateway 192.168.199.2 --noipv6 --nameserver 192.168.199.4 --hostname vcd.lab.local --activate +rootpw --iscrypted $6$mhXX4f4VoZQd17Zi$92QTGG0zjyPpybH/AeSEKZKELgh5a/gvJZUZDa3kxmbij.QKLHHCWXdBJOur.qxeq0EfARQf7bewzujFYRhsp. +firewall --disabled +authconfig --enableshadow --passalgo=sha512 +selinux --disabled +timezone --utc America/Chicago +bootloader --location=mbr --driveorder=sda +zerombr +clearpart --all --initlabel --drives=sda +part /boot --fstype=ext4 --asprimary --size=200 +part / --fstype=ext4 --asprimary --size=10240 +part swap --asprimary --size=4608 + +%packages +-firmware* +-openfwwf* +nfs-utils +libICE +libSM +libXdmcp +libXt +libXtst +redhat-lsb +java-1.6.0-openjdk +%end + +%post --log=/root/anaconda_post.log +ifdown eth0 +ifup eth0 +ping -c 4 google.com > /dev/null 2>&1 +if [ $? -eq 0 ]; then + echo "External network connection is available!" >> /root/anaconda_post.log + yum -y update + wget http://packages.vmware.com/tools/keys/VMWARE-PACKAGING-GPG-DSA-KEY.pub + wget http://packages.vmware.com/tools/keys/VMWARE-PACKAGING-GPG-RSA-KEY.pub + rpm --import VMWARE-PACKAGING-GPG-DSA-KEY.pub + rpm --import VMWARE-PACKAGING-GPG-RSA-KEY.pub +else + echo "External network connection is not available. Skipping operating system updates & VMware RPM key download." >> /root/anaconda_post.log + +fi +sed -i "s/\b quiet\b//g" /boot/grub/grub.conf +sed -i "s/\b rhgb\b//g" /boot/grub/grub.conf +echo 'DOMAIN="lab.local"' >> /etc/sysconfig/network-scripts/ifcfg-eth0 +echo 'DOMAIN="lab.local"' >> /etc/sysconfig/network-scripts/ifcfg-eth1 +%end + +%post +service rpcbind start +mkdir /mnt/tmp +mount -t nfs 192.168.199.7:/mnt/LABVOL/Build /mnt/tmp +if [ $? -eq 0 ]; then + echo "Mounted AutoLab Build share to /mnt/tmp" >> /root/anaconda_post.log + cp /mnt/tmp/Automate/vCloud/vcd51-install /etc/init.d + chmod 755 /etc/init.d/vcd51-install + cp /mnt/tmp/vCD_51/vmware-vcloud-director-5.1*.bin /root/ + chmod +x /root/vmware-vcloud-director-5.1*.bin + echo "Copied vCloud 5.1 installation script and binary installer to /root/." +fi +sed -ie 's/^SELINUX=.*/SELINUX=disabled/g' /etc/selinux/config +chkconfig atd off +chkconfig cpuspeed off +chkconfig cups off +chkconfig ip6tables off +chkconfig iptables off +chkconfig kdump off +chkconfig lvm2-monitor off +chkconfig mdmonitor off +chkconfig ntpd on +chkconfig postfix off +chkconfig smartd off +chkconfig vcd51-install on +%end \ No newline at end of file diff --git a/Build/Automate/vShield15.ps1 b/Build/Automate/vShield15.ps1 new file mode 100644 index 0000000..eddc300 --- /dev/null +++ b/Build/Automate/vShield15.ps1 @@ -0,0 +1,215 @@ +# Script to add add VMware vShield Manager to the AutoLab infrastructure +# +# Thanks to Alan Renouf (http://www.virtu-al.net/2011/09/14/powershell-automated-install-of-vshield-5/) +# Thanks to Jeff Hicks for the Test-Website Function: http://jdhitsolutions.com/blog/2010/04/hey-are-you-awake/ +# Thanks to William Lam for the trick to change the Zebra file: http://www.virtuallyghetto.com/2011/09/how-to-automate-deployment.html +# AutoLab v1.1 +# +# +. "C:\PSFunctions.ps1" +Function New-ZebraFile ($vShieldHostName, $vShieldIP, $vShieldID, $vShieldGW) { +$ZebraFile = @" +! +hostname $vShieldHostName +! +interface mgmt + ip address $vShieldIP/$vShieldID +! +ip route 0.0.0.0/0 $vShieldGW +! +line vty + no login +! +"@ + +$ZebraFile | Out-File $ENV:TEMP\zebra.conf -Encoding "ASCII" +} +Function Post-vShieldAPI ($URL, $Body) { + $wc = New-Object System.Net.WebClient + + # Add Authorization headers + $authbytes = [System.Text.Encoding]::ASCII.GetBytes($vshieldUser + ":" + $vShieldPass) + $base64 = [System.Convert]::ToBase64String($authbytes) + $authorization = "Authorization: Basic " + $base64 + $wc.Headers.Add($authorization) + + $response = $wc.UploadString($URL, "POST", $Body) +} +Function Set-vShieldConfiguration ($vCenter, $Username, $Password, $PrimaryDNS, $SecondaryDNS) { + $Body = @" +<vsmGlobalConfig xmlns="vmware.vshield.edge.2.0"> +<dnsInfo> +<primaryDns>$($PrimaryDNS)</primaryDns> +<secondaryDns>$($SecondaryDNS)</secondaryDns> +</dnsInfo> +</vsmGlobalConfig> +"@ + Post-vShieldAPI -URL "https://$vShieldIP/api/2.0/global/config" -Body $Body +} +Function Wait-vShieldBoot { + do { + $VM = Get-VM $vShieldHostName + Sleep 5 + } until ($VM.ToolsStatus -eq "toolsOK") +} +Function Test-WebSite { + [cmdletBinding()] + Param ( + [Parameter( + ValueFromPipeline=$True,Position=0,Mandatory=$True, + HelpMessage="The URL to test. Include http:// or https://")] + [string]$url + ) + + Begin { + CS2 "Begin function" + } + Process { + CS2 "Requesting $url" + + $wr=[system.net.webrequest]::Create($url) + #set timeout to 7 seconds + $wr.Timeout=7000 + $start=Get-Date + + Try { + $response=$wr.GetResponse() + if ($response) { + CS2 "Response returned" + $Status=$response.StatusCode + $StatusCode=($response.Statuscode -as [int]) + } + } + Catch [system.net.webexception] { + CS2 "Failed to get a response from $url" + $status = $_.Exception.Response.StatusCode + $statuscode = ( $_.Exception.Response.StatusCode -as [int]) + } + + $end=Get-Date + $timespan=$end-$start + $ResponseMS=$timespan.TotalMilliseconds + + CS2 "status is $status" + CS2 "statuscode is $statuscode" + CS2 "timer is $responseMS" + + $obj=New-Object PSObject -Property @{ + DateTime=$start + URL=$url + Status=$status + StatusCode=$statuscode + ResponseMS=$ResponseMS + } + Write-Output $obj + + } #end Process + End { + CS2 "End function" + } +} +Function Wait-vShieldWebsite { + do { + $web = test-website https://$vShieldIP + Sleep 5 + } until ($Web.Status -eq "OK") +} + +if ( (Get-PSSnapin -Name VMware.VimAutomation.Core -ErrorAction SilentlyContinue) -eq $null ) +{ + try { + Write-Host "Loading PowerCLI plugin, this will take a little while" -foregroundcolor "cyan" + Add-PsSnapin VMware.VimAutomation.Core + } + catch { + Write-Host "Unable to load the PowerCLI plugin. Please verify installation and run this script again." + exit + } +} +#$null = Set-PowerCLIConfiguration -DisplayDeprecationWarnings:$false -InvalidCertificateAction Ignore -Confirm:$false +for ($i=1;$i -le 2; $i++){ + $vmhost = "host$i.lab.local" + $ping = new-object System.Net.NetworkInformation.Ping + $Reply = $ping.send($vmhost) + if ($Reply.status –ne "Success") { + Write-Host $vmhost " not responding to ping, exiting" -foregroundcolor "red" + Write-Host "Re-run this script when both ESXi hosts are running" -foregroundcolor "red" + exit + } +} +$vShieldHostName = "vShield" +$vShieldFQDN = "vshield.lab.local" +$vShieldCluster = "Local" +$vShieldIP = "192.168.199.40" +$vShieldID = "24" +$vShieldGW = "192.168.199.2" +$vShieldPrimaryDNS = "192.168.199.4" +$vShieldSecondaryDNS = "192.168.199.4" +$vShieldUser = "admin" +$vShieldPass = "default" +$vCenter = "192.168.199.5" +$vcUsername = "Lab\vi-admin" +$vcPass = "VMware1!" +$Newproperty = New-VIProperty -Name ToolsStatus -ObjectType VirtualMachine -Value { + param($vm) + $vm.ExtensionData.Guest.ToolsStatus +} -Force + +Write-Host "Connecting to vCenter" +try { + $Connect = Connect-VIServer -Server $vCenter -User $vcUsername -Password $vcPass -ErrorAction Stop + $VMhost = Get-Cluster $vShieldCluster | Get-VMHost | Select -First 1 +} +catch { + Write-Host "Unable to connect to to $vCenter. Exiting." + exit +} +# Work out which iSCSI datastore has the most free space +$vShieldDS = Get-Datastore -name iSCSI* | Select Name, FreeSpaceGB | Sort-Object -Property FreeSpaceGB | Select-Object -First 1 + +if (Test-Path "\\192.168.199.7\Build\vCD_15\VMware-vShield-Manager-5.0.*.ova") { + $vshieldOVA = (Get-ChildItem \\192.168.199.7\Build\vCD_15\VMware-vShield-Manager-5.0.*.ova).FullName + Write-Host "Importing the vShield OVA" + try { + $va = Import-VApp -Name $vShieldHostName -Datastore $vShieldDS.Name -VMHost $VMHost -Source $vshieldOVA -ErrorAction Stop + $null = Get-VM $vShieldHostName | Set-VM -MemoryMB 512 -Confirm:$false + $null = Get-VMResourceConfiguration -VM $vShieldHostName | Set-VMResourceConfiguration -MemReservationMB 0 + Write-Host "Starting the vShield VM" + $Start = Start-VM $vShieldHostName -Confirm:$false + Wait-vShieldBoot + Write-Host "vShield Manager import complete." + } + catch { + write-host "Unable to import vShield. Exiting." + exit + } +} else { + Write-Host "vShield OVA not found. Please copy the file to the Build share and try again." +} + +### Commented out due to issues with vShield VM authentication during Invoke-VMScript +# Write-Host "Waiting until the vShield VM has started" +# Wait-vShieldBoot +# Write-Host "Setting the initial IP address after boot" +# $Zebrafile = New-Zebrafile -vShieldHostName $vShieldFQDN -vShieldIP $vShieldIP -vShieldID $vShieldID -vShieldGW $vShieldGW +# $Password = ConvertTo-SecureString -AsPlainText $vShieldPass -Force +# $cred = new-object -typename System.Management.Automation.PSCredential -argumentlist "admin", $Password + +# $invoke = Invoke-VMScript -VM vShield -ScriptText "mv /common/configs/cli/zebra.conf /common/configs/cli/zebra.conf.bak" -ScriptType Bash -GuestCredential $cred +# $ReIP = Copy-VMGuestFile -VM $vShieldHostName -Source $ENV:TEMP\zebra.conf -Destination "/common/configs/cli/" -LocalToGuest -GuestUser $vShieldUser -GuestPassword $vShieldPass + +# Write-Host "Powering Off the vShield VM" +# Sleep 5 +# $Stop = Stop-VM $vShieldHostName -Confirm:$false +# Write-Host "Starting the vShield VM" +# $Start = Start-VM $vShieldHostName -Confirm:$false + +# Write-Host "Waiting until the vShield VM has started" +# Wait-vShieldBoot + +# Write-Host "Waiting until the vShield Management site has started" +# Wait-vShieldWebsite + +# Write-Host "Linking vShield to vCenter and set DNS entries" +# $SetIP = Set-vShieldConfiguration -vCenter $vCenter -Username $vcUsername -Password $vcPass -PrimaryDNS $vShieldPrimaryDNS -SecondaryDNS $vShieldSecondaryDNS +# Write-Host "Configuration Complete" \ No newline at end of file diff --git a/Build/Automate/vShield51.ps1 b/Build/Automate/vShield51.ps1 new file mode 100644 index 0000000..9a58030 --- /dev/null +++ b/Build/Automate/vShield51.ps1 @@ -0,0 +1,228 @@ +# Script to add add VMware vShield Manager to the AutoLab infrastructure +# +# Thanks to Alan Renouf (http://www.virtu-al.net/2011/09/14/powershell-automated-install-of-vshield-5/) +# Thanks to Jeff Hicks for the Test-Website Function: http://jdhitsolutions.com/blog/2010/04/hey-are-you-awake/ +# Thanks to William Lam for the trick to change the Zebra file: http://www.virtuallyghetto.com/2011/09/how-to-automate-deployment.html +# AutoLab v1.1 +# +# +. "C:\PSFunctions.ps1" +Function New-ZebraFile ($vShieldHostName, $vShieldIP, $vShieldID, $vShieldGW) { +$ZebraFile = @" +! +hostname $vShieldHostName +! +interface mgmt + ip address $vShieldIP/$vShieldID +! +ip route 0.0.0.0/0 $vShieldGW +! +line vty + no login +! +"@ + +$ZebraFile | Out-File $ENV:TEMP\zebra.conf -Encoding "ASCII" +} +Function Post-vShieldAPI ($URL, $Body) { + $wc = New-Object System.Net.WebClient + + # Add Authorization headers + $authbytes = [System.Text.Encoding]::ASCII.GetBytes($vshieldUser + ":" + $vShieldPass) + $base64 = [System.Convert]::ToBase64String($authbytes) + $authorization = "Authorization: Basic " + $base64 + $wc.Headers.Add($authorization) + + $response = $wc.UploadString($URL, "POST", $Body) +} +Function Set-vShieldConfiguration ($vCenter, $Username, $Password, $PrimaryDNS, $SecondaryDNS) { + $Body = @" +<vsmGlobalConfig xmlns="vmware.vshield.edge.2.0"> +<dnsInfo> +<primaryDns>$($PrimaryDNS)</primaryDns> +<secondaryDns>$($SecondaryDNS)</secondaryDns> +</dnsInfo> +</vsmGlobalConfig> +"@ + Post-vShieldAPI -URL "https://$vShieldIP/api/2.0/global/config" -Body $Body +} +function Wait-vShieldBoot { + do { + $VM = Get-VM $vShieldHostName + Sleep 5 + } until ($VM.ToolsStatus -eq "toolsOK") +} +Function Test-WebSite { + [cmdletBinding()] + Param ( + [Parameter( + ValueFromPipeline=$True,Position=0,Mandatory=$True, + HelpMessage="The URL to test. Include http:// or https://")] + [string]$url + ) + + Begin { + Write-Verbose "Begin function" + } + Process { + Write-Verbose "Requesting $url" + + $wr=[system.net.webrequest]::Create($url) + #set timeout to 7 seconds + $wr.Timeout=7000 + $start=Get-Date + + Try { + $response=$wr.GetResponse() + if ($response) { + Write-Verbose "Response returned" + $Status=$response.StatusCode + $StatusCode=($response.Statuscode -as [int]) + } + } + Catch [system.net.webexception] { + Write-Verbose "Failed to get a response from $url" + $status = $_.Exception.Response.StatusCode + $statuscode = ( $_.Exception.Response.StatusCode -as [int]) + } + + $end=Get-Date + $timespan=$end-$start + $ResponseMS=$timespan.TotalMilliseconds + + Write-Verbose "status is $status" + Write-Verbose "statuscode is $statuscode" + Write-Verbose "timer is $responseMS" + + $obj=New-Object PSObject -Property @{ + DateTime=$start + URL=$url + Status=$status + StatusCode=$statuscode + ResponseMS=$ResponseMS + } + Write-Output $obj + + } #end Process + End { + Write-Verbose "End function" + } +} +Function Wait-vShieldWebsite { + do { + $web = test-website https://$vShieldIP + Sleep 5 + } until ($Web.Status -eq "OK") +} + +if ( (Get-PSSnapin -Name VMware.VimAutomation.Core -ErrorAction SilentlyContinue) -eq $null ) +{ + try { + Write-Host "Loading PowerCLI plugin, this will take a little while" -foregroundcolor "cyan" + Add-PsSnapin VMware.VimAutomation.Core + } + catch { + Write-Host "Unable to load the PowerCLI plugin. Please verify installation and run this script again." + exit + } +} +$PCLIver = (((Get-PowerCLIVersion).Major * 10) + (Get-PowerCLIVersion).Minor) +If ($PCLIver -ge 51) { + $null = Set-PowerCLIConfiguration -DisplayDeprecationWarnings:$false -InvalidCertificateAction Ignore -Confirm:$false -Scope "Session" + } Else { + Write-Host "Upgrade PowerCLI to version 5.1 or later" + Write-Host "This version cannot deploy thin provisioned vApps" + Read-Host "Press <Enter> to exit" + Exit + } + +for ($i=1;$i -le 2; $i++){ + $vmhost = "host$i.lab.local" + $ping = new-object System.Net.NetworkInformation.Ping + $Reply = $ping.send($vmhost) + if ($Reply.status –ne "Success") { + Write-Host $vmhost " not responding to ping, exiting" -foregroundcolor "red" + Write-Host "Re-run this script when both ESXi hosts are running" -foregroundcolor "red" + exit + } +} +$vShieldHostName = "vShield" +$vShieldFQDN = "vshield.lab.local" +$vShieldCluster = "Local" +$vShieldIP = "192.168.199.40" +$vShieldID = "24" +$vShieldGW = "192.168.199.2" +$vShieldPrimaryDNS = "192.168.199.4" +$vShieldSecondaryDNS = "192.168.199.4" +$vShieldUser = "admin" +$vShieldPass = "default" +$vCenter = "192.168.199.5" +$vcUsername = "Lab\vi-admin" +$vcPass = "VMware1!" +$Newproperty = New-VIProperty -Name ToolsStatus -ObjectType VirtualMachine -Value { + param($vm) + $vm.ExtensionData.Guest.ToolsStatus +} -Force + +Write-Host "Connecting to vCenter" +try { + $Connect = Connect-VIServer -Server $vCenter -User $vcUsername -Password $vcPass -ErrorAction Stop + $VMhost = Get-Cluster $vShieldCluster | Get-VMHost | Select -First 1 +} +catch { + Write-Host "Unable to connect to to $vCenter. Exiting." + exit +} +# Work out which iSCSI datastore has the most free space +$vShieldDS = Get-Datastore -name iSCSI* | Select Name, FreeSpaceGB | Sort-Object -Property FreeSpaceGB | Select-Object -Last 1 + +if (Test-Path "\\192.168.199.7\Build\vCD_51\VMware-vShield-Manager-5.1.*.ova") { + $vshieldOVA = (Get-ChildItem \\192.168.199.7\Build\vCD_51\VMware-vShield-Manager-5.1.*.ova).FullName + Write-Host "Importing the vShield OVA" + try { + $va = Import-VApp -Name $vShieldHostName -Datastore $vShieldDS.Name -VMHost $VMHost -Source $vshieldOVA -DiskStorageFormat Thin -ErrorAction Stop + $null = Get-VM $vShieldHostName | Set-VM -MemoryMB 512 -Confirm:$false + $null = Get-VMResourceConfiguration -VM $vShieldHostName | Set-VMResourceConfiguration -MemReservationMB 0 + Write-Host "Starting the vShield VM" + $Start = Start-VM $vShieldHostName -Confirm:$false + Wait-vShieldBoot + Write-Host "vShield Manager import complete." + } + catch { + write-host "Unable to import vShield. Exiting." + exit + } +} else { + Write-Host "vShield OVA not found. Please copy the file to the Build share and try again." +} + +### Commented out due to issues with vShield VM authentication during Invoke-VMScript +# Write-Host "Waiting until the vShield VM has started" +# Wait-vShieldBoot +# Write-Host "Setting the initial IP address after boot" +# $Zebrafile = New-Zebrafile -vShieldHostName $vShieldFQDN -vShieldIP $vShieldIP -vShieldID $vShieldID -vShieldGW $vShieldGW +# $Password = ConvertTo-SecureString -AsPlainText $vShieldPass -Force +# $cred = new-object -typename System.Management.Automation.PSCredential -argumentlist "admin", $Password + +# $invoke = Invoke-VMScript -VM vShield -ScriptText "mv /common/configs/cli/zebra.conf /common/configs/cli/zebra.conf.bak" -ScriptType Bash -GuestCredential $cred +# $ReIP = Copy-VMGuestFile -VM $vShieldHostName -Source $ENV:TEMP\zebra.conf -Destination "/common/configs/cli/" -LocalToGuest -GuestUser $vShieldUser -GuestPassword $vShieldPass + +# Write-Host "Powering Off the vShield VM" +# Sleep 5 +# $Stop = Stop-VM $vShieldHostName -Confirm:$false +# Write-Host "Starting the vShield VM" +# $Start = Start-VM $vShieldHostName -Confirm:$false + +# Write-Host "Waiting until the vShield VM has started" +# Wait-vShieldBoot + +# Write-Host "Waiting until the vShield Management site has started" +# Wait-vShieldWebsite + +# Write-Host "Linking vShield to vCenter and set DNS entries" +# $SetIP = Set-vShieldConfiguration -vCenter $vCenter -Username $vcUsername -Password $vcPass -PrimaryDNS $vShieldPrimaryDNS -SecondaryDNS $vShieldSecondaryDNS +# Write-Host "Configuration Complete" +if (Test-Path "C:\Program Files\VMware\VMware Tools\VMwareToolboxCmd.exe") { + Read-Host " Configuration complete, press <Enter> to continue." +} +exit \ No newline at end of file diff --git a/Build/ChangeLog.txt b/Build/ChangeLog.txt new file mode 100644 index 0000000..52f2e27 --- /dev/null +++ b/Build/ChangeLog.txt @@ -0,0 +1,74 @@ +Version 2.6 +- Support for vSphere 6.0 +- Nested 2012 Server VM +- Larger NAS to accommodate larger nested VMs + +Version 2.0 +- Support for and default to Windows Server 2012 R2 +- Removed VLAN tagging, enables simpler deployment +- Automated Certificate Authority setup +- Support for user selected administrator passwords +- Support for View 6.0 + +Version 1.5 +- Added vSphere 5.5 +- Added View 5.2 & 5.3 +- Added Third ESXi and support for vSAN +- Ground work for SRM support + +Version 1.1a +- Added vCloud 5.1 +- Removed requirement for vSphere 5.0 for successful build +- Multiple minor bug fixes +- Moved windows builds build into Powershell + +Version 1.1 +- Added vSphere 5.1 build +- Changed PXE boot menu structure +- Added upgrade script +- Chamged nested build to be simpler, added TTYLinux VM +- NFS datastores +- Removed requirement for specific Win2K8 ISO version +- Build script creates nested OS install iso rather than using floppies, XP build includes VMware SCSI driver + +Version 1.0 +- Veeam, View & SRM Databases on DC +- Firewall off in all network profuiles on VC and DC +- Added View servers, CS1, CS2 & SS +- Added Veeam Servers VBR & V1 +- Added vCloud Director VM & Damian's automation +- Powershell menu script for VC server +- Shutdown lab script to enumerate windows servers to shutdown +- Make Validate script to auto elevate +- Added PowerShell script to add built ESXi servers to rebuilt vCenter + +Version 0.8 31 May 2012 +- Win2K8R2 SP1 build support +- deploy.cab extracted from WinInstall.ISO and used as source for sysprep files on vCenter +- Different VC and DC boot floppies for Windows 2008 R2 RTM and SP1 +- Identify ESXi 5.0 vs ESXi5U1 and setup PXE differently +- Shortcut to buildlog.txt on desktops for DC and VC +- Add more checks to Validate script, global Pass Fail & launch build log on fail +- Version specific PXE files in version folder +- Desktop shortcut for validate script +- Change Unattend folder to Automate folder & cleanup +- AddHosts to register all found VMs +- Use the SQLExpress installer from vCenter to install SQL Client on VC +- Build.txt in VC & DC initial buld, change to buildlog.txt +- Corrected router IP address in DHCP config +- Warning message & confirmation in shutdown script +- Publish hosts & VMA via SSH through router +- Enable SSH on NAS & publish through router +- Validate script to warn not error if 4.1 files missing +- AddHosts to test for "run as administrator" & exit +- VC Build accommodate VC 5.0 RTM SQLclient location +- Copy of Shell VMs in NAS VM to allow distribution as single VM .ova for standalone ESXi compatibility. +- ini file for automation level in automate folder +- Insert Product key into WinInstall.flp +- Timezone from automate file, apply to DC & VC +- Fixed Boot order on Host2 VM +- Host1 v4.1 build, first VM build broken +- validate, cleanly cope with VUM service not installed + +Version 0.5 3 May 2012 +- First version, everything had changed. \ No newline at end of file diff --git a/Doc/AutoLab 1.1a vSphere Deployment Guide.doc b/Doc/AutoLab 1.1a vSphere Deployment Guide.doc new file mode 100644 index 0000000..1b0c31e Binary files /dev/null and b/Doc/AutoLab 1.1a vSphere Deployment Guide.doc differ diff --git a/Doc/AutoLab 1.5 vSphere Deployment Guide.doc b/Doc/AutoLab 1.5 vSphere Deployment Guide.doc new file mode 100644 index 0000000..4b3f59f Binary files /dev/null and b/Doc/AutoLab 1.5 vSphere Deployment Guide.doc differ diff --git a/Doc/AutoLab 2.0 vSphere Deployment Guide .doc b/Doc/AutoLab 2.0 vSphere Deployment Guide .doc new file mode 100644 index 0000000..4b3f59f Binary files /dev/null and b/Doc/AutoLab 2.0 vSphere Deployment Guide .doc differ diff --git a/Doc/AutoLab 2.6 vSphere Deployment Guide .docx b/Doc/AutoLab 2.6 vSphere Deployment Guide .docx new file mode 100644 index 0000000..b2dda66 Binary files /dev/null and b/Doc/AutoLab 2.6 vSphere Deployment Guide .docx differ diff --git a/Doc/vSphere 5 AutoLab Deployment Guide.docx b/Doc/vSphere 5 AutoLab Deployment Guide.docx new file mode 100644 index 0000000..d530fdd Binary files /dev/null and b/Doc/vSphere 5 AutoLab Deployment Guide.docx differ diff --git a/SRC/CS1/CS1.flp b/SRC/CS1/CS1.flp new file mode 100644 index 0000000..1a89be1 Binary files /dev/null and b/SRC/CS1/CS1.flp differ diff --git a/SRC/CS1/autoUnattend.xml b/SRC/CS1/autoUnattend.xml new file mode 100644 index 0000000..a9ac903 --- /dev/null +++ b/SRC/CS1/autoUnattend.xml @@ -0,0 +1,145 @@ +<?xml version="1.0" encoding="utf-8"?> +<unattend xmlns="urn:schemas-microsoft-com:unattend"> + <settings pass="windowsPE"> + <component name="Microsoft-Windows-International-Core-WinPE" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <InputLocale>en-US</InputLocale> + <SystemLocale>en-US</SystemLocale> + <UILanguage>en-US</UILanguage> + <UILanguageFallback>en-US</UILanguageFallback> + <UserLocale>en-US</UserLocale> + </component> + <component name="Microsoft-Windows-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <ImageInstall> + <OSImage> + <InstallTo> + <DiskID>0</DiskID> + <PartitionID>1</PartitionID> + </InstallTo> + <InstallFrom> + <MetaData wcm:action="add"> + <Key>/IMAGE/INDEX</Key> + <Value>1</Value> + </MetaData> + </InstallFrom> + </OSImage> + </ImageInstall> + <UserData> + <AcceptEula>true</AcceptEula> + <FullName>Lab</FullName> + <Organization>Lab.local</Organization> + </UserData> + <DiskConfiguration> + <Disk wcm:action="add"> + <CreatePartitions> + <CreatePartition wcm:action="add"> + <Extend>true</Extend> + <Order>1</Order> + <Type>Primary</Type> + </CreatePartition> + </CreatePartitions> + <DiskID>0</DiskID> + <WillWipeDisk>true</WillWipeDisk> + </Disk> + </DiskConfiguration> + </component> + </settings> + <settings pass="specialize"> + <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <ComputerName>CS1</ComputerName> + </component> + <component name="Microsoft-Windows-TCPIP" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <Interfaces> + <Interface wcm:action="add"> + <Ipv4Settings> + <DhcpEnabled>false</DhcpEnabled> + <Metric>10</Metric> + <RouterDiscoveryEnabled>false</RouterDiscoveryEnabled> + </Ipv4Settings> + <UnicastIpAddresses> + <IpAddress wcm:action="add" wcm:keyValue="1">192.168.199.33/24</IpAddress> + </UnicastIpAddresses> + <Identifier>Local Area Connection</Identifier> + <Routes> + <Route wcm:action="add"> + <Identifier>0</Identifier> + <Metric>10</Metric> + <NextHopAddress>192.168.199.2</NextHopAddress> + <Prefix>0.0.0.0/0</Prefix> + </Route> + </Routes> + </Interface> + </Interfaces> + </component> + <component name="Microsoft-Windows-UnattendedJoin" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <Identification> + <Credentials> + <Domain>lab.local</Domain> + <Password>VMware1!</Password> + <Username>JoinUser</Username> + </Credentials> + <JoinDomain>lab.local</JoinDomain> + </Identification> + </component> + <component name="Microsoft-Windows-DNS-Client" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <DNSSuffixSearchOrder> + <DomainName wcm:action="add" wcm:keyValue="1">lab.local</DomainName> + </DNSSuffixSearchOrder> + <Interfaces> + <Interface wcm:action="add"> + <DNSServerSearchOrder> + <IpAddress wcm:action="add" wcm:keyValue="1">192.168.199.4</IpAddress> + </DNSServerSearchOrder> + <DisableDynamicUpdate>true</DisableDynamicUpdate> + <DNSDomain>lab.local</DNSDomain> + <EnableAdapterDomainNameRegistration>true</EnableAdapterDomainNameRegistration> + <Identifier>Local Area Connection</Identifier> + </Interface> + </Interfaces> + </component> + <component name="Microsoft-Windows-ServerManager-SvrMgrNc" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <DoNotOpenServerManagerAtLogon>true</DoNotOpenServerManagerAtLogon> + </component> + <component name="Microsoft-Windows-OutOfBoxExperience" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <DoNotOpenInitialConfigurationTasksAtLogon>true</DoNotOpenInitialConfigurationTasksAtLogon> + </component> + <component name="Microsoft-Windows-TerminalServices-LocalSessionManager" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <fDenyTSConnections>false</fDenyTSConnections> + </component> + <component name="Microsoft-Windows-IE-InternetExplorer" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <TrustedSites>192.168.199.7</TrustedSites> + </component> + </settings> + <settings pass="oobeSystem"> + <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <AutoLogon> + <Password> + <Value>VgBNAHcAYQByAGUAMQAhAFAAYQBzAHMAdwBvAHIAZAA=</Value> + <PlainText>false</PlainText> + </Password> + <Enabled>true</Enabled> + <LogonCount>99</LogonCount> + <Username>cs1\administrator</Username> + </AutoLogon> + <OOBE> + <HideEULAPage>true</HideEULAPage> + <HideWirelessSetupInOOBE>true</HideWirelessSetupInOOBE> + <NetworkLocation>Work</NetworkLocation> + </OOBE> + <UserAccounts> + <AdministratorPassword> + <Value>VgBNAHcAYQByAGUAMQAhAEEAZABtAGkAbgBpAHMAdAByAGEAdABvAHIAUABhAHMAcwB3AG8AcgBkAA==</Value> + <PlainText>false</PlainText> + </AdministratorPassword> + </UserAccounts> + <FirstLogonCommands> + <SynchronousCommand wcm:action="add"> + <CommandLine>a:\Build.cmd</CommandLine> + <Description>Build</Description> + <Order>1</Order> + <RequiresUserInput>true</RequiresUserInput> + </SynchronousCommand> + </FirstLogonCommands> + </component> + </settings> + <cpi:offlineImage cpi:source="wim:d:/projects/community%20lab%20guide/installers/2k8r2/sources/install.wim#Windows Server 2008 R2 SERVERSTANDARD" xmlns:cpi="urn:schemas-microsoft-com:cpi" /> +</unattend> diff --git a/SRC/CS1/build.cmd b/SRC/CS1/build.cmd new file mode 100644 index 0000000..6d14ab5 --- /dev/null +++ b/SRC/CS1/build.cmd @@ -0,0 +1,33 @@ +@echo off +type \\192.168.199.7\Build\Automate\version.txt >> c:\buildlog.txt +ver | find "6.1" > nul +if %ERRORLEVEL% == 0 goto ver_2K8 +ver | find "6.2" > nul +if %ERRORLEVEL% == 0 goto ver_2K12 +ver | find "6.3" > nul +if %ERRORLEVEL% == 0 goto ver_2K12 +goto RunBuild +:ver_2K8 +goto RunBuild +:ver_2K12 +netsh interface ip set address name="Ethernet" static 192.168.199.33 255.255.255.0 192.168.199.2 1 +netsh interface ip set dnsservers name="Ethernet" static address=192.168.199.4 primary +Dism /online /enable-feature /featurename:NetFx3ServerFeatures +Dism /online /enable-feature /featurename:NetFx3 /source:D:\Sources\sxs +copy \\192.168.199.7\Build\Automate\DC\ocsetup.exe c:\windows\system32\ +echo * Mount Install Image +echo * Mount Install Image >> c:\buildlog.txt +mkdir c:\mountdir +Dism /mount-wim /WimFile:D:\sources\install.wim /Index:2 /MountDir:c:\mountdir /readonly /quiet +echo * Setup recall of build script +copy \\192.168.199.7\Build\automate\%computername%\Build.cmd c:\ +type \\192.168.199.7\Build\Automate\version.txt >> c:\buildlog.txt +reg add HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /v Build /t REG_SZ /d "cmd /c c:\build.cmd" /f >> c:\buildlog.txt +echo * Install GUI onto Server Core +echo * Install GUI onto Server Core >> c:\buildlog.txt +Dism /online /enable-feature /featurename:server-gui-shell /all /source:c:\mountdir\windows\winsxs /quiet +pause +goto RunBuild +:RunBuild +copy \\192.168.199.7\Build\automate\%computername%\Build.cmd c:\ +c:\build.cmd \ No newline at end of file diff --git a/SRC/CS2/CS2.flp b/SRC/CS2/CS2.flp new file mode 100644 index 0000000..c2b17eb Binary files /dev/null and b/SRC/CS2/CS2.flp differ diff --git a/SRC/CS2/autoUnattend.xml b/SRC/CS2/autoUnattend.xml new file mode 100644 index 0000000..e896c19 --- /dev/null +++ b/SRC/CS2/autoUnattend.xml @@ -0,0 +1,142 @@ +<?xml version="1.0" encoding="utf-8"?> +<unattend xmlns="urn:schemas-microsoft-com:unattend"> + <settings pass="windowsPE"> + <component name="Microsoft-Windows-International-Core-WinPE" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <InputLocale>en-US</InputLocale> + <SystemLocale>en-US</SystemLocale> + <UILanguage>en-US</UILanguage> + <UILanguageFallback>en-US</UILanguageFallback> + <UserLocale>en-US</UserLocale> + </component> + <component name="Microsoft-Windows-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <ImageInstall> + <OSImage> + <InstallTo> + <DiskID>0</DiskID> + <PartitionID>1</PartitionID> + </InstallTo> + <InstallFrom> + <MetaData wcm:action="add"> + <Key>/IMAGE/INDEX</Key> + <Value>1</Value> + </MetaData> + </InstallFrom> + </OSImage> + </ImageInstall> + <UserData> + <AcceptEula>true</AcceptEula> + <FullName>Lab</FullName> + <Organization>Lab.local</Organization> + </UserData> + <DiskConfiguration> + <Disk wcm:action="add"> + <CreatePartitions> + <CreatePartition wcm:action="add"> + <Extend>true</Extend> + <Order>1</Order> + <Type>Primary</Type> + </CreatePartition> + </CreatePartitions> + <DiskID>0</DiskID> + <WillWipeDisk>true</WillWipeDisk> + </Disk> + </DiskConfiguration> + </component> + </settings> + <settings pass="specialize"> + <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <ComputerName>CS2</ComputerName> + </component> + <component name="Microsoft-Windows-TCPIP" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <Interfaces> + <Interface wcm:action="add"> + <Ipv4Settings> + <DhcpEnabled>false</DhcpEnabled> + <Metric>10</Metric> + <RouterDiscoveryEnabled>false</RouterDiscoveryEnabled> + </Ipv4Settings> + <UnicastIpAddresses> + <IpAddress wcm:action="add" wcm:keyValue="1">192.168.199.34/24</IpAddress> + </UnicastIpAddresses> + <Identifier>Local Area Connection</Identifier> + <Routes> + <Route wcm:action="add"> + <Identifier>0</Identifier> + <Metric>10</Metric> + <NextHopAddress>192.168.199.2</NextHopAddress> + <Prefix>0.0.0.0/0</Prefix> + </Route> + </Routes> + </Interface> + </Interfaces> + </component> + <component name="Microsoft-Windows-UnattendedJoin" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <Identification> + <Credentials> + <Domain>lab.local</Domain> + <Password>VMware1!</Password> + <Username>JoinUser</Username> + </Credentials> + <JoinDomain>lab.local</JoinDomain> + </Identification> + </component> + <component name="Microsoft-Windows-DNS-Client" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <DNSSuffixSearchOrder> + <DomainName wcm:action="add" wcm:keyValue="1">lab.local</DomainName> + </DNSSuffixSearchOrder> + <Interfaces> + <Interface wcm:action="add"> + <DNSServerSearchOrder> + <IpAddress wcm:action="add" wcm:keyValue="1">192.168.199.4</IpAddress> + </DNSServerSearchOrder> + <DisableDynamicUpdate>true</DisableDynamicUpdate> + <DNSDomain>lab.local</DNSDomain> + <EnableAdapterDomainNameRegistration>true</EnableAdapterDomainNameRegistration> + <Identifier>Local Area Connection</Identifier> + </Interface> + </Interfaces> + </component> + <component name="Microsoft-Windows-ServerManager-SvrMgrNc" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <DoNotOpenServerManagerAtLogon>true</DoNotOpenServerManagerAtLogon> + </component> + <component name="Microsoft-Windows-OutOfBoxExperience" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <DoNotOpenInitialConfigurationTasksAtLogon>true</DoNotOpenInitialConfigurationTasksAtLogon> + </component> + <component name="Microsoft-Windows-TerminalServices-LocalSessionManager" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <fDenyTSConnections>false</fDenyTSConnections> + </component> + </settings> + <settings pass="oobeSystem"> + <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <AutoLogon> + <Password> + <Value>VgBNAHcAYQByAGUAMQAhAFAAYQBzAHMAdwBvAHIAZAA=</Value> + <PlainText>false</PlainText> + </Password> + <Enabled>true</Enabled> + <LogonCount>99</LogonCount> + <Username>CS2\administrator</Username> + </AutoLogon> + <OOBE> + <HideEULAPage>true</HideEULAPage> + <HideWirelessSetupInOOBE>true</HideWirelessSetupInOOBE> + <NetworkLocation>Work</NetworkLocation> + </OOBE> + <UserAccounts> + <AdministratorPassword> + <Value>VgBNAHcAYQByAGUAMQAhAEEAZABtAGkAbgBpAHMAdAByAGEAdABvAHIAUABhAHMAcwB3AG8AcgBkAA==</Value> + <PlainText>false</PlainText> + </AdministratorPassword> + </UserAccounts> + <FirstLogonCommands> + <SynchronousCommand wcm:action="add"> + <CommandLine>a:\Build.cmd</CommandLine> + <Description>Build</Description> + <Order>1</Order> + <RequiresUserInput>true</RequiresUserInput> + </SynchronousCommand> + </FirstLogonCommands> + </component> + </settings> + <cpi:offlineImage cpi:source="wim:d:/community%20lab%20guide/installers/2k8r2/sources/install.wim#Windows Server 2008 R2 SERVERSTANDARD" xmlns:cpi="urn:schemas-microsoft-com:cpi" /> +</unattend> diff --git a/SRC/CS2/build.cmd b/SRC/CS2/build.cmd new file mode 100644 index 0000000..9cda843 --- /dev/null +++ b/SRC/CS2/build.cmd @@ -0,0 +1,33 @@ +@echo off +type \\192.168.199.7\Build\Automate\version.txt >> c:\buildlog.txt +ver | find "6.1" > nul +if %ERRORLEVEL% == 0 goto ver_2K8 +ver | find "6.2" > nul +if %ERRORLEVEL% == 0 goto ver_2K12 +ver | find "6.3" > nul +if %ERRORLEVEL% == 0 goto ver_2K12 +goto RunBuild +:ver_2K8 +goto RunBuild +:ver_2K12 +netsh interface ip set address name="Ethernet" static 192.168.199.34 255.255.255.0 192.168.199.2 1 +netsh interface ip set dnsservers name="Ethernet" static address=192.168.199.4 primary +Dism /online /enable-feature /featurename:NetFx3ServerFeatures +Dism /online /enable-feature /featurename:NetFx3 /source:D:\Sources\sxs +copy \\192.168.199.7\Build\Automate\DC\ocsetup.exe c:\windows\system32\ +echo * Mount Install Image +echo * Mount Install Image >> c:\buildlog.txt +mkdir c:\mountdir +Dism /mount-wim /WimFile:D:\sources\install.wim /Index:2 /MountDir:c:\mountdir /readonly /quiet +echo * Setup recall of build script +copy \\192.168.199.7\Build\automate\%computername%\Build.cmd c:\ +type \\192.168.199.7\Build\Automate\version.txt >> c:\buildlog.txt +reg add HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /v Build /t REG_SZ /d "cmd /c c:\build.cmd" /f >> c:\buildlog.txt +echo * Install GUI onto Server Core +echo * Install GUI onto Server Core >> c:\buildlog.txt +Dism /online /enable-feature /featurename:server-gui-shell /all /source:c:\mountdir\windows\winsxs /quiet +pause +goto RunBuild +:RunBuild +copy \\192.168.199.7\Build\automate\%computername%\Build.cmd c:\ +c:\build.cmd \ No newline at end of file diff --git a/SRC/DC.flp b/SRC/DC.flp new file mode 100644 index 0000000..54c3742 Binary files /dev/null and b/SRC/DC.flp differ diff --git a/SRC/DC/Build.cmd b/SRC/DC/Build.cmd new file mode 100644 index 0000000..a9fbedb --- /dev/null +++ b/SRC/DC/Build.cmd @@ -0,0 +1,53 @@ +@echo off +ver | find "6.1" > nul +if %ERRORLEVEL% == 0 goto ver_2K8 +ver | find "6.2" > nul +if %ERRORLEVEL% == 0 goto ver_2K12 +ver | find "6.3" > nul +if %ERRORLEVEL% == 0 goto ver_2K12 +Exit +:ver_2K8 +echo ** +echo * Building on Windows 2008 R2 +echo * Building on Windows 2008 R2 >> c:\buildlog.txt +echo * Setup recall of build script +echo * Setup recall of build script >> c:\buildlog.txt +copy \\192.168.199.7\Build\Automate\DC\Phase2.cmd c:\ >> c:\buildlog.txt +type \\192.168.199.7\Build\Automate\version.txt >> c:\buildlog.txt +echo ** +echo * Install DHCP +echo * Install DHCP >> c:\buildlog.txt +start /w ocsetup DHCPServer +echo * Enable DHCP +echo * Enable DHCP >> c:\buildlog.txt +sc config dhcpserver start= auto +reg add HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /v Build /t REG_SZ /d "cmd /c c:\Phase2.cmd" /f >> c:\buildlog.txt +echo ** +echo * Install Active Directory and reboot +copy \\192.168.199.7\Build\Automate\DC\dcpromo.txt c:\ >> c:\buildlog.txt +dcpromo /answer:c:\dcpromo.txt >> c:\buildlog.txt +Exit +:ver_2K12 +echo ** +echo * Building on Windows 2012 R2 +echo * Building on Windows 2012 R2 >> c:\buildlog.txt +echo * Set IP address +echo * Set IP address >> c:\buildlog.txt +netsh interface ip set address "Ethernet" static 192.168.199.4 255.255.255.0 192.168.199.2 1 +netsh interface ip set dnsservers "Ethernet" static 192.168.199.4 primary +echo ** +echo * Mount Install Image +echo * Mount Install Image >> c:\buildlog.txt +mkdir c:\mountdir +If Exist D:\sources\install.wim Dism /mount-wim /WimFile:D:\sources\install.wim /Index:2 /MountDir:c:\mountdir /readonly /quiet +If Exist E:\sources\install.wim Dism /mount-wim /WimFile:E:\sources\install.wim /Index:2 /MountDir:c:\mountdir /readonly /quiet +echo * Setup recall of build script +copy \\192.168.199.7\Build\Automate\DC\Phase2.cmd c:\ >> c:\buildlog.txt +type \\192.168.199.7\Build\Automate\version.txt >> c:\buildlog.txt +reg add HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /v Build /t REG_SZ /d "cmd /c c:\Phase2.cmd" /f >> c:\buildlog.txt +echo * Install GUI onto Server Core +echo * Install GUI onto Server Core >> c:\buildlog.txt +Dism /online /enable-feature /featurename:server-gui-mgmt /all /source:c:\mountdir\windows\winsxs /quiet /norestart +Dism /online /enable-feature /featurename:server-gui-shell /all /source:c:\mountdir\windows\winsxs /quiet /norestart +Dism /online /enable-feature /featurename:servercore-fullserver /all /source:c:\mountdir\windows\winsxs /quiet +Exit \ No newline at end of file diff --git a/SRC/DC/DC.flp b/SRC/DC/DC.flp new file mode 100644 index 0000000..58ffc29 Binary files /dev/null and b/SRC/DC/DC.flp differ diff --git a/SRC/DC/Ravello/Build.cmd b/SRC/DC/Ravello/Build.cmd new file mode 100644 index 0000000..a9fbedb --- /dev/null +++ b/SRC/DC/Ravello/Build.cmd @@ -0,0 +1,53 @@ +@echo off +ver | find "6.1" > nul +if %ERRORLEVEL% == 0 goto ver_2K8 +ver | find "6.2" > nul +if %ERRORLEVEL% == 0 goto ver_2K12 +ver | find "6.3" > nul +if %ERRORLEVEL% == 0 goto ver_2K12 +Exit +:ver_2K8 +echo ** +echo * Building on Windows 2008 R2 +echo * Building on Windows 2008 R2 >> c:\buildlog.txt +echo * Setup recall of build script +echo * Setup recall of build script >> c:\buildlog.txt +copy \\192.168.199.7\Build\Automate\DC\Phase2.cmd c:\ >> c:\buildlog.txt +type \\192.168.199.7\Build\Automate\version.txt >> c:\buildlog.txt +echo ** +echo * Install DHCP +echo * Install DHCP >> c:\buildlog.txt +start /w ocsetup DHCPServer +echo * Enable DHCP +echo * Enable DHCP >> c:\buildlog.txt +sc config dhcpserver start= auto +reg add HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /v Build /t REG_SZ /d "cmd /c c:\Phase2.cmd" /f >> c:\buildlog.txt +echo ** +echo * Install Active Directory and reboot +copy \\192.168.199.7\Build\Automate\DC\dcpromo.txt c:\ >> c:\buildlog.txt +dcpromo /answer:c:\dcpromo.txt >> c:\buildlog.txt +Exit +:ver_2K12 +echo ** +echo * Building on Windows 2012 R2 +echo * Building on Windows 2012 R2 >> c:\buildlog.txt +echo * Set IP address +echo * Set IP address >> c:\buildlog.txt +netsh interface ip set address "Ethernet" static 192.168.199.4 255.255.255.0 192.168.199.2 1 +netsh interface ip set dnsservers "Ethernet" static 192.168.199.4 primary +echo ** +echo * Mount Install Image +echo * Mount Install Image >> c:\buildlog.txt +mkdir c:\mountdir +If Exist D:\sources\install.wim Dism /mount-wim /WimFile:D:\sources\install.wim /Index:2 /MountDir:c:\mountdir /readonly /quiet +If Exist E:\sources\install.wim Dism /mount-wim /WimFile:E:\sources\install.wim /Index:2 /MountDir:c:\mountdir /readonly /quiet +echo * Setup recall of build script +copy \\192.168.199.7\Build\Automate\DC\Phase2.cmd c:\ >> c:\buildlog.txt +type \\192.168.199.7\Build\Automate\version.txt >> c:\buildlog.txt +reg add HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /v Build /t REG_SZ /d "cmd /c c:\Phase2.cmd" /f >> c:\buildlog.txt +echo * Install GUI onto Server Core +echo * Install GUI onto Server Core >> c:\buildlog.txt +Dism /online /enable-feature /featurename:server-gui-mgmt /all /source:c:\mountdir\windows\winsxs /quiet /norestart +Dism /online /enable-feature /featurename:server-gui-shell /all /source:c:\mountdir\windows\winsxs /quiet /norestart +Dism /online /enable-feature /featurename:servercore-fullserver /all /source:c:\mountdir\windows\winsxs /quiet +Exit \ No newline at end of file diff --git a/SRC/DC/Ravello/DC-Config.iso b/SRC/DC/Ravello/DC-Config.iso new file mode 100644 index 0000000..01fe5e6 Binary files /dev/null and b/SRC/DC/Ravello/DC-Config.iso differ diff --git a/SRC/DC/Ravello/DC-Config.iso.uibak b/SRC/DC/Ravello/DC-Config.iso.uibak new file mode 100644 index 0000000..4278f8d Binary files /dev/null and b/SRC/DC/Ravello/DC-Config.iso.uibak differ diff --git a/SRC/DC/Ravello/autoUnattend.xml b/SRC/DC/Ravello/autoUnattend.xml new file mode 100644 index 0000000..f963525 --- /dev/null +++ b/SRC/DC/Ravello/autoUnattend.xml @@ -0,0 +1,149 @@ +<?xml version="1.0" encoding="utf-8"?> +<unattend xmlns="urn:schemas-microsoft-com:unattend"> + <settings pass="windowsPE"> + <component name="Microsoft-Windows-International-Core-WinPE" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <InputLocale>en-US</InputLocale> + <SystemLocale>en-US</SystemLocale> + <UILanguage>en-US</UILanguage> + <UILanguageFallback>en-US</UILanguageFallback> + <UserLocale>en-US</UserLocale> + </component> + <component name="Microsoft-Windows-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <ImageInstall> + <OSImage> + <InstallTo> + <DiskID>0</DiskID> + <PartitionID>1</PartitionID> + </InstallTo> + <InstallFrom> + <MetaData wcm:action="add"> + <Key>/IMAGE/INDEX</Key> + <Value>2</Value> + </MetaData> + </InstallFrom> + </OSImage> + </ImageInstall> + <UserData> + <AcceptEula>true</AcceptEula> + <FullName>Lab</FullName> + <Organization>Lab.local</Organization> + </UserData> + <DiskConfiguration> + <Disk wcm:action="add"> + <CreatePartitions> + <CreatePartition wcm:action="add"> + <Extend>true</Extend> + <Order>1</Order> + <Type>Primary</Type> + </CreatePartition> + </CreatePartitions> + <DiskID>0</DiskID> + <WillWipeDisk>true</WillWipeDisk> + </Disk> + </DiskConfiguration> + </component> + </settings> + <settings pass="specialize"> + <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <ComputerName>dc</ComputerName> + </component> + <component name="Microsoft-Windows-TCPIP" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <Interfaces> + <Interface wcm:action="add"> + <Ipv4Settings> + <DhcpEnabled>false</DhcpEnabled> + <Metric>10</Metric> + <RouterDiscoveryEnabled>false</RouterDiscoveryEnabled> + </Ipv4Settings> + <UnicastIpAddresses> + <IpAddress wcm:action="add" wcm:keyValue="1">192.168.199.4/24</IpAddress> + </UnicastIpAddresses> + <Identifier>Local Area Connection</Identifier> + <Routes> + <Route wcm:action="add"> + <Identifier>0</Identifier> + <Metric>10</Metric> + <NextHopAddress>192.168.199.2</NextHopAddress> + <Prefix>0.0.0.0/0</Prefix> + </Route> + </Routes> + </Interface> + </Interfaces> + </component> + <component name="Networking-MPSSVC-Svc" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <DomainProfile_EnableFirewall>false</DomainProfile_EnableFirewall> + <PrivateProfile_EnableFirewall>false</PrivateProfile_EnableFirewall> + <PublicProfile_EnableFirewall>false</PublicProfile_EnableFirewall> + </component> + <component name="Microsoft-Windows-OutOfBoxExperience" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <DoNotOpenInitialConfigurationTasksAtLogon>true</DoNotOpenInitialConfigurationTasksAtLogon> + </component> + <component name="Microsoft-Windows-ServerManager-SvrMgrNc" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <DoNotOpenServerManagerAtLogon>true</DoNotOpenServerManagerAtLogon> + </component> + <component name="Microsoft-Windows-TerminalServices-LocalSessionManager" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <fDenyTSConnections>false</fDenyTSConnections> + </component> + <component name="Microsoft-Windows-IE-ESC" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <IEHardenUser>false</IEHardenUser> + <IEHardenAdmin>false</IEHardenAdmin> + </component> + </settings> + <settings pass="oobeSystem"> + <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <AutoLogon> + <Password> + <Value>VgBNAHcAYQByAGUAMQAhAFAAYQBzAHMAdwBvAHIAZAA=</Value> + <PlainText>false</PlainText> + </Password> + <Enabled>true</Enabled> + <LogonCount>999</LogonCount> + <Username>administrator</Username> + </AutoLogon> + <FirstLogonCommands> + <SynchronousCommand wcm:action="add"> + <CommandLine>A:\Build.cmd</CommandLine> + <Description>Phase One Installer from A Drive</Description> + <Order>1</Order> + <RequiresUserInput>true</RequiresUserInput> + </SynchronousCommand> + <SynchronousCommand wcm:action="add"> + <CommandLine>D:\Build.cmd</CommandLine> + <Description>Phase One Installer from D Drive</Description> + <Order>2</Order> + <RequiresUserInput>true</RequiresUserInput> + </SynchronousCommand> + <SynchronousCommand wcm:action="add"> + <CommandLine>E:\Build.cmd</CommandLine> + <Description>Phase One Installer from E Drive</Description> + <Order>3</Order> + <RequiresUserInput>true</RequiresUserInput> + </SynchronousCommand> + </FirstLogonCommands> + <OOBE> + <HideEULAPage>true</HideEULAPage> + <HideWirelessSetupInOOBE>true</HideWirelessSetupInOOBE> + <NetworkLocation>Work</NetworkLocation> + </OOBE> + <UserAccounts> + <AdministratorPassword> + <Value>VgBNAHcAYQByAGUAMQAhAEEAZABtAGkAbgBpAHMAdAByAGEAdABvAHIAUABhAHMAcwB3AG8AcgBkAA==</Value> + <PlainText>false</PlainText> + </AdministratorPassword> + <LocalAccounts> + <LocalAccount wcm:action="add"> + <Password> + <Value>VgBNAHcAYQByAGUAMQAhAFAAYQBzAHMAdwBvAHIAZAA=</Value> + <PlainText>false</PlainText> + </Password> + <Description>vSphere Administrator</Description> + <DisplayName>VI Admin</DisplayName> + <Group>Administrators</Group> + <Name>vi-admin</Name> + </LocalAccount> + </LocalAccounts> + </UserAccounts> + </component> + </settings> + <cpi:offlineImage cpi:source="wim:d:/lab/win2k8r2sp1/sources/install.wim#Windows Server 2008 R2 SERVERSTANDARD" xmlns:cpi="urn:schemas-microsoft-com:cpi" /> +</unattend> diff --git a/SRC/DC/autoUnattend.xml b/SRC/DC/autoUnattend.xml new file mode 100644 index 0000000..69cd7d2 --- /dev/null +++ b/SRC/DC/autoUnattend.xml @@ -0,0 +1,149 @@ +<?xml version="1.0" encoding="utf-8"?> +<unattend xmlns="urn:schemas-microsoft-com:unattend"> + <settings pass="windowsPE"> + <component name="Microsoft-Windows-International-Core-WinPE" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <InputLocale>en-US</InputLocale> + <SystemLocale>en-US</SystemLocale> + <UILanguage>en-US</UILanguage> + <UILanguageFallback>en-US</UILanguageFallback> + <UserLocale>en-US</UserLocale> + </component> + <component name="Microsoft-Windows-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <ImageInstall> + <OSImage> + <InstallTo> + <DiskID>0</DiskID> + <PartitionID>1</PartitionID> + </InstallTo> + <InstallFrom> + <MetaData wcm:action="add"> + <Key>/IMAGE/INDEX</Key> + <Value>1</Value> + </MetaData> + </InstallFrom> + </OSImage> + </ImageInstall> + <UserData> + <AcceptEula>true</AcceptEula> + <FullName>Lab</FullName> + <Organization>Lab.local</Organization> + </UserData> + <DiskConfiguration> + <Disk wcm:action="add"> + <CreatePartitions> + <CreatePartition wcm:action="add"> + <Extend>true</Extend> + <Order>1</Order> + <Type>Primary</Type> + </CreatePartition> + </CreatePartitions> + <DiskID>0</DiskID> + <WillWipeDisk>true</WillWipeDisk> + </Disk> + </DiskConfiguration> + </component> + </settings> + <settings pass="specialize"> + <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <ComputerName>dc</ComputerName> + </component> + <component name="Microsoft-Windows-TCPIP" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <Interfaces> + <Interface wcm:action="add"> + <Ipv4Settings> + <DhcpEnabled>false</DhcpEnabled> + <Metric>10</Metric> + <RouterDiscoveryEnabled>false</RouterDiscoveryEnabled> + </Ipv4Settings> + <UnicastIpAddresses> + <IpAddress wcm:action="add" wcm:keyValue="1">192.168.199.4/24</IpAddress> + </UnicastIpAddresses> + <Identifier>Local Area Connection</Identifier> + <Routes> + <Route wcm:action="add"> + <Identifier>0</Identifier> + <Metric>10</Metric> + <NextHopAddress>192.168.199.2</NextHopAddress> + <Prefix>0.0.0.0/0</Prefix> + </Route> + </Routes> + </Interface> + </Interfaces> + </component> + <component name="Networking-MPSSVC-Svc" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <DomainProfile_EnableFirewall>false</DomainProfile_EnableFirewall> + <PrivateProfile_EnableFirewall>false</PrivateProfile_EnableFirewall> + <PublicProfile_EnableFirewall>false</PublicProfile_EnableFirewall> + </component> + <component name="Microsoft-Windows-OutOfBoxExperience" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <DoNotOpenInitialConfigurationTasksAtLogon>true</DoNotOpenInitialConfigurationTasksAtLogon> + </component> + <component name="Microsoft-Windows-ServerManager-SvrMgrNc" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <DoNotOpenServerManagerAtLogon>true</DoNotOpenServerManagerAtLogon> + </component> + <component name="Microsoft-Windows-TerminalServices-LocalSessionManager" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <fDenyTSConnections>false</fDenyTSConnections> + </component> + <component name="Microsoft-Windows-IE-ESC" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <IEHardenUser>false</IEHardenUser> + <IEHardenAdmin>false</IEHardenAdmin> + </component> + </settings> + <settings pass="oobeSystem"> + <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <AutoLogon> + <Password> + <Value>VgBNAHcAYQByAGUAMQAhAFAAYQBzAHMAdwBvAHIAZAA=</Value> + <PlainText>false</PlainText> + </Password> + <Enabled>true</Enabled> + <LogonCount>999</LogonCount> + <Username>administrator</Username> + </AutoLogon> + <FirstLogonCommands> + <SynchronousCommand wcm:action="add"> + <CommandLine>A:\Build.cmd</CommandLine> + <Description>Phase One Installer from A Drive</Description> + <Order>1</Order> + <RequiresUserInput>true</RequiresUserInput> + </SynchronousCommand> + <SynchronousCommand wcm:action="add"> + <CommandLine>D:\Build.cmd</CommandLine> + <Description>Phase One Installer from D Drive</Description> + <Order>2</Order> + <RequiresUserInput>true</RequiresUserInput> + </SynchronousCommand> + <SynchronousCommand wcm:action="add"> + <CommandLine>E:\Build.cmd</CommandLine> + <Description>Phase One Installer from E Drive</Description> + <Order>3</Order> + <RequiresUserInput>true</RequiresUserInput> + </SynchronousCommand> + </FirstLogonCommands> + <OOBE> + <HideEULAPage>true</HideEULAPage> + <HideWirelessSetupInOOBE>true</HideWirelessSetupInOOBE> + <NetworkLocation>Work</NetworkLocation> + </OOBE> + <UserAccounts> + <AdministratorPassword> + <Value>VgBNAHcAYQByAGUAMQAhAEEAZABtAGkAbgBpAHMAdAByAGEAdABvAHIAUABhAHMAcwB3AG8AcgBkAA==</Value> + <PlainText>false</PlainText> + </AdministratorPassword> + <LocalAccounts> + <LocalAccount wcm:action="add"> + <Password> + <Value>VgBNAHcAYQByAGUAMQAhAFAAYQBzAHMAdwBvAHIAZAA=</Value> + <PlainText>false</PlainText> + </Password> + <Description>vSphere Administrator</Description> + <DisplayName>VI Admin</DisplayName> + <Group>Administrators</Group> + <Name>vi-admin</Name> + </LocalAccount> + </LocalAccounts> + </UserAccounts> + </component> + </settings> + <cpi:offlineImage cpi:source="wim:d:/lab/win2k8r2sp1/sources/install.wim#Windows Server 2008 R2 SERVERSTANDARD" xmlns:cpi="urn:schemas-microsoft-com:cpi" /> +</unattend> diff --git a/SRC/DC2.flp b/SRC/DC2.flp new file mode 100644 index 0000000..9741d90 Binary files /dev/null and b/SRC/DC2.flp differ diff --git a/SRC/DC2/Build.cmd b/SRC/DC2/Build.cmd new file mode 100644 index 0000000..cdfa7f2 --- /dev/null +++ b/SRC/DC2/Build.cmd @@ -0,0 +1,55 @@ +@echo off +ver | find "6.1" > nul +if %ERRORLEVEL% == 0 goto ver_2K8 +ver | find "6.2" > nul +if %ERRORLEVEL% == 0 goto ver_2K12 +ver | find "6.3" > nul +if %ERRORLEVEL% == 0 goto ver_2K12 +Exit +:ver_2K8 +echo ** +echo * Building on Windows 2008 +echo * Building on Windows 2008 >> c:\buildlog.txt +echo * Setup recall of build script +echo * Setup recall of build script >> c:\buildlog.txt +copy \\192.168.199.7\Build\Automate\DC\Phase2.cmd c:\ >> c:\buildlog.txt +type \\192.168.199.7\Build\Automate\version.txt >> c:\buildlog.txt +echo ** +echo * Install DHCP +echo * Install DHCP >> c:\buildlog.txt +start /w ocsetup DHCPServer +echo * Enable DHCP +echo * Enable DHCP >> c:\buildlog.txt +sc config dhcpserver start= auto +reg add HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /v Build /t REG_SZ /d "cmd /c c:\Phase2.cmd" /f >> c:\buildlog.txt +echo ** +echo * Install Active Directory and reboot +copy \\192.168.199.7\Build\Automate\DC\dcpromo.txt c:\ >> c:\buildlog.txt +dcpromo /answer:c:\dcpromo.txt >> c:\buildlog.txt +Exit +:ver_2K12 +echo ** +echo * Building on Windows 2012 +echo * Building on Windows 2012 >> c:\buildlog.txt +echo * Set IP address +echo * Set IP address >> c:\buildlog.txt +netsh interface ip set address name="Ethernet" static 192.168.201.4 255.255.255.0 192.168.201.2 1 +netsh interface ip set dnsservsers name="Ethernet" address="192.168.199.4" primary +echo ** +echo * Install DHCP +echo * Install DHCP >> c:\buildlog.txt +Dism /online /enable-feature /featurename:DHCPServer +Dism /online /enable-feature /featurename:DHCPServer-Tools +Dism /online /enable-feature /featurename:DNS-Server-Full-Role +Dism /online /enable-feature /featurename:DNS-Server-Tools +Dism /online /enable-feature /featurename:DirectoryServices-DomainController +Dism /online /enable-feature /featurename:DirectoryServices-AdministrativeCenter +Dism /online /enable-feature /featurename:ActiveDirectory-PowerShell +sc config dhcpserver start= auto +echo * Setup recall of build script +copy \\192.168.199.7\Build\Automate\DC\Phase2.cmd c:\ >> c:\buildlog.txt +type \\192.168.199.7\Build\Automate\version.txt >> c:\buildlog.txt +reg add HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /v Build /t REG_SZ /d "cmd /c c:\Phase2.cmd" /f >> c:\buildlog.txt +copy \\192.168.199.7\Build\Automate\DC\dcpromo.ps1 c:\ +powershell c:\dcpromo.ps1 +Exit \ No newline at end of file diff --git a/SRC/DC2/DC2.flp b/SRC/DC2/DC2.flp new file mode 100644 index 0000000..837f650 Binary files /dev/null and b/SRC/DC2/DC2.flp differ diff --git a/SRC/DC2/autoUnattend.xml b/SRC/DC2/autoUnattend.xml new file mode 100644 index 0000000..e8b8250 --- /dev/null +++ b/SRC/DC2/autoUnattend.xml @@ -0,0 +1,163 @@ +<?xml version="1.0" encoding="utf-8"?> +<unattend xmlns="urn:schemas-microsoft-com:unattend"> + <settings pass="windowsPE"> + <component name="Microsoft-Windows-International-Core-WinPE" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <InputLocale>en-US</InputLocale> + <SystemLocale>en-US</SystemLocale> + <UILanguage>en-US</UILanguage> + <UILanguageFallback>en-US</UILanguageFallback> + <UserLocale>en-US</UserLocale> + </component> + <component name="Microsoft-Windows-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <ImageInstall> + <OSImage> + <InstallTo> + <DiskID>0</DiskID> + <PartitionID>1</PartitionID> + </InstallTo> + <InstallFrom> + <MetaData wcm:action="add"> + <Key>/IMAGE/INDEX</Key> + <Value>2</Value> + </MetaData> + </InstallFrom> + </OSImage> + </ImageInstall> + <UserData> + <AcceptEula>true</AcceptEula> + <FullName>Lab</FullName> + <Organization>Lab.local</Organization> + </UserData> + <DiskConfiguration> + <Disk wcm:action="add"> + <CreatePartitions> + <CreatePartition wcm:action="add"> + <Extend>true</Extend> + <Order>1</Order> + <Type>Primary</Type> + </CreatePartition> + </CreatePartitions> + <DiskID>0</DiskID> + <WillWipeDisk>true</WillWipeDisk> + </Disk> + </DiskConfiguration> + </component> + </settings> + <settings pass="specialize"> + <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <ComputerName>dc2</ComputerName> + </component> + <component name="Microsoft-Windows-TCPIP" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <Interfaces> + <Interface wcm:action="add"> + <Ipv4Settings> + <DhcpEnabled>false</DhcpEnabled> + <Metric>10</Metric> + <RouterDiscoveryEnabled>false</RouterDiscoveryEnabled> + </Ipv4Settings> + <UnicastIpAddresses> + <IpAddress wcm:action="add" wcm:keyValue="1">192.168.201.4/24</IpAddress> + </UnicastIpAddresses> + <Identifier>Local Area Connection</Identifier> + <Routes> + <Route wcm:action="add"> + <Identifier>0</Identifier> + <Metric>10</Metric> + <NextHopAddress>192.168.201.2</NextHopAddress> + <Prefix>0.0.0.0/0</Prefix> + </Route> + </Routes> + </Interface> + </Interfaces> + </component> + <component name="Microsoft-Windows-UnattendedJoin" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <Identification> + <Credentials> + <Domain>lab.local</Domain> + <Password>VMware1!</Password> + <Username>JoinUser</Username> + </Credentials> + <JoinDomain>lab.local</JoinDomain> + </Identification> + </component> + <component name="Microsoft-Windows-DNS-Client" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <DNSSuffixSearchOrder> + <DomainName wcm:action="add" wcm:keyValue="1">lab.local</DomainName> + </DNSSuffixSearchOrder> + <Interfaces> + <Interface wcm:action="add"> + <DNSServerSearchOrder> + <IpAddress wcm:action="add" wcm:keyValue="1">192.168.199.4</IpAddress> + </DNSServerSearchOrder> + <DisableDynamicUpdate>true</DisableDynamicUpdate> + <DNSDomain>lab.local</DNSDomain> + <EnableAdapterDomainNameRegistration>true</EnableAdapterDomainNameRegistration> + <Identifier>Local Area Connection</Identifier> + </Interface> + </Interfaces> + </component> + <component name="Networking-MPSSVC-Svc" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <DomainProfile_EnableFirewall>false</DomainProfile_EnableFirewall> + <PrivateProfile_EnableFirewall>false</PrivateProfile_EnableFirewall> + <PublicProfile_EnableFirewall>false</PublicProfile_EnableFirewall> + </component> + <component name="Microsoft-Windows-OutOfBoxExperience" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <DoNotOpenInitialConfigurationTasksAtLogon>true</DoNotOpenInitialConfigurationTasksAtLogon> + </component> + <component name="Microsoft-Windows-ServerManager-SvrMgrNc" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <DoNotOpenServerManagerAtLogon>true</DoNotOpenServerManagerAtLogon> + </component> + <component name="Microsoft-Windows-TerminalServices-LocalSessionManager" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <fDenyTSConnections>false</fDenyTSConnections> + </component> + <component name="Microsoft-Windows-IE-ESC" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <IEHardenUser>false</IEHardenUser> + <IEHardenAdmin>false</IEHardenAdmin> + </component> + </settings> + <settings pass="oobeSystem"> + <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <AutoLogon> + <Password> + <Value>VgBNAHcAYQByAGUAMQAhAFAAYQBzAHMAdwBvAHIAZAA=</Value> + <PlainText>false</PlainText> + </Password> + <Enabled>true</Enabled> + <LogonCount>999</LogonCount> + <Username>administrator</Username> + </AutoLogon> + <FirstLogonCommands> + <SynchronousCommand wcm:action="add"> + <CommandLine>a:\Build.cmd</CommandLine> + <Description>Phase One Installer</Description> + <Order>1</Order> + <RequiresUserInput>true</RequiresUserInput> + </SynchronousCommand> + </FirstLogonCommands> + <OOBE> + <HideEULAPage>true</HideEULAPage> + <HideWirelessSetupInOOBE>true</HideWirelessSetupInOOBE> + <NetworkLocation>Work</NetworkLocation> + </OOBE> + <UserAccounts> + <AdministratorPassword> + <Value>VgBNAHcAYQByAGUAMQAhAEEAZABtAGkAbgBpAHMAdAByAGEAdABvAHIAUABhAHMAcwB3AG8AcgBkAA==</Value> + <PlainText>false</PlainText> + </AdministratorPassword> + <LocalAccounts> + <LocalAccount wcm:action="add"> + <Password> + <Value>VgBNAHcAYQByAGUAMQAhAFAAYQBzAHMAdwBvAHIAZAA=</Value> + <PlainText>false</PlainText> + </Password> + <Description>vSphere Administrator</Description> + <DisplayName>VI Admin</DisplayName> + <Group>Administrators</Group> + <Name>vi-admin</Name> + </LocalAccount> + </LocalAccounts> + </UserAccounts> + </component> + </settings> + <cpi:offlineImage cpi:source="wim:d:/lab/win2k8r2sp1/sources/install.wim#Windows Server 2008 R2 SERVERSTANDARD" xmlns:cpi="urn:schemas-microsoft-com:cpi" /> +</unattend> diff --git a/SRC/MakeVMNet3.reg b/SRC/MakeVMNet3.reg new file mode 100644 index 0000000..044f776 --- /dev/null +++ b/SRC/MakeVMNet3.reg @@ -0,0 +1,12 @@ +Windows Registry Editor Version 5.00 + +[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\VMware, Inc.\VMnetLib\VMnetConfig\vmnet3] +"IPSubnetAddress"="192.168.199.0" +"IPSubnetMask"="255.255.255.0" + +[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\VMware, Inc.\VMnetLib\VMnetConfig\vmnet3\Adapter] +"UseAdapter"=dword:00000001 +"AdapterInstalled"=dword:00000001 + +[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\VMware, Inc.\VMnetLib\VMnetConfig\vmnet3\DHCP] +"UseDHCP"=dword:00000001 diff --git a/SRC/Nested2012/Build.cmd b/SRC/Nested2012/Build.cmd new file mode 100644 index 0000000..2337c54 --- /dev/null +++ b/SRC/Nested2012/Build.cmd @@ -0,0 +1,8 @@ +@echo off +echo ** +echo * Building on Windows 2012 R2 +echo * Building on Windows 2012 R2 >> c:\buildlog.txt +cscript //B "%windir%\system32\slmgr.vbs" /ato +\\nas\build\VMTools\setup64.exe /s /v "/qn" +pause +Exit \ No newline at end of file diff --git a/SRC/Nested2012/Nested2012.flp b/SRC/Nested2012/Nested2012.flp new file mode 100644 index 0000000..998dc72 Binary files /dev/null and b/SRC/Nested2012/Nested2012.flp differ diff --git a/SRC/Nested2012/autoUnattend.xml b/SRC/Nested2012/autoUnattend.xml new file mode 100644 index 0000000..8fed2c4 --- /dev/null +++ b/SRC/Nested2012/autoUnattend.xml @@ -0,0 +1,109 @@ +<?xml version="1.0" encoding="utf-8"?> +<unattend xmlns="urn:schemas-microsoft-com:unattend"> + <settings pass="windowsPE"> + <component name="Microsoft-Windows-International-Core-WinPE" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <InputLocale>en-US</InputLocale> + <SystemLocale>en-US</SystemLocale> + <UILanguage>en-US</UILanguage> + <UILanguageFallback>en-US</UILanguageFallback> + <UserLocale>en-US</UserLocale> + </component> + <component name="Microsoft-Windows-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <ImageInstall> + <OSImage> + <InstallTo> + <DiskID>0</DiskID> + <PartitionID>1</PartitionID> + </InstallTo> + <InstallFrom> + <MetaData wcm:action="add"> + <Key>/IMAGE/INDEX</Key> + <Value>2</Value> + </MetaData> + </InstallFrom> + </OSImage> + </ImageInstall> + <UserData> + <AcceptEula>true</AcceptEula> + <FullName>Lab</FullName> + <Organization>Lab.local</Organization> + </UserData> + <DiskConfiguration> + <Disk wcm:action="add"> + <CreatePartitions> + <CreatePartition wcm:action="add"> + <Extend>true</Extend> + <Order>1</Order> + <Type>Primary</Type> + </CreatePartition> + </CreatePartitions> + <DiskID>0</DiskID> + <WillWipeDisk>true</WillWipeDisk> + </Disk> + </DiskConfiguration> + </component> + </settings> + <settings pass="specialize"> + <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <ComputerName>Template2012</ComputerName> + </component> + <component name="Networking-MPSSVC-Svc" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <DomainProfile_EnableFirewall>false</DomainProfile_EnableFirewall> + <PrivateProfile_EnableFirewall>false</PrivateProfile_EnableFirewall> + <PublicProfile_EnableFirewall>false</PublicProfile_EnableFirewall> + </component> + <component name="Microsoft-Windows-ServerManager-SvrMgrNc" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <DoNotOpenServerManagerAtLogon>true</DoNotOpenServerManagerAtLogon> + </component> + <component name="Microsoft-Windows-TerminalServices-LocalSessionManager" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <fDenyTSConnections>false</fDenyTSConnections> + </component> + <component name="Microsoft-Windows-IE-ESC" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <IEHardenUser>false</IEHardenUser> + <IEHardenAdmin>false</IEHardenAdmin> + </component> + <component name="Microsoft-Windows-TCPIP" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <Interfaces> + <Interface wcm:action="add"> + <Ipv4Settings> + <DhcpEnabled>true</DhcpEnabled> + </Ipv4Settings> + <Identifier>1</Identifier> + </Interface> + </Interfaces> + </component> + </settings> + <settings pass="oobeSystem"> + <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <AutoLogon> + <Password> + <Value>VgBNAHcAYQByAGUAMQAhAFAAYQBzAHMAdwBvAHIAZAA=</Value> + <PlainText>false</PlainText> + </Password> + <Enabled>true</Enabled> + <LogonCount>999</LogonCount> + <Username>administrator</Username> + </AutoLogon> + <FirstLogonCommands> + <SynchronousCommand wcm:action="add"> + <CommandLine>a:\Build.cmd</CommandLine> + <Description>Phase One Installer</Description> + <Order>1</Order> + <RequiresUserInput>true</RequiresUserInput> + </SynchronousCommand> + </FirstLogonCommands> + <OOBE> + <HideEULAPage>true</HideEULAPage> + <HideWirelessSetupInOOBE>true</HideWirelessSetupInOOBE> + <NetworkLocation>Work</NetworkLocation> + </OOBE> + <UserAccounts> + <AdministratorPassword> + <Value>VgBNAHcAYQByAGUAMQAhAEEAZABtAGkAbgBpAHMAdAByAGEAdABvAHIAUABhAHMAcwB3AG8AcgBkAA==</Value> + <PlainText>false</PlainText> + </AdministratorPassword> + </UserAccounts> + </component> + </settings> + <cpi:offlineImage cpi:source="wim:d:/lab/windows%202012r2/install.wim#Windows Server 2012 R2 SERVERSTANDARD" xmlns:cpi="urn:schemas-microsoft-com:cpi" /> +</unattend> diff --git a/SRC/SS/SS.flp b/SRC/SS/SS.flp new file mode 100644 index 0000000..74fd88c Binary files /dev/null and b/SRC/SS/SS.flp differ diff --git a/SRC/SS/autoUnattend.xml b/SRC/SS/autoUnattend.xml new file mode 100644 index 0000000..8ce66ce --- /dev/null +++ b/SRC/SS/autoUnattend.xml @@ -0,0 +1,142 @@ +<?xml version="1.0" encoding="utf-8"?> +<unattend xmlns="urn:schemas-microsoft-com:unattend"> + <settings pass="windowsPE"> + <component name="Microsoft-Windows-International-Core-WinPE" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <InputLocale>en-US</InputLocale> + <SystemLocale>en-US</SystemLocale> + <UILanguage>en-US</UILanguage> + <UILanguageFallback>en-US</UILanguageFallback> + <UserLocale>en-US</UserLocale> + </component> + <component name="Microsoft-Windows-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <ImageInstall> + <OSImage> + <InstallTo> + <DiskID>0</DiskID> + <PartitionID>1</PartitionID> + </InstallTo> + <InstallFrom> + <MetaData wcm:action="add"> + <Key>/IMAGE/INDEX</Key> + <Value>1</Value> + </MetaData> + </InstallFrom> + </OSImage> + </ImageInstall> + <UserData> + <AcceptEula>true</AcceptEula> + <FullName>Lab</FullName> + <Organization>Lab.local</Organization> + </UserData> + <DiskConfiguration> + <Disk wcm:action="add"> + <CreatePartitions> + <CreatePartition wcm:action="add"> + <Extend>true</Extend> + <Order>1</Order> + <Type>Primary</Type> + </CreatePartition> + </CreatePartitions> + <DiskID>0</DiskID> + <WillWipeDisk>true</WillWipeDisk> + </Disk> + </DiskConfiguration> + </component> + </settings> + <settings pass="specialize"> + <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <ComputerName>SS</ComputerName> + </component> + <component name="Microsoft-Windows-TCPIP" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <Interfaces> + <Interface wcm:action="add"> + <Ipv4Settings> + <DhcpEnabled>false</DhcpEnabled> + <Metric>10</Metric> + <RouterDiscoveryEnabled>false</RouterDiscoveryEnabled> + </Ipv4Settings> + <UnicastIpAddresses> + <IpAddress wcm:action="add" wcm:keyValue="1">192.168.199.35/24</IpAddress> + </UnicastIpAddresses> + <Identifier>Local Area Connection</Identifier> + <Routes> + <Route wcm:action="add"> + <Identifier>0</Identifier> + <Metric>10</Metric> + <NextHopAddress>192.168.199.2</NextHopAddress> + <Prefix>0.0.0.0/0</Prefix> + </Route> + </Routes> + </Interface> + </Interfaces> + </component> + <component name="Microsoft-Windows-UnattendedJoin" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <Identification> + <Credentials> + <Domain>lab.local</Domain> + <Password>VMware1!</Password> + <Username>JoinUser</Username> + </Credentials> + <JoinDomain>lab.local</JoinDomain> + </Identification> + </component> + <component name="Microsoft-Windows-DNS-Client" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <DNSSuffixSearchOrder> + <DomainName wcm:action="add" wcm:keyValue="1">lab.local</DomainName> + </DNSSuffixSearchOrder> + <Interfaces> + <Interface wcm:action="add"> + <DNSServerSearchOrder> + <IpAddress wcm:action="add" wcm:keyValue="1">192.168.199.4</IpAddress> + </DNSServerSearchOrder> + <DisableDynamicUpdate>true</DisableDynamicUpdate> + <DNSDomain>lab.local</DNSDomain> + <EnableAdapterDomainNameRegistration>true</EnableAdapterDomainNameRegistration> + <Identifier>Local Area Connection</Identifier> + </Interface> + </Interfaces> + </component> + <component name="Microsoft-Windows-ServerManager-SvrMgrNc" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <DoNotOpenServerManagerAtLogon>true</DoNotOpenServerManagerAtLogon> + </component> + <component name="Microsoft-Windows-OutOfBoxExperience" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <DoNotOpenInitialConfigurationTasksAtLogon>true</DoNotOpenInitialConfigurationTasksAtLogon> + </component> + <component name="Microsoft-Windows-TerminalServices-LocalSessionManager" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <fDenyTSConnections>false</fDenyTSConnections> + </component> + </settings> + <settings pass="oobeSystem"> + <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <AutoLogon> + <Password> + <Value>VgBNAHcAYQByAGUAMQAhAFAAYQBzAHMAdwBvAHIAZAA=</Value> + <PlainText>false</PlainText> + </Password> + <Enabled>true</Enabled> + <LogonCount>99</LogonCount> + <Username>SS\administrator</Username> + </AutoLogon> + <OOBE> + <HideEULAPage>true</HideEULAPage> + <HideWirelessSetupInOOBE>true</HideWirelessSetupInOOBE> + <NetworkLocation>Work</NetworkLocation> + </OOBE> + <UserAccounts> + <AdministratorPassword> + <Value>VgBNAHcAYQByAGUAMQAhAEEAZABtAGkAbgBpAHMAdAByAGEAdABvAHIAUABhAHMAcwB3AG8AcgBkAA==</Value> + <PlainText>false</PlainText> + </AdministratorPassword> + </UserAccounts> + <FirstLogonCommands> + <SynchronousCommand wcm:action="add"> + <CommandLine>a:\Build.cmd</CommandLine> + <Description>Build</Description> + <Order>1</Order> + <RequiresUserInput>true</RequiresUserInput> + </SynchronousCommand> + </FirstLogonCommands> + </component> + </settings> + <cpi:offlineImage cpi:source="wim:d:/community%20lab%20guide/installers/2k8r2/sources/install.wim#Windows Server 2008 R2 SERVERSTANDARD" xmlns:cpi="urn:schemas-microsoft-com:cpi" /> +</unattend> diff --git a/SRC/SS/build.cmd b/SRC/SS/build.cmd new file mode 100644 index 0000000..7ca5d70 --- /dev/null +++ b/SRC/SS/build.cmd @@ -0,0 +1,33 @@ +@echo off +type \\192.168.199.7\Build\Automate\version.txt >> c:\buildlog.txt +ver | find "6.1" > nul +if %ERRORLEVEL% == 0 goto ver_2K8 +ver | find "6.2" > nul +if %ERRORLEVEL% == 0 goto ver_2K12 +ver | find "6.3" > nul +if %ERRORLEVEL% == 0 goto ver_2K12 +goto RunBuild +:ver_2K8 +goto RunBuild +:ver_2K12 +netsh interface ip set address name="Ethernet" static 192.168.199.35 255.255.255.0 192.168.199.2 1 +netsh interface ip set dnsservers name="Ethernet" static address=192.168.199.4 primary +Dism /online /enable-feature /featurename:NetFx3ServerFeatures +Dism /online /enable-feature /featurename:NetFx3 /source:D:\Sources\sxs +copy \\192.168.199.7\Build\Automate\DC\ocsetup.exe c:\windows\system32\ +echo * Mount Install Image +echo * Mount Install Image >> c:\buildlog.txt +mkdir c:\mountdir +Dism /mount-wim /WimFile:D:\sources\install.wim /Index:2 /MountDir:c:\mountdir /readonly /quiet +echo * Setup recall of build script +copy \\192.168.199.7\Build\automate\%computername%\Build.cmd c:\ +type \\192.168.199.7\Build\Automate\version.txt >> c:\buildlog.txt +reg add HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run /v Build /t REG_SZ /d "cmd /c c:\build.cmd" /f >> c:\buildlog.txt +echo * Install GUI onto Server Core +echo * Install GUI onto Server Core >> c:\buildlog.txt +Dism /online /enable-feature /featurename:server-gui-shell /all /source:c:\mountdir\windows\winsxs /quiet +Pause +goto RunBuild +:RunBuild +copy \\192.168.199.7\Build\automate\%computername%\Build.cmd c:\ +c:\build.cmd \ No newline at end of file diff --git a/SRC/V1/autoUnattend.xml b/SRC/V1/autoUnattend.xml new file mode 100644 index 0000000..6724808 --- /dev/null +++ b/SRC/V1/autoUnattend.xml @@ -0,0 +1,158 @@ +<?xml version="1.0" encoding="utf-8"?> +<unattend xmlns="urn:schemas-microsoft-com:unattend"> + <settings pass="windowsPE"> + <component name="Microsoft-Windows-International-Core-WinPE" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <InputLocale>en-US</InputLocale> + <SystemLocale>en-US</SystemLocale> + <UILanguage>en-US</UILanguage> + <UILanguageFallback>en-US</UILanguageFallback> + <UserLocale>en-US</UserLocale> + </component> + <component name="Microsoft-Windows-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <ImageInstall> + <OSImage> + <InstallTo> + <DiskID>0</DiskID> + <PartitionID>1</PartitionID> + </InstallTo> + <InstallFrom> + <MetaData wcm:action="add"> + <Key>/IMAGE/INDEX</Key> + <Value>1</Value> + </MetaData> + </InstallFrom> + </OSImage> + </ImageInstall> + <UserData> + <AcceptEula>true</AcceptEula> + <FullName>Lab</FullName> + <Organization>Lab.local</Organization> + </UserData> + <DiskConfiguration> + <Disk wcm:action="add"> + <CreatePartitions> + <CreatePartition wcm:action="add"> + <Extend>true</Extend> + <Order>1</Order> + <Type>Primary</Type> + </CreatePartition> + </CreatePartitions> + <DiskID>0</DiskID> + <WillWipeDisk>true</WillWipeDisk> + </Disk> + </DiskConfiguration> + </component> + </settings> + <settings pass="specialize"> + <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <ComputerName>V1</ComputerName> + </component> + <component name="Microsoft-Windows-TCPIP" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <Interfaces> + <Interface wcm:action="add"> + <Ipv4Settings> + <DhcpEnabled>false</DhcpEnabled> + <Metric>10</Metric> + <RouterDiscoveryEnabled>false</RouterDiscoveryEnabled> + </Ipv4Settings> + <UnicastIpAddresses> + <IpAddress wcm:action="add" wcm:keyValue="1">192.168.199.36/24</IpAddress> + </UnicastIpAddresses> + <Identifier>Local Area Connection</Identifier> + <Routes> + <Route wcm:action="add"> + <Identifier>0</Identifier> + <Metric>10</Metric> + <NextHopAddress>192.168.199.2</NextHopAddress> + <Prefix>0.0.0.0/0</Prefix> + </Route> + </Routes> + </Interface> + </Interfaces> + </component> + <component name="Microsoft-Windows-UnattendedJoin" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <Identification> + <Credentials> + <Domain>lab.local</Domain> + <Password>VMware1!</Password> + <Username>Administrator</Username> + </Credentials> + <JoinDomain>lab.local</JoinDomain> + </Identification> + </component> + <component name="Microsoft-Windows-DNS-Client" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <DNSSuffixSearchOrder> + <DomainName wcm:action="add" wcm:keyValue="1">lab.local</DomainName> + </DNSSuffixSearchOrder> + <Interfaces> + <Interface wcm:action="add"> + <DNSServerSearchOrder> + <IpAddress wcm:action="add" wcm:keyValue="1">192.168.199.4</IpAddress> + </DNSServerSearchOrder> + <DisableDynamicUpdate>true</DisableDynamicUpdate> + <DNSDomain>lab.local</DNSDomain> + <EnableAdapterDomainNameRegistration>true</EnableAdapterDomainNameRegistration> + <Identifier>Local Area Connection</Identifier> + </Interface> + </Interfaces> + </component> + <component name="Microsoft-Windows-ServerManager-SvrMgrNc" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <DoNotOpenServerManagerAtLogon>true</DoNotOpenServerManagerAtLogon> + </component> + <component name="Microsoft-Windows-OutOfBoxExperience" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <DoNotOpenInitialConfigurationTasksAtLogon>true</DoNotOpenInitialConfigurationTasksAtLogon> + </component> + <component name="Networking-MPSSVC-Svc" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <DomainProfile_EnableFirewall>false</DomainProfile_EnableFirewall> + <PrivateProfile_EnableFirewall>false</PrivateProfile_EnableFirewall> + <PublicProfile_EnableFirewall>false</PublicProfile_EnableFirewall> + </component> + <component name="Microsoft-Windows-TerminalServices-LocalSessionManager" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <fDenyTSConnections>false</fDenyTSConnections> + </component> + <component name="Microsoft-Windows-IE-InternetExplorer" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <TrustedSites>http://v1</TrustedSites> + <DisableAccelerators>true</DisableAccelerators> + <DisableOOBAccelerators>true</DisableOOBAccelerators> + <DisableFirstRunWizard>true</DisableFirstRunWizard> + <EnableLinksBar>false</EnableLinksBar> + </component> + <component name="Microsoft-Windows-IE-ESC" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <IEHardenAdmin>false</IEHardenAdmin> + <IEHardenUser>false</IEHardenUser> + </component> + </settings> + <settings pass="oobeSystem"> + <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <AutoLogon> + <Password> + <Value>VgBNAHcAYQByAGUAMQAhAFAAYQBzAHMAdwBvAHIAZAA=</Value> + <PlainText>false</PlainText> + </Password> + <Enabled>true</Enabled> + <LogonCount>99</LogonCount> + <Username>lab\svc_veeam</Username> + </AutoLogon> + <OOBE> + <HideEULAPage>true</HideEULAPage> + <HideWirelessSetupInOOBE>true</HideWirelessSetupInOOBE> + <NetworkLocation>Work</NetworkLocation> + </OOBE> + <UserAccounts> + <AdministratorPassword> + <Value>VgBNAHcAYQByAGUAMQAhAEEAZABtAGkAbgBpAHMAdAByAGEAdABvAHIAUABhAHMAcwB3AG8AcgBkAA==</Value> + <PlainText>false</PlainText> + </AdministratorPassword> + </UserAccounts> + <FirstLogonCommands> + <SynchronousCommand wcm:action="add"> + <CommandLine>a:\Build.cmd</CommandLine> + <Description>Build</Description> + <Order>1</Order> + <RequiresUserInput>true</RequiresUserInput> + </SynchronousCommand> + </FirstLogonCommands> + </component> + </settings> + <cpi:offlineImage cpi:source="wim:d:/lab/win2k8r2sp1/sources/install.wim#Windows Server 2008 R2 SERVERSTANDARD" xmlns:cpi="urn:schemas-microsoft-com:cpi" /> +</unattend> diff --git a/SRC/V1/build.cmd b/SRC/V1/build.cmd new file mode 100644 index 0000000..db2bf0f --- /dev/null +++ b/SRC/V1/build.cmd @@ -0,0 +1 @@ +\\192.168.199.7\Build\automate\%computername%\Build.cmd \ No newline at end of file diff --git a/SRC/VBR/autoUnattend.xml b/SRC/VBR/autoUnattend.xml new file mode 100644 index 0000000..d580bf6 --- /dev/null +++ b/SRC/VBR/autoUnattend.xml @@ -0,0 +1,158 @@ +<?xml version="1.0" encoding="utf-8"?> +<unattend xmlns="urn:schemas-microsoft-com:unattend"> + <settings pass="windowsPE"> + <component name="Microsoft-Windows-International-Core-WinPE" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <InputLocale>en-US</InputLocale> + <SystemLocale>en-US</SystemLocale> + <UILanguage>en-US</UILanguage> + <UILanguageFallback>en-US</UILanguageFallback> + <UserLocale>en-US</UserLocale> + </component> + <component name="Microsoft-Windows-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <ImageInstall> + <OSImage> + <InstallTo> + <DiskID>0</DiskID> + <PartitionID>1</PartitionID> + </InstallTo> + <InstallFrom> + <MetaData wcm:action="add"> + <Key>/IMAGE/INDEX</Key> + <Value>1</Value> + </MetaData> + </InstallFrom> + </OSImage> + </ImageInstall> + <UserData> + <AcceptEula>true</AcceptEula> + <FullName>Lab</FullName> + <Organization>Lab.local</Organization> + </UserData> + <DiskConfiguration> + <Disk wcm:action="add"> + <CreatePartitions> + <CreatePartition wcm:action="add"> + <Extend>true</Extend> + <Order>1</Order> + <Type>Primary</Type> + </CreatePartition> + </CreatePartitions> + <DiskID>0</DiskID> + <WillWipeDisk>true</WillWipeDisk> + </Disk> + </DiskConfiguration> + </component> + </settings> + <settings pass="specialize"> + <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <ComputerName>VBR</ComputerName> + </component> + <component name="Microsoft-Windows-TCPIP" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <Interfaces> + <Interface wcm:action="add"> + <Ipv4Settings> + <DhcpEnabled>false</DhcpEnabled> + <Metric>10</Metric> + <RouterDiscoveryEnabled>false</RouterDiscoveryEnabled> + </Ipv4Settings> + <UnicastIpAddresses> + <IpAddress wcm:action="add" wcm:keyValue="1">192.168.199.37/24</IpAddress> + </UnicastIpAddresses> + <Identifier>Local Area Connection</Identifier> + <Routes> + <Route wcm:action="add"> + <Identifier>0</Identifier> + <Metric>10</Metric> + <NextHopAddress>192.168.199.2</NextHopAddress> + <Prefix>0.0.0.0/0</Prefix> + </Route> + </Routes> + </Interface> + </Interfaces> + </component> + <component name="Microsoft-Windows-UnattendedJoin" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <Identification> + <Credentials> + <Domain>lab.local</Domain> + <Password>VMware1!</Password> + <Username>Administrator</Username> + </Credentials> + <JoinDomain>lab.local</JoinDomain> + </Identification> + </component> + <component name="Microsoft-Windows-DNS-Client" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <DNSSuffixSearchOrder> + <DomainName wcm:action="add" wcm:keyValue="1">lab.local</DomainName> + </DNSSuffixSearchOrder> + <Interfaces> + <Interface wcm:action="add"> + <DNSServerSearchOrder> + <IpAddress wcm:action="add" wcm:keyValue="1">192.168.199.4</IpAddress> + </DNSServerSearchOrder> + <DisableDynamicUpdate>true</DisableDynamicUpdate> + <DNSDomain>lab.local</DNSDomain> + <EnableAdapterDomainNameRegistration>true</EnableAdapterDomainNameRegistration> + <Identifier>Local Area Connection</Identifier> + </Interface> + </Interfaces> + </component> + <component name="Microsoft-Windows-ServerManager-SvrMgrNc" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <DoNotOpenServerManagerAtLogon>true</DoNotOpenServerManagerAtLogon> + </component> + <component name="Microsoft-Windows-OutOfBoxExperience" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <DoNotOpenInitialConfigurationTasksAtLogon>true</DoNotOpenInitialConfigurationTasksAtLogon> + </component> + <component name="Networking-MPSSVC-Svc" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <DomainProfile_EnableFirewall>false</DomainProfile_EnableFirewall> + <PrivateProfile_EnableFirewall>false</PrivateProfile_EnableFirewall> + <PublicProfile_EnableFirewall>false</PublicProfile_EnableFirewall> + </component> + <component name="Microsoft-Windows-TerminalServices-LocalSessionManager" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <fDenyTSConnections>false</fDenyTSConnections> + </component> + <component name="Microsoft-Windows-IE-InternetExplorer" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <TrustedSites>http://v1</TrustedSites> + <DisableAccelerators>true</DisableAccelerators> + <DisableOOBAccelerators>true</DisableOOBAccelerators> + <DisableFirstRunWizard>true</DisableFirstRunWizard> + <EnableLinksBar>false</EnableLinksBar> + </component> + <component name="Microsoft-Windows-IE-ESC" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <IEHardenUser>false</IEHardenUser> + <IEHardenAdmin>false</IEHardenAdmin> + </component> + </settings> + <settings pass="oobeSystem"> + <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <AutoLogon> + <Password> + <Value>VgBNAHcAYQByAGUAMQAhAFAAYQBzAHMAdwBvAHIAZAA=</Value> + <PlainText>false</PlainText> + </Password> + <Enabled>true</Enabled> + <LogonCount>99</LogonCount> + <Username>lab\svc_veeam</Username> + </AutoLogon> + <OOBE> + <HideEULAPage>true</HideEULAPage> + <HideWirelessSetupInOOBE>true</HideWirelessSetupInOOBE> + <NetworkLocation>Work</NetworkLocation> + </OOBE> + <UserAccounts> + <AdministratorPassword> + <Value>VgBNAHcAYQByAGUAMQAhAEEAZABtAGkAbgBpAHMAdAByAGEAdABvAHIAUABhAHMAcwB3AG8AcgBkAA==</Value> + <PlainText>false</PlainText> + </AdministratorPassword> + </UserAccounts> + <FirstLogonCommands> + <SynchronousCommand wcm:action="add"> + <CommandLine>a:\Build.cmd</CommandLine> + <Description>Build</Description> + <Order>1</Order> + <RequiresUserInput>true</RequiresUserInput> + </SynchronousCommand> + </FirstLogonCommands> + </component> + </settings> + <cpi:offlineImage cpi:source="wim:d:/lab/win2k8r2sp1/sources/install.wim#Windows Server 2008 R2 SERVERSTANDARD" xmlns:cpi="urn:schemas-microsoft-com:cpi" /> +</unattend> diff --git a/SRC/VBR/build.cmd b/SRC/VBR/build.cmd new file mode 100644 index 0000000..db2bf0f --- /dev/null +++ b/SRC/VBR/build.cmd @@ -0,0 +1 @@ +\\192.168.199.7\Build\automate\%computername%\Build.cmd \ No newline at end of file diff --git a/SRC/VC.flp b/SRC/VC.flp new file mode 100644 index 0000000..6a6174b Binary files /dev/null and b/SRC/VC.flp differ diff --git a/SRC/VC/Build.cmd b/SRC/VC/Build.cmd new file mode 100644 index 0000000..e418767 --- /dev/null +++ b/SRC/VC/Build.cmd @@ -0,0 +1,49 @@ +@echo off +type \\192.168.199.7\Build\Automate\version.txt >> c:\buildlog.txt +ver | find "6.1" > nul +if %ERRORLEVEL% == 0 goto ver_2K8 +ver | find "6.2" > nul +if %ERRORLEVEL% == 0 goto ver_2K12 +ver | find "6.3" > nul +if %ERRORLEVEL% == 0 goto ver_2K12 +goto RunBuild +:ver_2K8 +goto RunBuild +:ver_2K12 +echo ** +echo * Building on Windows 2012 +echo * Building on Windows 2012 >> c:\buildlog.txt +echo * Set IP address +echo * Set IP address >> c:\buildlog.txt +netsh interface ip set address "Ethernet" static 192.168.199.5 255.255.255.0 192.168.199.2 1 +netsh interface ip set dnsservers "Ethernet" static 192.168.199.4 primary +echo * Install .Net 3 +echo * Install .Net 3 >> c:\buildlog.txt +Dism /online /enable-feature /featurename:NetFx3ServerFeatures /quiet +Dism /online /enable-feature /featurename:NetFx3 /source:D:\Sources\sxs /quiet +copy \\192.168.199.7\Build\Automate\DC\ocsetup.exe c:\windows\system32\ +echo * Install Setup recall of build script +echo * Install Setup recall of build script >> c:\buildlog.txt +copy \\192.168.199.7\Build\automate\%computername%\Build.cmd c:\ +reg add HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce /v Build /t REG_SZ /d "cmd /c c:\Build.cmd" /f >> c:\buildlog.txt +echo * Mount Install Image +echo * Mount Install Image >> c:\buildlog.txt +mkdir c:\mountdir +If Exist D:\sources\install.wim Dism /mount-wim /WimFile:D:\sources\install.wim /Index:2 /MountDir:c:\mountdir /readonly /quiet +If Exist E:\sources\install.wim Dism /mount-wim /WimFile:E:\sources\install.wim /Index:2 /MountDir:c:\mountdir /readonly /quiet +echo * Install GUI onto Server Core +echo * Install GUI onto Server Core >> c:\buildlog.txt +Dism /online /enable-feature /featurename:server-gui-mgmt /all /source:c:\mountdir\windows\winsxs /quiet /norestart +Dism /online /enable-feature /featurename:server-gui-shell /all /source:c:\mountdir\windows\winsxs /quiet /norestart +Dism /online /enable-feature /featurename:servercore-fullserver /all /source:c:\mountdir\windows\winsxs /quiet /norestart +echo * Install Media Foundation +echo * Install Media Foundation >> c:\buildlog.txt +Dism /online /enable-feature /featurename:ServerMediaFoundation /all /source:c:\mountdir\windows\winsxs /quiet /norestart +echo * Install Desktop Experience +echo * Install Desktop Experience >> c:\buildlog.txt +Dism /online /enable-feature /featurename:DesktopExperience /all /source:c:\mountdir\windows\winsxs /quiet +pause +:RunBuild +copy \\192.168.199.7\Build\automate\%computername%\Build.cmd c:\ +c:\build.cmd +Exit \ No newline at end of file diff --git a/SRC/VC/Ravello/Build.cmd b/SRC/VC/Ravello/Build.cmd new file mode 100644 index 0000000..e418767 --- /dev/null +++ b/SRC/VC/Ravello/Build.cmd @@ -0,0 +1,49 @@ +@echo off +type \\192.168.199.7\Build\Automate\version.txt >> c:\buildlog.txt +ver | find "6.1" > nul +if %ERRORLEVEL% == 0 goto ver_2K8 +ver | find "6.2" > nul +if %ERRORLEVEL% == 0 goto ver_2K12 +ver | find "6.3" > nul +if %ERRORLEVEL% == 0 goto ver_2K12 +goto RunBuild +:ver_2K8 +goto RunBuild +:ver_2K12 +echo ** +echo * Building on Windows 2012 +echo * Building on Windows 2012 >> c:\buildlog.txt +echo * Set IP address +echo * Set IP address >> c:\buildlog.txt +netsh interface ip set address "Ethernet" static 192.168.199.5 255.255.255.0 192.168.199.2 1 +netsh interface ip set dnsservers "Ethernet" static 192.168.199.4 primary +echo * Install .Net 3 +echo * Install .Net 3 >> c:\buildlog.txt +Dism /online /enable-feature /featurename:NetFx3ServerFeatures /quiet +Dism /online /enable-feature /featurename:NetFx3 /source:D:\Sources\sxs /quiet +copy \\192.168.199.7\Build\Automate\DC\ocsetup.exe c:\windows\system32\ +echo * Install Setup recall of build script +echo * Install Setup recall of build script >> c:\buildlog.txt +copy \\192.168.199.7\Build\automate\%computername%\Build.cmd c:\ +reg add HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce /v Build /t REG_SZ /d "cmd /c c:\Build.cmd" /f >> c:\buildlog.txt +echo * Mount Install Image +echo * Mount Install Image >> c:\buildlog.txt +mkdir c:\mountdir +If Exist D:\sources\install.wim Dism /mount-wim /WimFile:D:\sources\install.wim /Index:2 /MountDir:c:\mountdir /readonly /quiet +If Exist E:\sources\install.wim Dism /mount-wim /WimFile:E:\sources\install.wim /Index:2 /MountDir:c:\mountdir /readonly /quiet +echo * Install GUI onto Server Core +echo * Install GUI onto Server Core >> c:\buildlog.txt +Dism /online /enable-feature /featurename:server-gui-mgmt /all /source:c:\mountdir\windows\winsxs /quiet /norestart +Dism /online /enable-feature /featurename:server-gui-shell /all /source:c:\mountdir\windows\winsxs /quiet /norestart +Dism /online /enable-feature /featurename:servercore-fullserver /all /source:c:\mountdir\windows\winsxs /quiet /norestart +echo * Install Media Foundation +echo * Install Media Foundation >> c:\buildlog.txt +Dism /online /enable-feature /featurename:ServerMediaFoundation /all /source:c:\mountdir\windows\winsxs /quiet /norestart +echo * Install Desktop Experience +echo * Install Desktop Experience >> c:\buildlog.txt +Dism /online /enable-feature /featurename:DesktopExperience /all /source:c:\mountdir\windows\winsxs /quiet +pause +:RunBuild +copy \\192.168.199.7\Build\automate\%computername%\Build.cmd c:\ +c:\build.cmd +Exit \ No newline at end of file diff --git a/SRC/VC/Ravello/VC-Config.iso b/SRC/VC/Ravello/VC-Config.iso new file mode 100644 index 0000000..49eff94 Binary files /dev/null and b/SRC/VC/Ravello/VC-Config.iso differ diff --git a/SRC/VC/Ravello/VC-Config.iso.uibak b/SRC/VC/Ravello/VC-Config.iso.uibak new file mode 100644 index 0000000..906baa8 Binary files /dev/null and b/SRC/VC/Ravello/VC-Config.iso.uibak differ diff --git a/SRC/VC/Ravello/autoUnattend.xml b/SRC/VC/Ravello/autoUnattend.xml new file mode 100644 index 0000000..2da2d63 --- /dev/null +++ b/SRC/VC/Ravello/autoUnattend.xml @@ -0,0 +1,168 @@ +<?xml version="1.0" encoding="utf-8"?> +<unattend xmlns="urn:schemas-microsoft-com:unattend"> + <settings pass="windowsPE"> + <component name="Microsoft-Windows-International-Core-WinPE" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <InputLocale>en-US</InputLocale> + <SystemLocale>en-US</SystemLocale> + <UILanguage>en-US</UILanguage> + <UILanguageFallback>en-US</UILanguageFallback> + <UserLocale>en-US</UserLocale> + </component> + <component name="Microsoft-Windows-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <ImageInstall> + <OSImage> + <InstallTo> + <DiskID>0</DiskID> + <PartitionID>1</PartitionID> + </InstallTo> + <InstallFrom> + <MetaData wcm:action="add"> + <Key>/IMAGE/INDEX</Key> + <Value>2</Value> + </MetaData> + </InstallFrom> + </OSImage> + </ImageInstall> + <UserData> + <AcceptEula>true</AcceptEula> + <FullName>Lab</FullName> + <Organization>Lab.local</Organization> + </UserData> + <DiskConfiguration> + <Disk wcm:action="add"> + <CreatePartitions> + <CreatePartition wcm:action="add"> + <Extend>true</Extend> + <Order>1</Order> + <Type>Primary</Type> + </CreatePartition> + </CreatePartitions> + <DiskID>0</DiskID> + <WillWipeDisk>true</WillWipeDisk> + </Disk> + </DiskConfiguration> + </component> + </settings> + <settings pass="specialize"> + <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <ComputerName>vc</ComputerName> + </component> + <component name="Microsoft-Windows-TCPIP" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <Interfaces> + <Interface wcm:action="add"> + <Ipv4Settings> + <DhcpEnabled>false</DhcpEnabled> + <Metric>10</Metric> + <RouterDiscoveryEnabled>false</RouterDiscoveryEnabled> + </Ipv4Settings> + <UnicastIpAddresses> + <IpAddress wcm:action="add" wcm:keyValue="1">192.168.199.5/24</IpAddress> + </UnicastIpAddresses> + <Identifier>Local Area Connection</Identifier> + <Routes> + <Route wcm:action="add"> + <Identifier>0</Identifier> + <Metric>10</Metric> + <NextHopAddress>192.168.199.2</NextHopAddress> + <Prefix>0.0.0.0/0</Prefix> + </Route> + </Routes> + </Interface> + </Interfaces> + </component> + <component name="Microsoft-Windows-UnattendedJoin" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <Identification> + <Credentials> + <Domain>lab.local</Domain> + <Password>VMware1!</Password> + <Username>JoinUser</Username> + </Credentials> + <JoinDomain>lab.local</JoinDomain> + </Identification> + </component> + <component name="Microsoft-Windows-DNS-Client" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <DNSSuffixSearchOrder> + <DomainName wcm:action="add" wcm:keyValue="1">lab.local</DomainName> + </DNSSuffixSearchOrder> + <Interfaces> + <Interface wcm:action="add"> + <DNSServerSearchOrder> + <IpAddress wcm:action="add" wcm:keyValue="1">192.168.199.4</IpAddress> + </DNSServerSearchOrder> + <DisableDynamicUpdate>true</DisableDynamicUpdate> + <DNSDomain>lab.local</DNSDomain> + <EnableAdapterDomainNameRegistration>true</EnableAdapterDomainNameRegistration> + <Identifier>Local Area Connection</Identifier> + </Interface> + </Interfaces> + </component> + <component name="Microsoft-Windows-ServerManager-SvrMgrNc" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <DoNotOpenServerManagerAtLogon>true</DoNotOpenServerManagerAtLogon> + </component> + <component name="Microsoft-Windows-OutOfBoxExperience" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <DoNotOpenInitialConfigurationTasksAtLogon>true</DoNotOpenInitialConfigurationTasksAtLogon> + </component> + <component name="Networking-MPSSVC-Svc" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <DomainProfile_EnableFirewall>false</DomainProfile_EnableFirewall> + <PrivateProfile_EnableFirewall>false</PrivateProfile_EnableFirewall> + <PublicProfile_EnableFirewall>false</PublicProfile_EnableFirewall> + </component> + <component name="Microsoft-Windows-TerminalServices-LocalSessionManager" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <fDenyTSConnections>false</fDenyTSConnections> + </component> + <component name="Microsoft-Windows-IE-InternetExplorer" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <TrustedSites>https://*.lab.local;http://*.lab.local;http://v1</TrustedSites> + <DisableFirstRunWizard>true</DisableFirstRunWizard> + <DisableOOBAccelerators>true</DisableOOBAccelerators> + </component> + <component name="Microsoft-Windows-IE-ESC" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <IEHardenAdmin>false</IEHardenAdmin> + <IEHardenUser>false</IEHardenUser> + </component> + </settings> + <settings pass="oobeSystem"> + <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <AutoLogon> + <Password> + <Value>VgBNAHcAYQByAGUAMQAhAFAAYQBzAHMAdwBvAHIAZAA=</Value> + <PlainText>false</PlainText> + </Password> + <Enabled>true</Enabled> + <LogonCount>99</LogonCount> + <Username>vc\Administrator</Username> + </AutoLogon> + <OOBE> + <HideEULAPage>true</HideEULAPage> + <HideWirelessSetupInOOBE>true</HideWirelessSetupInOOBE> + <NetworkLocation>Work</NetworkLocation> + </OOBE> + <UserAccounts> + <AdministratorPassword> + <Value>VgBNAHcAYQByAGUAMQAhAEEAZABtAGkAbgBpAHMAdAByAGEAdABvAHIAUABhAHMAcwB3AG8AcgBkAA==</Value> + <PlainText>false</PlainText> + </AdministratorPassword> + </UserAccounts> + <FirstLogonCommands> + <SynchronousCommand wcm:action="add"> + <CommandLine>A:\Build.cmd</CommandLine> + <Description>Phase One Installer from A Drive</Description> + <Order>1</Order> + <RequiresUserInput>true</RequiresUserInput> + </SynchronousCommand> + <SynchronousCommand wcm:action="add"> + <CommandLine>D:\Build.cmd</CommandLine> + <Description>Phase One Installer from D Drive</Description> + <Order>2</Order> + <RequiresUserInput>true</RequiresUserInput> + </SynchronousCommand> + <SynchronousCommand wcm:action="add"> + <CommandLine>E:\Build.cmd</CommandLine> + <Description>Phase One Installer from E Drive</Description> + <Order>3</Order> + <RequiresUserInput>true</RequiresUserInput> + </SynchronousCommand> + </FirstLogonCommands> + </component> + </settings> + <cpi:offlineImage cpi:source="wim:d:/lab/win2k8r2sp1/sources/install.wim#Windows Server 2008 R2 SERVERSTANDARD" xmlns:cpi="urn:schemas-microsoft-com:cpi" /> +</unattend> diff --git a/SRC/VC/VC.flp b/SRC/VC/VC.flp new file mode 100644 index 0000000..9a2fb49 Binary files /dev/null and b/SRC/VC/VC.flp differ diff --git a/SRC/VC/autoUnattend.xml b/SRC/VC/autoUnattend.xml new file mode 100644 index 0000000..0fb7e6c --- /dev/null +++ b/SRC/VC/autoUnattend.xml @@ -0,0 +1,168 @@ +<?xml version="1.0" encoding="utf-8"?> +<unattend xmlns="urn:schemas-microsoft-com:unattend"> + <settings pass="windowsPE"> + <component name="Microsoft-Windows-International-Core-WinPE" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <InputLocale>en-US</InputLocale> + <SystemLocale>en-US</SystemLocale> + <UILanguage>en-US</UILanguage> + <UILanguageFallback>en-US</UILanguageFallback> + <UserLocale>en-US</UserLocale> + </component> + <component name="Microsoft-Windows-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <ImageInstall> + <OSImage> + <InstallTo> + <DiskID>0</DiskID> + <PartitionID>1</PartitionID> + </InstallTo> + <InstallFrom> + <MetaData wcm:action="add"> + <Key>/IMAGE/INDEX</Key> + <Value>1</Value> + </MetaData> + </InstallFrom> + </OSImage> + </ImageInstall> + <UserData> + <AcceptEula>true</AcceptEula> + <FullName>Lab</FullName> + <Organization>Lab.local</Organization> + </UserData> + <DiskConfiguration> + <Disk wcm:action="add"> + <CreatePartitions> + <CreatePartition wcm:action="add"> + <Extend>true</Extend> + <Order>1</Order> + <Type>Primary</Type> + </CreatePartition> + </CreatePartitions> + <DiskID>0</DiskID> + <WillWipeDisk>true</WillWipeDisk> + </Disk> + </DiskConfiguration> + </component> + </settings> + <settings pass="specialize"> + <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <ComputerName>vc</ComputerName> + </component> + <component name="Microsoft-Windows-TCPIP" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <Interfaces> + <Interface wcm:action="add"> + <Ipv4Settings> + <DhcpEnabled>false</DhcpEnabled> + <Metric>10</Metric> + <RouterDiscoveryEnabled>false</RouterDiscoveryEnabled> + </Ipv4Settings> + <UnicastIpAddresses> + <IpAddress wcm:action="add" wcm:keyValue="1">192.168.199.5/24</IpAddress> + </UnicastIpAddresses> + <Identifier>Local Area Connection</Identifier> + <Routes> + <Route wcm:action="add"> + <Identifier>0</Identifier> + <Metric>10</Metric> + <NextHopAddress>192.168.199.2</NextHopAddress> + <Prefix>0.0.0.0/0</Prefix> + </Route> + </Routes> + </Interface> + </Interfaces> + </component> + <component name="Microsoft-Windows-UnattendedJoin" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <Identification> + <Credentials> + <Domain>lab.local</Domain> + <Password>VMware1!</Password> + <Username>JoinUser</Username> + </Credentials> + <JoinDomain>lab.local</JoinDomain> + </Identification> + </component> + <component name="Microsoft-Windows-DNS-Client" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <DNSSuffixSearchOrder> + <DomainName wcm:action="add" wcm:keyValue="1">lab.local</DomainName> + </DNSSuffixSearchOrder> + <Interfaces> + <Interface wcm:action="add"> + <DNSServerSearchOrder> + <IpAddress wcm:action="add" wcm:keyValue="1">192.168.199.4</IpAddress> + </DNSServerSearchOrder> + <DisableDynamicUpdate>true</DisableDynamicUpdate> + <DNSDomain>lab.local</DNSDomain> + <EnableAdapterDomainNameRegistration>true</EnableAdapterDomainNameRegistration> + <Identifier>Local Area Connection</Identifier> + </Interface> + </Interfaces> + </component> + <component name="Microsoft-Windows-ServerManager-SvrMgrNc" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <DoNotOpenServerManagerAtLogon>true</DoNotOpenServerManagerAtLogon> + </component> + <component name="Microsoft-Windows-OutOfBoxExperience" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <DoNotOpenInitialConfigurationTasksAtLogon>true</DoNotOpenInitialConfigurationTasksAtLogon> + </component> + <component name="Networking-MPSSVC-Svc" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <DomainProfile_EnableFirewall>false</DomainProfile_EnableFirewall> + <PrivateProfile_EnableFirewall>false</PrivateProfile_EnableFirewall> + <PublicProfile_EnableFirewall>false</PublicProfile_EnableFirewall> + </component> + <component name="Microsoft-Windows-TerminalServices-LocalSessionManager" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <fDenyTSConnections>false</fDenyTSConnections> + </component> + <component name="Microsoft-Windows-IE-InternetExplorer" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <TrustedSites>https://*.lab.local;http://*.lab.local;http://v1</TrustedSites> + <DisableFirstRunWizard>true</DisableFirstRunWizard> + <DisableOOBAccelerators>true</DisableOOBAccelerators> + </component> + <component name="Microsoft-Windows-IE-ESC" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <IEHardenAdmin>false</IEHardenAdmin> + <IEHardenUser>false</IEHardenUser> + </component> + </settings> + <settings pass="oobeSystem"> + <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <AutoLogon> + <Password> + <Value>VgBNAHcAYQByAGUAMQAhAFAAYQBzAHMAdwBvAHIAZAA=</Value> + <PlainText>false</PlainText> + </Password> + <Enabled>true</Enabled> + <LogonCount>99</LogonCount> + <Username>vc\Administrator</Username> + </AutoLogon> + <OOBE> + <HideEULAPage>true</HideEULAPage> + <HideWirelessSetupInOOBE>true</HideWirelessSetupInOOBE> + <NetworkLocation>Work</NetworkLocation> + </OOBE> + <UserAccounts> + <AdministratorPassword> + <Value>VgBNAHcAYQByAGUAMQAhAEEAZABtAGkAbgBpAHMAdAByAGEAdABvAHIAUABhAHMAcwB3AG8AcgBkAA==</Value> + <PlainText>false</PlainText> + </AdministratorPassword> + </UserAccounts> + <FirstLogonCommands> + <SynchronousCommand wcm:action="add"> + <CommandLine>A:\Build.cmd</CommandLine> + <Description>Phase One Installer from A Drive</Description> + <Order>1</Order> + <RequiresUserInput>true</RequiresUserInput> + </SynchronousCommand> + <SynchronousCommand wcm:action="add"> + <CommandLine>D:\Build.cmd</CommandLine> + <Description>Phase One Installer from D Drive</Description> + <Order>2</Order> + <RequiresUserInput>true</RequiresUserInput> + </SynchronousCommand> + <SynchronousCommand wcm:action="add"> + <CommandLine>E:\Build.cmd</CommandLine> + <Description>Phase One Installer from E Drive</Description> + <Order>3</Order> + <RequiresUserInput>true</RequiresUserInput> + </SynchronousCommand> + </FirstLogonCommands> + </component> + </settings> + <cpi:offlineImage cpi:source="wim:d:/lab/win2k8r2sp1/sources/install.wim#Windows Server 2008 R2 SERVERSTANDARD" xmlns:cpi="urn:schemas-microsoft-com:cpi" /> +</unattend> diff --git a/SRC/VC2.flp b/SRC/VC2.flp new file mode 100644 index 0000000..68fb552 Binary files /dev/null and b/SRC/VC2.flp differ diff --git a/SRC/VC2/Build.cmd b/SRC/VC2/Build.cmd new file mode 100644 index 0000000..3b53f8d --- /dev/null +++ b/SRC/VC2/Build.cmd @@ -0,0 +1,22 @@ +@echo off +type \\192.168.199.7\Build\Automate\version.txt >> c:\buildlog.txt +ver | find "6.1" > nul +if %ERRORLEVEL% == 0 goto ver_2K8 +ver | find "6.2" > nul +if %ERRORLEVEL% == 0 goto ver_2K12 +ver | find "6.3" > nul +if %ERRORLEVEL% == 0 goto ver_2K12 +goto RunBuild +:ver_2K8 +goto RunBuild +:ver_2K12 +netsh interface ip set address name="Ethernet" static 192.168.201.5 255.255.255.0 192.168.201.2 1 +netsh interface ip set dnsservers name="Ethernet" static address=192.168.201.4 primary +Dism /online /enable-feature /featurename:NetFx3ServerFeatures +Dism /online /enable-feature /featurename:NetFx3 /source:D:\Sources\sxs +copy \\192.168.199.7\Build\Automate\DC\ocsetup.exe c:\windows\system32\ +goto RunBuild +:RunBuild +copy \\192.168.199.7\Build\automate\%computername%\Build.cmd c:\ +c:\build.cmd + diff --git a/SRC/VC2/VC2.flp b/SRC/VC2/VC2.flp new file mode 100644 index 0000000..f8317f4 Binary files /dev/null and b/SRC/VC2/VC2.flp differ diff --git a/SRC/VC2/autoUnattend.xml b/SRC/VC2/autoUnattend.xml new file mode 100644 index 0000000..81a3e79 --- /dev/null +++ b/SRC/VC2/autoUnattend.xml @@ -0,0 +1,156 @@ +<?xml version="1.0" encoding="utf-8"?> +<unattend xmlns="urn:schemas-microsoft-com:unattend"> + <settings pass="windowsPE"> + <component name="Microsoft-Windows-International-Core-WinPE" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <InputLocale>en-US</InputLocale> + <SystemLocale>en-US</SystemLocale> + <UILanguage>en-US</UILanguage> + <UILanguageFallback>en-US</UILanguageFallback> + <UserLocale>en-US</UserLocale> + </component> + <component name="Microsoft-Windows-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <ImageInstall> + <OSImage> + <InstallTo> + <DiskID>0</DiskID> + <PartitionID>1</PartitionID> + </InstallTo> + <InstallFrom> + <MetaData wcm:action="add"> + <Key>/IMAGE/INDEX</Key> + <Value>2</Value> + </MetaData> + </InstallFrom> + </OSImage> + </ImageInstall> + <UserData> + <AcceptEula>true</AcceptEula> + <FullName>Lab</FullName> + <Organization>Lab.local</Organization> + </UserData> + <DiskConfiguration> + <Disk wcm:action="add"> + <CreatePartitions> + <CreatePartition wcm:action="add"> + <Extend>true</Extend> + <Order>1</Order> + <Type>Primary</Type> + </CreatePartition> + </CreatePartitions> + <DiskID>0</DiskID> + <WillWipeDisk>true</WillWipeDisk> + </Disk> + </DiskConfiguration> + </component> + </settings> + <settings pass="specialize"> + <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <ComputerName>vc2</ComputerName> + </component> + <component name="Microsoft-Windows-TCPIP" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <Interfaces> + <Interface wcm:action="add"> + <Ipv4Settings> + <DhcpEnabled>false</DhcpEnabled> + <Metric>10</Metric> + <RouterDiscoveryEnabled>false</RouterDiscoveryEnabled> + </Ipv4Settings> + <UnicastIpAddresses> + <IpAddress wcm:action="add" wcm:keyValue="1">192.168.201.5/24</IpAddress> + </UnicastIpAddresses> + <Identifier>Local Area Connection</Identifier> + <Routes> + <Route wcm:action="add"> + <Identifier>0</Identifier> + <Metric>10</Metric> + <NextHopAddress>192.168.201.2</NextHopAddress> + <Prefix>0.0.0.0/0</Prefix> + </Route> + </Routes> + </Interface> + </Interfaces> + </component> + <component name="Microsoft-Windows-UnattendedJoin" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <Identification> + <Credentials> + <Domain>lab.local</Domain> + <Password>VMware1!</Password> + <Username>JoinUser</Username> + </Credentials> + <JoinDomain>lab.local</JoinDomain> + </Identification> + </component> + <component name="Microsoft-Windows-DNS-Client" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <DNSSuffixSearchOrder> + <DomainName wcm:action="add" wcm:keyValue="1">lab.local</DomainName> + </DNSSuffixSearchOrder> + <Interfaces> + <Interface wcm:action="add"> + <DNSServerSearchOrder> + <IpAddress wcm:action="add" wcm:keyValue="1">192.168.201.4</IpAddress> + </DNSServerSearchOrder> + <DisableDynamicUpdate>true</DisableDynamicUpdate> + <DNSDomain>lab.local</DNSDomain> + <EnableAdapterDomainNameRegistration>true</EnableAdapterDomainNameRegistration> + <Identifier>Local Area Connection</Identifier> + </Interface> + </Interfaces> + </component> + <component name="Microsoft-Windows-ServerManager-SvrMgrNc" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <DoNotOpenServerManagerAtLogon>true</DoNotOpenServerManagerAtLogon> + </component> + <component name="Microsoft-Windows-OutOfBoxExperience" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <DoNotOpenInitialConfigurationTasksAtLogon>true</DoNotOpenInitialConfigurationTasksAtLogon> + </component> + <component name="Networking-MPSSVC-Svc" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <DomainProfile_EnableFirewall>false</DomainProfile_EnableFirewall> + <PrivateProfile_EnableFirewall>false</PrivateProfile_EnableFirewall> + <PublicProfile_EnableFirewall>false</PublicProfile_EnableFirewall> + </component> + <component name="Microsoft-Windows-TerminalServices-LocalSessionManager" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <fDenyTSConnections>false</fDenyTSConnections> + </component> + <component name="Microsoft-Windows-IE-InternetExplorer" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <TrustedSites>https://*.lab.local;http://*.lab.local;http://v1</TrustedSites> + <DisableFirstRunWizard>true</DisableFirstRunWizard> + <DisableOOBAccelerators>true</DisableOOBAccelerators> + </component> + <component name="Microsoft-Windows-IE-ESC" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <IEHardenAdmin>false</IEHardenAdmin> + <IEHardenUser>false</IEHardenUser> + </component> + </settings> + <settings pass="oobeSystem"> + <component name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <AutoLogon> + <Password> + <Value>VgBNAHcAYQByAGUAMQAhAFAAYQBzAHMAdwBvAHIAZAA=</Value> + <PlainText>false</PlainText> + </Password> + <Enabled>true</Enabled> + <LogonCount>99</LogonCount> + <Username>vc2\administrator</Username> + </AutoLogon> + <OOBE> + <HideEULAPage>true</HideEULAPage> + <HideWirelessSetupInOOBE>true</HideWirelessSetupInOOBE> + <NetworkLocation>Work</NetworkLocation> + </OOBE> + <UserAccounts> + <AdministratorPassword> + <Value>VgBNAHcAYQByAGUAMQAhAEEAZABtAGkAbgBpAHMAdAByAGEAdABvAHIAUABhAHMAcwB3AG8AcgBkAA==</Value> + <PlainText>false</PlainText> + </AdministratorPassword> + </UserAccounts> + <FirstLogonCommands> + <SynchronousCommand wcm:action="add"> + <CommandLine>a:\Build.cmd</CommandLine> + <Description>Build</Description> + <Order>1</Order> + <RequiresUserInput>true</RequiresUserInput> + </SynchronousCommand> + </FirstLogonCommands> + </component> + </settings> + <cpi:offlineImage cpi:source="wim:d:/lab/win2k8r2sp1/sources/install.wim#Windows Server 2008 R2 SERVERSTANDARD" xmlns:cpi="urn:schemas-microsoft-com:cpi" /> +</unattend> diff --git a/SRC/buildpop b/SRC/buildpop new file mode 100644 index 0000000..c9c10ac --- /dev/null +++ b/SRC/buildpop @@ -0,0 +1,53 @@ +#!/bin/sh + +. /etc/rc.subr + +name="BuildPop" +start_cmd="${name}_start" +stop_cmd=":" + +BuildPop_start() +{ +mkdir /mnt/cd0 +mount_cd9660 /dev/cd0 /mnt/cd0 +mkdir /mnt/cd1 +mount_cd9660 /dev/cd1 /mnt/cd1 + +if [ -f "/mnt/LABVOL/Build/ESXi60/vmware-esx-base-readme" ] +then + echo "Already have ESXi 6.0 installer" +else + if [ -f "/mnt/cd0/vmware-esx-base-readme" ] + then + echo "Found ESXi installer on CD0" + cp -r /mnt/cd0/* /mnt/LABVOL/Build/ESXi60 + fi + if [ -f "/mnt/cd1/vmware-esx-base-readme" ] + then + echo "Found ESXi installer on CD1" + cp -r /mnt/cd1/* /mnt/LABVOL/Build/ESXi60 + fi +fi + +if [ -f "/mnt/LABVOL/Build/VIM_60/autorun.exe" ] +then + echo "Already have vCentre 6.0 installer" +else + if [ -f "/mnt/cd0/autorun.exe" ] + then + echo "Found vCentre installer on CD0" + cp -r /mnt/cd0/* /mnt/LABVOL/Build/VIM_60 +else + fi + if [ -f "/mnt/cd1/autorun.exe" ] + then + echo "Found vCentre installer on CD1" +cp -r /mnt/cd1/* /mnt/LABVOL/Build/VIM_60 +else + fi +fi +} + +load_rc_config $name +run_rc_command "$1" +