What is the best method for enabling this option on all VMs? Is there a good way to do it without either editing the VMX files on every machine or doing it manually though edit settings?
that's sad.... So now way to use powercli on esxi 4.1 free to change things?
Can i use powercli to invoke .bat file on all vmwares simultanous?
a script that would call a batch file on the vmware it self... That way i could do some update work without going to each vmware and click on the bat file...
I'm afraid not.
And I'm afraid I can test that 2nd question, I don't have a free ESXi 4.1 available.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
what would be the code for a non-free version of esxi? I can test it on my free version:smileylaugh:
I would try with the Invoke-VMScript cmdlet to start the BAT file.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
was already googling on that before your answer:) trying to figure out how to run this on all vmwares at the same time...
Try something like this
Get-VM | %{ Invoke-VMScript -VM $_ -ScriptType bat -ScriptText '<your command(s)>' -GuestUser guser -GuestPassword gpswd
}
You probably will have to add the HostUser and HostPassword as well
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
thanks for that, will give it a try. First trying to running a command on a single machine, only got screwed with having the PowerCli on my 64 bit Windows 7 machine. Invoke-VMScript needs 32bit.... Trying it for an old Vmware XP machine...
any idea how to run Invoke-VMScript on a 64 bit Windows 7 machine?
googled for half an hour but no real clues...
EDIT
stupid me, the powercli installer already made 2 icons, 64bit and 32 bit...
I'm afraid Invoke-VMScript only runs in 32-bit.
And yes, use the 2nd icon to start PowerCLI in 32-bit mode
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
is nothing allowed on a free version of Esxi?
C:\PS>$vm = Get-VM myVM Invoke-VMScript -VM $vm -ScriptText "dir" -HostUser root -HostPassword mypass -G uestUser administrator -GuestPassword mypass
Invoke-VMScript : 11-5-2012 12:20:34 Invoke-VMScript While performing
operation 'Connect to host service 'https://server1/sdk' at port 902' the foll
owing error occured: 'This operation is not supported with the current license'
Invoke-VMscript -VM $vm -ScriptText "c:\windows\explorer.exe" -HostUser root -HostPassword xxx -GuestUser guser -GuestPassword gpswd
same error...
so can't perform any action on a vmware because of the free version?
I was afraid of that, only the Get- cmdlets will work with the free ESXi version.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
that sucks. we gonna have to stuck with the schedule.bat that is running each night on the vmware.
What if the server does not have the tools installed, will this check mark install the tools? I do not think it will but I wanted to throw it out there just in case.
What are some ways that you install the tools from a remote PC where you can not reboot a server?
You could use the Mount-Tools cmdlet and then use the method described in KB1018377 through Invoke-VMScript.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Is there a way to run this against a list of VM's? I have some VM's that I do not want to update the tools on and was wondering if it would be simple to run this script against a list of ones that I want to change to "UpgradeAtPowerCycle"
Thanks
Rich
The selection of the targetted VMs is done with the Get-VM cmdlet.
Without any parameters it will return all VMs known in your vCenter or ESXi host.
You can use the Name parameter with a specific or a partial name.
Get-VM -Name VM*
This will return all VMs whose name starts with VM.
Or you can use a Where-clause to filter out the VMs you want.
Get-VM | Where {$_.NumCpu -eq 2}....
Or you can even store the names in a file, read the content and use those on the Name parameter
Get-VM -Name (Get-Content vmnames.txt)
And there are many other possibilities.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I have the list, I need a way to use that list to change the setting on only those vm's. I was thinking maybe something like below:
$vmConfigSpec = New-Object VMware.Vim.VirtualMachineConfigSpec
$vmConfigSpec.Tools = New-Object VMware.Vim.ToolsConfigInfo
$vmConfigSpec.Tools.ToolsUpgradePolicy = "UpgradeAtPowerCycle"
$vms = get-content "c:\list\vms.txt"
For-each $vm in $vms {
Get-View -ViewType VirtualMachine -filter @{"Name" = "$vm"} | %{$_.ReconfigVM($vmConfigSpec)}
}
That should work as well.
With Get-View you retrieve the actual vSphere object.
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Check this link for an option to change this setting - easily configured through vUM.
Do this script works for the vSphere 5.1 Update 1 ?