Automation

 View Only
  • 1.  Disbale Synctimewithhostallowed from csv list

    Posted Jan 18, 2023 05:51 PM

    Hello, and thanks for any assistance given.

    I would like some help forulating a script to refernce a CSV file (list of vm names) in order to disable sync time with host

    this is what I have so far but i'm defiatley going wrong somewhere, and maybe way off the mark?

    $VC = @("vcenterserver.name")
    Connect-VIServer -Server $VC -user "username" -Password password
    $v = Import-CSV "C:\Support\VMWare\time2.csv" |
    Foreach ($v in (get-vm)) {
    $vm = $v | Get-View
    $vmConfigSpec = New-Object VMware.Vim.VirtualMachineConfigSpec
    $vmConfigSpec.Tools = New-Object VMware.Vim.ToolsConfigInfo
    $vmConfigSpec.Tools.syncTimeWithHostAllowed = $false
    $vm.ReconfigVM($vmConfigSpec)
    }

     

    again thanks for any help



  • 2.  RE: Disbale Synctimewithhostallowed from csv list
    Best Answer

    Posted Jan 18, 2023 06:27 PM

    Assuming your CSV has a column Name, that contains the name of the VM, you could do



  • 3.  RE: Disbale Synctimewithhostallowed from csv list

    Posted Jan 18, 2023 07:28 PM

    Thankyou so much for your help, that was exactly what I needed