greg1995
Enthusiast
Enthusiast

VM clone ESX Shell script help - How to register new clone vm to a resource pool

Hi,

I have a script that creates a clone of a template VM and registers the new clone to the ESX console, but what is the command line I need in the script to register it to a specific Resource Pool?

NOTE: I am not using the VI3 management console, just one ESX Server version 3.5

Thank you in advance for all your help!

0 Kudos
4 Replies
sbeaver
Leadership
Leadership

You will need to use vimsh

$ help solo/registervm

Usage: registervm vm path

registervm

Register the vm

$

Steve Beaver

VMware Communities User Moderator

Orlando Area VMware User Group Leader

====

Co-Author of "VMware ESX Essentials in the Virtual Data Center"

(ISBN:1420070274) from Auerbach

*Virtualization is a journey, not a project.*

Steve Beaver
VMware Communities User Moderator
VMware vExpert 2009 - 2020
VMware NSX vExpert - 2019 - 2020
====
Co-Author of "VMware ESX Essentials in the Virtual Data Center"
(ISBN:1420070274) from Auerbach
Come check out my blog: [www.virtualizationpractice.com/blog|http://www.virtualizationpractice.com/blog/]
Come follow me on twitter http://www.twitter.com/sbeaver

**The Cloud is a journey, not a project.**
0 Kudos
greg1995
Enthusiast
Enthusiast

Thank you for the prompt reply!

I was originally using this to register the VM

NVM="vmname"

NVMDIR="vmname"

vmware-cmd -s register /vmfs/volumes/storage1/$NVMDIR/$NVM.vmx

I am a little confused by what you put. Could you tell me one more time but taking account for the information you see above? Thanks!

0 Kudos
sbeaver
Leadership
Leadership

Try this

Vimsh -n -e "/solo/registervm /vmfs/volumes/storage1/$NVMDIR/$NVM.vmx $NVM $Resourcepool"

Or

vmware-vim-cmd /solo/registervm /vmfs/volumes/storage1/$NVMDIR/$NVM.vmx $NVM $Resourcepool

FYI I have not tried this but what is above should give you a very good starting point

Steve Beaver
VMware Communities User Moderator
VMware vExpert 2009 - 2020
VMware NSX vExpert - 2019 - 2020
====
Co-Author of "VMware ESX Essentials in the Virtual Data Center"
(ISBN:1420070274) from Auerbach
Come check out my blog: [www.virtualizationpractice.com/blog|http://www.virtualizationpractice.com/blog/]
Come follow me on twitter http://www.twitter.com/sbeaver

**The Cloud is a journey, not a project.**
0 Kudos
greg1995
Enthusiast
Enthusiast

Thanks again, but that seemed to try to do something, but I keep getting "a "FAILED METHOD CALL" for both ways and says "The request refers to an object that no longer exists or has never existed" and command not found errors.

I found the white paper on this and it also looks a lot like what you suggested, but I get the same thing. Smiley Sad

I also tried it with the actual directory and VM name etc and go the same thing.

0 Kudos