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?
You can do that anytime.
Something like this
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
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.
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)
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