A. Mikkelsen VMware ESX scripts, commands, tools and other nice to know things that will make your virtualization days easier!!!!

Wednesday, April 8, 2009

Powershell : List VMs with CD-ROM, Floppy, Seriel Ports and Parallel Ports

Filed under: PowerShell,Tools — Tags: , , , , , , , , , , , , , — A. Mikkelsen @ 12:34 pm

Today I had to create a script that creates lists of VMs, for each of the below statements:

  • CD-ROM is ‘Connected’
  • CD-ROM set to ‘Connect at power on’
  • CD-ROM device type set to ‘Client Device’
  • CD-ROM device type set to ‘Datastore ISO file’
  • Floppy is ‘Connected’
  • Floppy set to ‘Connect at power on’
  • Floppy device type set to ‘Client Device’
  • Floppy device type set to ‘Use excisting floppy image in datastore’
  • Serial Ports attached
  • Parallel Ports attached

Get it here

Thursday, April 2, 2009

Smart and simple VCB backup script for ESX & ESXi

Filed under: PowerShell,Scripting,Tools,VCB — Tags: , , , , , , — A. Mikkelsen @ 10:19 am

A fellow member in the Danish Usergroup has created a very simple backup script for ESX and ESXi using PowerShell and VCB.


I like that it’s small and simple.
Keep up the good work….

Monday, January 5, 2009

Graph history on your ESX enviroments development

2 years ago a VMUG user in Denmark created a Ubuntu VM that could graficily could show the develeoment of the amount of VM’s in a Cluster.

Unfurtionally someone stole my labtop and the VM :-).

So I had to create a new. And of cause it’s based on PowerShell ;-).

The webpages shows the following information

  • Amount of VM’s in each Cluster
  • Amount of Hosts in each Cluster
  • The size of each Datastore and the amount of free disk space

Get the source code in the Download section under Vi Toolkit for Windows

Friday, December 12, 2008

Copy to and run any file from your host to all VM’s in a single script

Filed under: Scripting,Tools — Tags: , , , — A. Mikkelsen @ 20:57 pm

Today i came across a post on Yellowbricks.com about the VIX API.

Duncan writes about how he was able to copy a file (vb script) from his labtop to all his VM’s in a single script, and then execute the script on all VM’s from the same script – and much much more.
Read more

This got me thinking, the possebilities are endless 😉

  • Install MSI packages in your VM without the use of SMS.
  • Start/stop services based om a script or other thinks.
  • Copy a file to/from a VM to the host that executes the script – like config or log files.
  • etc….

The VIX API run not only on ESX but also on Workstation and Server versions.

So now i just have to find the time to get cracking on some code…..

Monday, December 1, 2008

BULK upgrading VM’s memory

Filed under: ESXi,PowerShell,Scripting,vSphere (ESX) — Tags: , , , , , , , , , , — A. Mikkelsen @ 17:34 pm

Today I had to upgrade all our Jumphost VM’s from 256MB to 512MB of memory (more than 200 VM’s).
There are two ways accomplice this.

1. Do it manually (Very time consuming)

2. Script it with PowerShell

As the lazy person I am I decided that scripting was the way forward.
The script I came up with is as follows:

Connect-VIServer "vi_servername" -User "vi_username" -Password password"

# Select all VM's that have less than 512MB and change the Memory to 512MB
foreach ($vm in Get-VM | Select Name,MemoryMB | Where-Object{$_.MemoryMB -lt "512"}){
Set-VM $vm.Name -MemoryMB "512" -Confirm:$FALSE

To suppress the script to prompt for acceptance each time I added the following option

The script easily be changed to add or update other VM hardware settings.
– Number of CPU’s (Set-VM <vm-name> -NumCpu 2)

– Rename VM (Set-VM <vm-name> -Name “NewName”)

Find more options and ideas in the “Automating VMware with PowerShell – Hands-On Lab” from VMworls 2008.

Just remember if a VM is running you have to poweroff or shutdown the VM before the changes will take effect.
This is because a restart or reset does’t reload the vmx file.


The script is now updates so it also implements the following settings

  • Sets Memory Reservation to half of the amount of ram.
  • Sets Memory Limit to “Unlimited”
  • Sets the VM to check for new VMware Tools on PowerOn.
  • Sets the VM to sync time from host.

Take a look at the scripts here.

Tuesday, October 21, 2008

PowerShell script – List snapshots

Filed under: PowerShell,Scripting,Tools — Tags: , , , , — A. Mikkelsen @ 11:54 am

I have created at PowerShell script that obtains a list of VM’s that have snapshots attached. The output is then converted to a html file using the cmdlet ConvertTo-HTML.
And just to make it easier to obtain the html file, the script mails the html file to me as an attachment.

Ths script has been updated thanks to Ryan, to be able to handle multiable snapshots on each VM.

Get the script from the Downlaod section.

Sunday, September 28, 2008

Converting vcinfo from Perl to PowerShell

The past few days I have been trying to learn the basic of PowerShell and the VIToolkit for Windows.
And after playing around with it, I thought that the best way to learn PowerShell was to have a goal.

And what better goal than converting the vcinfo script I created with VIPerlToolkit.

A beta version of the script is now avaiable for download – get it here.
But I have to warn you – the script is still in beta.

I have added a few of the old information and some new ones.
More info will be added when I get the time.

If you have any suggestions on what info the script should show in VC, please let me know.

Adding your own PowerShell Scripts to VC – yes it’s possible….

Filed under: PowerShell,Scripting,Tools,Virtual Center — Tags: , , , — A. Mikkelsen @ 19:58 pm

I was surfing around for new powershell scripts and came across an application for icomasoft that gives you the abbility to add and run your own PS scripts from Virtual Center.

Thyis is just too cool.
Check it out.

Tuesday, August 12, 2008

Automate the installation of multi ESX hosts

Filed under: Scripting,Tools,vSphere (ESX) — A. Mikkelsen @ 21:20 pm

A Danish VSP instructor (Tommy) told me about a cool looking tool to deploy ESX hosts with a consistent standard.

V-Ployment comes in two versions.

  • A free version for deploying up to two servers.
    The free version is limited in features but gives you the basic.
  • The full version offers a lot more features.

This tool is easy to use and configure.

Read more info at V-Plotments website.

Friday, August 8, 2008

Automate configuration of host with statelesx

Filed under: ESXi,Scripting,Tools,Virtual Center,vSphere (ESX) — A. Mikkelsen @ 22:31 pm

www.vinternals.com has release a super cool looking tool (appliance) for automating the configuration of multi hosts.
The appliance is called statelesx (pronounced “stateless”).

Get more details on this super cool appliance at www.vinternals.com.

« Newer PostsOlder Posts »

Powered by WordPress