VMware Cloud Community
Curious5
Contributor
Contributor
Jump to solution

Can this parameter "Devices.hotplug=false" be enabled thru script at Vms next reboot after Os patching

We are enabling the parameter 'devices.hotplug=false" on roughly 5000 Windows server VMs ( 2008,2012,2016 ..) in a 6.u3e host environment through the script.

We have groups of Vms that going through Os patch cycles every week.

Can a script be prepared to enable this parameter when the VMs are getting rebooted during their OS patch cycle ? Is this even possible.

I read somewhere that Vms need to be powered off to modify changes in vmx ?

Or if the above is not possible, then i believe our only option is to prepare a script to power-off,enable the parameter, power it back on ? Is that right ? In that case any idea how many VMs cna be powered on at once?

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Yes, the VM needs to be powered off to set this option.

And no, I don't think you can schedule this "at next reboot".

The basic script is like this

$spec = New-Object VMware.Vim.VirtualMachineConfigSpec

$extra = New-Object VMware.Vim.OptionValue

$extra.Key = 'devices.hotplug'

$extra.Value = $false

$spec.ExtraConfig += $extra


Get-VM | %{

  $_.ExtensionData.ReconfigVM($spec)

}

In theory you can power on all the VMs in a relatively short timespan by using Start-VM with the RunAsync switch.

But that might put a serious load on your environment.

I would suggest to stop/start the VMs in batches.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

0 Kudos
2 Replies
LucD
Leadership
Leadership
Jump to solution

Yes, the VM needs to be powered off to set this option.

And no, I don't think you can schedule this "at next reboot".

The basic script is like this

$spec = New-Object VMware.Vim.VirtualMachineConfigSpec

$extra = New-Object VMware.Vim.OptionValue

$extra.Key = 'devices.hotplug'

$extra.Value = $false

$spec.ExtraConfig += $extra


Get-VM | %{

  $_.ExtensionData.ReconfigVM($spec)

}

In theory you can power on all the VMs in a relatively short timespan by using Start-VM with the RunAsync switch.

But that might put a serious load on your environment.

I would suggest to stop/start the VMs in batches.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
Curious5
Contributor
Contributor
Jump to solution

LucD​ Thanks a ton !! I'm so happy i got the answer real quick.

0 Kudos