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
Assuming your CSV has a column Name, that contains the name of the VM, you could do
$vmConfigSpec = New-Object VMware.Vim.VirtualMachineConfigSpec
$vmConfigSpec.Tools = New-Object VMware.Vim.ToolsConfigInfo
$vmConfigSpec.Tools.syncTimeWithHostAllowed = $false
$VC = @("vcenterserver.name")
Connect-VIServer -Server $VC -User "username" -Password password
Import-Csv "C:\Support\VMWare\time2.csv" |
ForEach-Object -Process {
$vm = Get-VM -Name $_.Name
$vm.ExtensionData.ReconfigVM($vmConfigSpec)
}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Assuming your CSV has a column Name, that contains the name of the VM, you could do
$vmConfigSpec = New-Object VMware.Vim.VirtualMachineConfigSpec
$vmConfigSpec.Tools = New-Object VMware.Vim.ToolsConfigInfo
$vmConfigSpec.Tools.syncTimeWithHostAllowed = $false
$VC = @("vcenterserver.name")
Connect-VIServer -Server $VC -User "username" -Password password
Import-Csv "C:\Support\VMWare\time2.csv" |
ForEach-Object -Process {
$vm = Get-VM -Name $_.Name
$vm.ExtensionData.ReconfigVM($vmConfigSpec)
}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thankyou so much for your help, that was exactly what I needed
