Archive

Archive for January, 2016

VMWare PowerCLI script: increase RAM and update VMWare Tools

January 11th, 2016 No comments

The other day I had to increase the memory of 30 virtual servers and install the latest VMWare tools. Instead of doing this manually I uses PowerCLI.

Put the serverlist in a *.txt file that is located in the same folder as the PowerShell script. This will shutdown the server, increase the RAM to 4GB, start the server and then upgrade the VMWare tools.

$servers = Get-Content -Path E:\path_to_my_folder\server_list.txt

get-vm $servers | Shutdown-VMGuest –Confirm:$False

sleep 150

Get-VM $servers | Set-VM –MemoryGB 4 –Confirm:$False | Start-VM

sleep 120

Get-VM $servers | Update-tools -RunAsync