PowerCLI

 View Only
  • 1.  virtual machines' time sync configuration from vmware tools

    Posted Jul 31, 2024 05:23 AM

    I'm trying to achieve the 3 goals: acquire/enable/disable the "synchronize at startup and resume" and "synchronize time periodically" of vmware tools time sync for virtual machines, and the primary codes i utilized are shown below:

    # Get all VMs 
    $vms = Get-VM

    $vmTimeSyncSettings = $vms | ForEach-Object {
        $vm = $_
        $tools = $vm.ExtensionData.Config.Tools
        [PSCustomObject]@{
            VMName                        = $vm.Name
            SyncTimeAtStartupAndResume    = $tools.SyncTimeWithHostAtPowerOnResume

            SyncTimeWithHost             = $tools.SyncTimeWithHost

            
        }
    }

    # Display the settings
    $vmTimeSyncSettings | Format-Table -AutoSize

    however, there's problem obtaining the result of "synchronize at startup and resume", which the output is blank.

    did i use the wrong commands to get the information of time sync setting? or maybe powercli isn't a good way to do that?



  • 2.  RE: virtual machines' time sync configuration from vmware tools

    Posted Jul 31, 2024 08:50 AM

    Not sure where you got the property SyncTimeWithHostAtPowerOnResume from, but afaik that doesn't exist.
    The
    ToolsConfigInfo object does have a syncTimeWithHostAllowed property.



    ------------------------------


    Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference


    ------------------------------