Created
January 30, 2019 20:45
-
-
Save clintcolding/2b36b354e39dd051aeeeaf7c6bb9b717 to your computer and use it in GitHub Desktop.
Sync VM time with VMware host.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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