VMware Cloud Community
jaygriffin
Enthusiast
Enthusiast

Schedule Guest OS to change during reboot.

I am looking to use PowerCli to script some changes.  Most of our Windows 2016 servers were setup before Windows 2016 was an option as a guest OS.  I would like to script changing their Guest OS setting.

Is it possible to change the Guest OS setting while a server is powered on?  (even if it doesn't take affect until a reboot).

Or is it possible to schedule it to change during a reboot, in the same manner you can use .ScheduledHardwareUpgradeInfo for hardware changes?

Reply
0 Kudos
4 Replies
LucD
Leadership
Leadership

You can do that anytime.

Something like this

Get-VM -Name MyVM |

Set-VM -GuestId windows9Server64Guest -Confirm:$false

Note that this value is only used when creating a VM


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

Reply
0 Kudos
jaygriffin
Enthusiast
Enthusiast

That works well if the VM is powered off.  I am trying to set the change so it will take affect on reboot (since it is not a change allowed when powered on).

Thanks for the try.

Reply
0 Kudos
jaygriffin
Enthusiast
Enthusiast

Something like this (which sets the compatibility to be updated on reboot):

$vm = Get-VM -Name VMGuestName

$vm.ExtensionData.Config.ScheduledHardwareUpgradeInfo

$spec = New-Object -TypeName VMware.Vim.VirtualMachineConfigSpec

$spec.ScheduledHardwareUpgradeInfo = New-Object -TypeName VMware.Vim.ScheduledHardwareUpgradeInfo

$spec.ScheduledHardwareUpgradeInfo.UpgradePolicy = "always"

$spec.ScheduledHardwareUpgradeInfo.VersionKey = "vmx-14"

$spec.ScheduledHardwareUpgradeInfo.ScheduledHardwareUpgradeStatus = "pending"

$vm.ExtensionData.ReconfigVM_Task($spec)

Reply
0 Kudos
LucD
Leadership
Leadership

Yes, you are right. I tested with a VM that already had windows9Server64Guest as its guest identifier.

Doesn't seem to be a method to change that while powered on, or prep it for the next reboot.


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

Reply
0 Kudos