Hello,
I need to Get VMs that sync time with host, and also disable this feature to force VMs to sync against the configured NTP server on the OS level.
Thank you,
To disable that you can do
$spec.tools = New-Object VMWare.Vim.ToolsConfigInfo
$spec.tools.syncTimeWithHost = $false
Get-VM |
where{$_.ExtensionData.Config.Tools.syncTimeWithHost} |
ForEach-Object -Process {
$_.ExtensionData.ReconfigVM($spec)
}
To set the NTP configuration inside your guest OS, depends on which guest OS you are running.
You can do that part via Invoke-VMScript
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
To disable that you can do
$spec.tools = New-Object VMWare.Vim.ToolsConfigInfo
$spec.tools.syncTimeWithHost = $false
Get-VM |
where{$_.ExtensionData.Config.Tools.syncTimeWithHost} |
ForEach-Object -Process {
$_.ExtensionData.ReconfigVM($spec)
}
To set the NTP configuration inside your guest OS, depends on which guest OS you are running.
You can do that part via Invoke-VMScript
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hi. I can't run this command in powercli. how can run for all vm in vcenter in powercli.
That "I can't run this command" is a bit vague I'm afraid.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Hi @LucD ,
How can i import a Csv file to disable the time sync setting with host for some specific VMs.
Please can you help me.
$spec.tools = New-Object VMWare.Vim.ToolsConfigInfo
$spec.tools.syncTimeWithHost = $false
Get-VM |
where{$_.ExtensionData.Config.Tools.syncTimeWithHost} |
ForEach-Object -Process {
$_.ExtensionData.ReconfigVM($spec)
}
Assuming you have a CSV with a column named Name, you could do
$spec = New-Object VMware.Vim.VirtualMachineConfigSpec
$spec.tools = New-Object VMWare.Vim.ToolsConfigInfo
$spec.tools.syncTimeWithHost = $false
$vms = Import-Csv -Path .\vms.csv -UseCulture
Get-VM -Name $vms.Name |
where{$_.ExtensionData.Config.Tools.syncTimeWithHost} |
ForEach-Object -Process {
$_.ExtensionData.ReconfigVM($spec)
}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference