Skip to content

Commit

Permalink
AUSTA-277: Fix Syntax Error in Step "Delete Drivers ISO on ESXi Host …
Browse files Browse the repository at this point in the history
…with Windows Worker" (#19)

* AUSTA-277: Fixed bug in step "Delete Drivers ISO on ESXi Host with Windows Worker".

* AUSTA-277: Saving unsaved changes.

---------

Co-authored-by: Default User <default@email.com>
  • Loading branch information
h4xhor and Default User authored Nov 1, 2023
1 parent 9170612 commit f16fcf2
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 75 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,16 +96,16 @@ This Project contains the following Blueprints.
### Perform Deploy ESXi Drivers to a Drop Directory with Windows Worker


### Perform Install VMware.VimAutomation.Core on Windows Worker


### Perform Test if VMWare Drivers Installed on Windows


### Setup VMWare Tools on Windows

Post Windows install setup of VMWare tools for new VM Windows node.

### Perform Install VMware.VimAutomation.Core on Windows Worker





Expand Down
93 changes: 40 additions & 53 deletions docs/Build-Virtual-Machine-on-ESXi-with-Windows-Worker.html
Original file line number Diff line number Diff line change
Expand Up @@ -1037,60 +1037,47 @@ <h3 id="setbootorderwithwindowsworker">
<div class="col px-0">
<pre>
<code class="language-sql py-0">
&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt; HEAD:steps/setbootorderwithwindowsworker/script.txt
========
if {virtualMachineBootLoaderIsBios}
then

pwsh &lt;&lt;&#x27;EOF&#x27;
&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt; df60d49 (AUSTA-218: Added step &quot;Set Boot Order UEFI&quot;.):steps/setbootorderbios/script.txt
$ErrorActionPreference = &quot;Stop&quot;
Import-Module VMware.VimAutomation.Core

Connect-VIServer {vmwareVcenterNode.ip} `
-User {vmwareVcenterUser.user} `
-Password {vmwareVcenterUser.password}

if ($? -eq $false) {
Write-Host &quot;Error: Not connected.&quot;
exit 1
}

#$vm = Get-View -ViewType VirtualMachine -Filter @{&#x27;Name&#x27;=&quot;^{newVmNode.fqn}$&quot;}
$vm = Get-VM -Name &quot;{newVmNode.fqn}&quot;

## the device name of the hard disk to which to boot
$strBootHDiskDeviceName = &quot;Hard disk 1&quot;

## get the VirtualDisk device, then grab its Key (DeviceKey, used later)
$intHDiskDeviceKey = ($vm.ExtensionData.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 @{&quot;DeviceKey&quot; = $intHDiskDeviceKey}

## bootable CDROM device (per the docs, the first CDROM with bootable media found is used)
$oBootableCDRom = New-Object -Type VMware.Vim.VirtualMachineBootOptionsBootableCdromDevice

$spec = New-Object VMware.Vim.VirtualMachineConfigSpec -Property @{
&quot;BootOptions&quot; = New-Object VMware.Vim.VirtualMachineBootOptions -Property @{
BootOrder = $oBootableHDisk, $oBootableCDRom
} ## end new-object
} ## end new-object

## reconfig the VM to use the spec with the new BootOrder
$vm.ExtensionData.ReconfigVM_Task($spec)

##(Get-VM {newVmNode.fqn}).Extensiondata.Config.BootOptions

&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt; HEAD:steps/setbootorderwithwindowsworker/script.txt
========

EOF

else
echo &quot;Skipping for UEFI boot.&quot;
if ${{virtualMachineBootLoaderIsBios}}
then

$ErrorActionPreference = &quot;Stop&quot;
Import-Module VMware.VimAutomation.Core

Connect-VIServer {vmwareVcenterNode.ip} `
-User {vmwareVcenterUser.user} `
-Password {vmwareVcenterUser.password}

if ($? -eq $false) {
Write-Host &quot;Error: Not connected.&quot;
exit 1
}

$vm = Get-VM -Name &quot;{newVmNode.fqn}&quot;

# the device name of the hard disk to which to boot
$strBootHDiskDeviceName = &quot;Hard disk 1&quot;

# get the VirtualDisk device, then grab its Key (DeviceKey, used later)
$intHDiskDeviceKey = ($vm.ExtensionData.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 @{&quot;DeviceKey&quot; = $intHDiskDeviceKey}

# bootable CDROM device (per the docs, the first CDROM with bootable media found is used)
$oBootableCDRom = New-Object -Type VMware.Vim.VirtualMachineBootOptionsBootableCdromDevice

$spec = New-Object VMware.Vim.VirtualMachineConfigSpec -Property @{
&quot;BootOptions&quot; = New-Object VMware.Vim.VirtualMachineBootOptions -Property @{
BootOrder = $oBootableHDisk, $oBootableCDRom
} # end new-object
} # end new-object

# reconfig the VM to use the spec with the new BootOrder
$vm.ExtensionData.ReconfigVM_Task($spec)

else
echo &quot;Skipping for UEFI boot.&quot;
fi
&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt; df60d49 (AUSTA-218: Added step &quot;Set Boot Order UEFI&quot;.):steps/setbootorderbios/script.txt
</code>
</pre>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -569,9 +569,8 @@ <h3 id="deletedriversisoonesxihostwithwindowsworker">
Set-Location &quot;{automationWorkerWindowsBaseDirectory}&quot;
if ( -Not (Test-Path &quot;drivers_{newVmNode.fqn}.iso&quot; `
-PathType Leaf) ) {
Write-Host &quot;This build doesn&#x27;t have a {automationWorkerWindowsBaseDirectory}/drivers_{newVmNode.fqn}.iso.&quot;
Write-Host &quot;This build doesn&#x27;t have a {automationWorkerWindowsBaseDirectory}\drivers_{newVmNode.fqn}.iso.&quot;
} else {
pwsh &lt;&lt;&#x27;EOF&#x27;
$ErrorActionPreference = &quot;Stop&quot;
Import-Module VMware.VimAutomation.Core

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -459,6 +459,13 @@ <h3 id="testwmwarepowerclionwindowsworker">
</h3>
</div>

<div class="row">
<div class="description col px-0">
<p>

</p>
</div>
</div>



Expand Down
26 changes: 13 additions & 13 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,19 @@ <h3 class="card-title">
</div>
</div>

<div class="col-12 pt-3 pl-0">
<div class="card"
id="Perform-Install-VMware-VimAutomation-Core-on-Windows-Worker">
<div class="card-body">
<a href="Perform-Install-VMware-VimAutomation-Core-on-Windows-Worker.html">
<h3 class="card-title">
Perform Install VMware.VimAutomation.Core on Windows Worker
</h3>
</a>
</div>
</div>
</div>

<div class="col-12 pt-3 pl-0">
<div class="card"
id="Perform-Test-if-VMWare-Drivers-Installed-on-Windows">
Expand Down Expand Up @@ -387,19 +400,6 @@ <h3 class="card-title">
</div>
</div>
</div>

<div class="col-12 pt-3 pl-0">
<div class="card"
id="Perform-Install-VMware-VimAutomation-Core-on-Windows-Worker">
<div class="card-body">
<a href="Perform-Install-VMware-VimAutomation-Core-on-Windows-Worker.html">
<h3 class="card-title">
Perform Install VMware.VimAutomation.Core on Windows Worker
</h3>
</a>
</div>
</div>
</div>
</div>
</div>
</div>
Expand Down
3 changes: 1 addition & 2 deletions steps/deletedriversisoonesxihostwithwindowsworker/script.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
Set-Location "{automationWorkerWindowsBaseDirectory}"
if ( -Not (Test-Path "drivers_{newVmNode.fqn}.iso" `
-PathType Leaf) ) {
Write-Host "This build doesn't have a {automationWorkerWindowsBaseDirectory}/drivers_{newVmNode.fqn}.iso."
Write-Host "This build doesn't have a {automationWorkerWindowsBaseDirectory}\drivers_{newVmNode.fqn}.iso."
} else {
pwsh <<'EOF'
$ErrorActionPreference = "Stop"
Import-Module VMware.VimAutomation.Core

Expand Down
2 changes: 0 additions & 2 deletions steps/setbootorderwithwindowsworker/script.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,3 @@ then
else
echo "Skipping for UEFI boot."
fi


0 comments on commit f16fcf2

Please sign in to comment.