VMware CLI help with sed command

Man of Honour
Joined
20 Sep 2006
Posts
35,563
I'm trying to script the cloning of VMs using ESXI 5.5

I don't have vCenter so I used the script at the bottom of this page:

http://nchrissos.wordpress.com/2013...ut-vcenter-in-esxi-5-1-free-edition/#comments

At first it wouldn't work so I thought I'd made a mistake, so I created folders exactly like his. I get the same result.

Clone: 100% done.
sed: unsupported command ▒

What is it about the sed command it doesn't like?
 
Looks like the sed command didn't like " so I swapped it with ' and now the VM gets created. Great.

But it's call $1 as there is a reference to this in the vmx. I suspect sed isn't understanding the $1 variable.

I'll continue testing.

This is what's in the script now:

Code:
#!/bin/sh
mkdir /vmfs/volumes/SSD\ RAID5/$1
vmkfstools -i /vmfs/volumes/SSD\ RAID5/Template2012/Template2012.vmdk /vmfs/volumes/SSD\ RAID5/$1/$1.vmdk -d thin
cp /vmfs/volumes/SSD\ RAID5/Template2012/Template2012.vmx /vmfs/volumes/SSD\ RAID5/$1/$1.vmx
sed -ie 's/Template2012/$1/g' /vmfs/volumes/SSD\ RAID5/$1/$1.vmx
vim-cmd solo/registervm /vmfs/volumes/SSD\ RAID5/$1/$1.vmx
 
Last edited:
Back
Top Bottom