Skip to content

Instantly share code, notes, and snippets.

@clintcolding
Created January 30, 2019 20:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save clintcolding/2b36b354e39dd051aeeeaf7c6bb9b717 to your computer and use it in GitHub Desktop.
Save clintcolding/2b36b354e39dd051aeeeaf7c6bb9b717 to your computer and use it in GitHub Desktop.
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