Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Sync VM time with VMware host.
$vms = Get-VM "DQWBATMAN01SRV" | Get-View
foreach ($vm in $vms) {
if ($vm.Config.Tools.SyncTimeWithHost -eq $false) {
$vmConfig = New-Object VMware.Vim.VirtualMachineConfigSpec
$vmConfig.Tools = New-Object VMware.Vim.ToolsConfigInfo
$vmConfig.Tools.SyncTimeWithHost = $true
$vm.ReconfigVM($vmConfig)
}
[PSCustomObject]@{
Name = $vm.Name
SyncTimeWithHost = $vm.Config.Tools.SyncTimeWithHost
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment