Automation

 View Only
  • 1.  Problem creating new VM from template

    Posted Apr 04, 2008 05:47 PM

    I'm trying to use the Powershell API to create a new machine from a template. It works if the template is on the same host as the target VM, but if it's on a different host, I get the following weird error. Am I doing something wrong, or is this not supported? (It does look there is a bug of some sort in the api, because the error message looks malformed.)

    Thanks,

    Steve

    PS C:\Program Files\VMware\Infrastructure\VIToolkitForWindows> New-VM -Template (Get-Template -ID VirtualMachine-vm-487) -Host (get-vmhost HOSTTODEPLOYTO) -Name foo

    New-VM : 4/1/2008 5:40:09 PM New-VM 52F26824-8CFB-48C6-9A1C-B95F6F33A7A7 The operation for the entity vm-487 failed with the following message: "A specified parameter was not correct.

    host"

    At line:1 char:7

    + New-VM <<<< -Template (Get-Template -ID VirtualMachine-vm-487) -Host (get-vmhost HOSTTODEPLOYTO) -Name foo



  • 2.  RE: Problem creating new VM from template

    Posted Apr 04, 2008 07:31 PM

    I was able to get this to work, but I had to supply location and datastore as well to my command-line.

    -KjB



  • 3.  RE: Problem creating new VM from template

    Posted Apr 08, 2008 09:19 AM

    Hi Steve,

    This is a bug in current version of VI Toolkit. You get this exception because the template you want to create VM from is on different machine than the target VM. Currently this does not work

    Regards,

    Georgi Rusev



  • 4.  RE: Problem creating new VM from template

    Posted Apr 08, 2008 12:24 PM

    As posted, I have gotten this to work, creating a new VM using a template existing in a separate cluster than the template. The problem that I see is that the location information is not readily apparent from the syntax that was used. As long as you provide the location to put the new VM, as well as the datastore to use to store the files, the command will complete successfully.

    -KjB



  • 5.  RE: Problem creating new VM from template

    Posted Apr 19, 2008 11:55 AM

    Hi KjB,

    A belated thank-you for answering my question! I finally got it to work after following your suggestion (and also a lot of trial and error--it still feels like the planets need to be properly aligned before this command works).

    Steve



  • 6.  RE: Problem creating new VM from template

    Posted Apr 19, 2008 11:52 PM

    I'm glad it worked.

    -KjB

    Don't forget to leave points for helpful/correct answers.