Skip to content

Commit 23c208e

Browse files
authored
Update ESXiBootDevice.ps1 to return stateless boot correctly
In my environment (6.5 U2) with stateless boot, the "$bootType = $optionValue.StringValue" always overwrites the $boottype = "stateless" even if the catch block triggers. Moving the assignment inside the try block will return proper results
1 parent ba762fe commit 23c208e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

powershell/ESXiBootDevice.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,10 @@
5050
$option.option = "/UserVars/ImageCachedSystem"
5151
try {
5252
$optionValue = $esxcli.system.settings.advanced.list.Invoke($option)
53+
$bootType = $optionValue.StringValue
5354
} catch {
5455
$bootType = "stateless"
5556
}
56-
$bootType = $optionValue.StringValue
5757
}
5858

5959
# Loop through all storage devices to identify boot device
@@ -105,4 +105,4 @@
105105
$results+=$tmp
106106
}
107107
$results | FT -AutoSize
108-
}
108+
}

0 commit comments

Comments
 (0)