«

»

ESXi host VMkernel.Boot.terminateVMOnPDL configuration using PowerCLI

I have already written a blog post about how you can configure the ESXi host  setting disk.terminateVMOnPDLDefault in vSphere version 5.1. You can find that blog post here.

I have received a couple of questions about how to configure the setting, called VMkernel.Boot.terminateVMOnPDL, in ESXi 5.5 so i decided to put together a blog post about it. The ESXi host configuration can be found in the advanced section and configured in the UI according to the below figures.
Screen Shot 2013-12-22 at 20.04.41

Change the No value to Yes if you want to do it manually.
Screen Shot 2013-12-22 at 20.03.55

This blog post will provide you with two options:

  • .ps1 file you can run which will take care of the configuration and send you an email report of the result.
  • Script you can copy and past directly in the PowerCLI window after you connect to your vCenter Server.

.PS1 PowerCLI script file

The software used when creating and testing the below scripts includes:

  • VMware vCenter Server 5.5 running on Windows Server 2008 R2
  • VMware ESXi 5.5
  • PowerCLI 5.5
  • PowerShell 2.0

This script will most likely not work when using PowerShell 3.0.

The below script will check if the VMkernel.Boot.terminateVMOnPDL parameter is set to True or not. If it is set to default value, False, the script will change it to True.
When the configuration is finished the script will send you an email report of what has been done.

Change the following parameters in the below script to match your environment:

  • $vcenter = “vc-demo01“
  • $vcenteruser = “vcdx56\magnus“
  • $vcenterpw = “notsecret“
  • $sendTo = “magnus@vcdx56.com“
  • $sendFrom = “vc-demo01@vcdx56.com“
  • $smtpserver = “smtp.vcdx56.local“
# ESXi Host VMkernel.Boot.terminateVMOnPDL configuration
# Version 1.0 Magnus Andersson
#————————————————
# Start of script parameters section
#
$vcenter = “vc-demo01“
$vcenteruser = "vcdx56magnus“
$vcenterpw = “notsecret“
#
$sendTo = “magnus@vcdx56.com“
$sendFrom = “vc-demo01@vcdx56.com“
$smtpserver = “smtp.vcdx56.local“
#
# End of script parameter section
#——————————————
#
# Connect to vcenter Server
connect-viserver $vcenter -User $vcenteruser -Password $vcenterpw
#
# Verify if configuration changes are needed and if so, change the configuration to the value True
$Body = @()
Get-VMHost | sort | Foreach {
if (($_ | Get-VMHostAdvancedConfiguration -name VMkernel.Boot.terminateVMOnPDL)["VMkernel.Boot.terminateVMOnPDL"] -ne 'True' ) {
$Body = $Body + "VMkernel.Boot.terminateVMOnPDL value for $($_) is not True and will be changed. New Configuration for $_ is” | out-string
$newBody = (set-VMHostAdvancedConfiguration -vmhost $_ -name VMkernel.Boot.terminateVMOnPDL -value True)
$Body += $newBody | out-string
} else {
$Body = $Body + "VMkernel.Boot.terminateVMOnPDL value for $($_) is True and does not needs to be changed” | out-string
}
}
#
# Send e-mail report
send-mailmessage -to $sendTo -from $sendFrom -Subject “ESXi host VMkernel.Boot.terminateVMOnPDL traffic configuration report” -smtpserver $smtpserver -Body $Body

The script email report looks like this.
Screen Shot 2014-01-21 at 12.44.13

Script

If you decide to run this script by copy and paste the below PowerCLI code to your PowerCLI window you must understand that it will set the VMkernel.Boot.terminateVMOnPDL to true no matter if it is already set to true or not.

The software used when creating and testing the below scripts includes:

  • VMware vCenter Server 5.5 running on Windows Server 2008 R2
  • VMware ESXi 5.5
  • PowerCLI 5.5
  • PowerShell 2.0

This script will work when using PowerShell 3.0 as well.

Foreach ($ESXihost in (Get-vmhost | sort))
{ write-host Existing configuration for $ESXihost.name -foregroundcolor green 
Get-AdvancedSetting -entity $ESXihost.name -name VMkernel.Boot.terminateVMOnPDL 
write-host Changing the configuration for $ESXihost.name to True -foregroundcolor green
Get-AdvancedSetting -Entity $ESXihost.name -Name VMkernel.Boot.terminateVMOnPDL | Set-AdvancedSetting -Value False -Confirm:$false
write-host Veryfing the configuration for $ESXihost.name -foregroundcolor green
Get-AdvancedSetting -entity $ESXihost.name -name VMkernel.Boot.terminateVMOnPDL write-host write-host }

The below figure shows the output from the script:
Screen Shot 2013-12-22 at 21.45.17

2 pings

  1. ESXi host disk.terminateVMOnPDLDefault configuration using PowerCLI | VCDX56

    […] Continue reading if you need to configured the ESXi host disk.terminateVMOnPDLDefault setting in a version prior to 5.5. If you need a configuration script for vSphere 5.5 i got a post here. […]

  2. Yet another blog post about vSphere HA and PDL » boche.net – VMware vEvangelist

    […] ESXi host VMkernel.Boot.terminateVMOnPDL configuration […]

Comments have been disabled.