VMware Horizon Community
Rajeev_S
Expert
Expert

creating VM's using script.

Is there any script using which i can create VM's.

0 Kudos
4 Replies
nick_couchman
Immortal
Immortal

Are you talking about creating VMs in ESX? VMware doesn't have anything, no, but there may be some resources out on the web. I know of a couple of places that let you create VMX files on web pages, so someone probably has some sort of program to automate it. I believe Virtual Center has some ways of automating that, too...

0 Kudos
davlloyd
Hot Shot
Hot Shot

Is there any script using which i can create VM's.

Pull down the SDK and that gives you the libraries and samples that show how to achieve it in Java, .Net and COM. There is also a strong following of the perl library in sourceforge which plenty of people in teh SDK forum talk up.

We use the SDk to manage, create and monitor all our VM's in both the Desktop (VDI) and Server arena to good effect.

0 Kudos
chouse
Enthusiast
Enthusiast

I wrote a shell script that I run on the service console of one of the ESX servers in the cluster where I want to clone a bunch of VMs.

It reads from a file of custom MAC addresses and then creates a folder on the datastore, copies and customizes a template VMX and then clones the template's VMDK. Our VDI VMs are named for the custom MAC address which is also set to be the MAC of the VM. Then it registers the VM with the server which in turn registers it with VirtualCenter, then it powers it on.

Then our altiris customization process starts by booting from PXE - set as default boot in the template NVRAM file.

Change and use as needed:

#!/bin/bash

#

\# Written by Chris House, Metro Health

\# 7/26/2007

if \[ $# -eq 4 ]; then

template=$1

targetDS=$2

desktopNetwork=Desktop_$3

vlan=$3

numVMs=$4

echo "Deploying $numVMs VM(s) to $targetDS in vlan $vlan from $template"

else

echo "Usage: $0 $macFile.new

mv $macFile.new $macFile

echo ".. done!"

done

echo "`date` - Done deploying $numVMs VM(s) to $targetDS in vlan $vlan"

0 Kudos
uramsi01
Contributor
Contributor

i'll try this.

0 Kudos