Create several clones VMs Script

I recently used this script that I copied from http://www.lucd.info/2010/02/21/about-async-tasks-the-get-task-cmdlet-and-a-hash-table/#more-1820which worked fine the first time, the second time, he wrote in the incorrect data store! How can I change this option to specify what data store to create the VM (s). I'm sorry if I write in the wrong place.

  1. Enter the host name of the server where you want the vm (s) to be installed

$esxName = "esx.sa.com".

  1. Name of the template to use

$modelVm = "Template10".

  1. Enter the names of the new vm (s)

$newVmList = 'vmw-test', 'vmw-test2.

$taskTab = @ {}

  1. Create all virtual machines specified in $newVmList

{foreach ($Name in $newVmList)

$taskTab [http://(New-VM - VM (Get - VM $modelVm) - name $Name - VMHost (Get-VMHost-name $esxName) (-RunAsync).] ID: http://(New-VM - VM (Get - VM $modelVm) - name $Name - VMHost (Get-VMHost-name $esxName) - RunAsync). ID = $Name

}



Thank you

Express

If you want that all the clones to go to the same data store, you should be able to do it like that.

$esxName = "esx.sa.com"
$dsName = "myDatastore"
$modelVm = "Template10"
$newVmList = "vmw-test","vmw-test2"

$taskTab = @{}
foreach($Name in $newVmList){
     $taskTab[http://(New-VM -VM (Get-VM $modelVm) -Name $Name -VMHost (Get-VMHost -Name $esxName) -Datastore (Get-Datastore $dsName) -RunAsync).Id|http://(New-VM -VM (Get-VM $modelVm) -Name $Name -VMHost (Get-VMHost -Name $esxName) -Datastore (Get-Datastore $dsName) -RunAsync).Id] = $Name
}

____________

Blog: LucD notes

Twitter: lucd22

Tags: VMware

Similar Questions

  • Create several clones at a time

    Hello

    I want to prepare the number of virtual machines (i.e. clones or pictures) of the gold statue.

    I develop my own UI where I'll be selecting one of the images existing gold. I will mention a number of clones that I need. When I click on the button, I'll be citing vSphere appropriate web services API to create clones.

    Can someone tell me what do I want to accomplish is feasible or not? Can we create several clones at a time? And that too the use of web services?

    Take a look at CloneVM_Task() , you can certainly deploy several clones at the same time, but you probably want it saving 3-4 as it's pretty resource, especially against your storage space.

    =========================================================================

    William Lam

    VMware vExpert 2009

    Scripts for VMware ESX/ESXi and resources at: http://engineering.ucsb.edu/~duonglt/vmware/

    repository scripts vGhetto

    VMware Code Central - Scripts/code samples for developers and administrators

    150 VMware developer

    Twitter: @lamw

    If you find this information useful, please give points to "correct" or "useful".

  • Create several virtual machines from the same base image

    Hi all

    Is there any vi api sdk by which I can create several virtual machines form same base vmdk file?

    All create the VM from the base VMDK file will have their own delta vmdk file that will refer to the same base VMDK file. Only changes that are performed on each virtual machine are saved on their respective delta vmdk files.

    Thanks in advance...

    Hello

    What you are referring is called Clones related, in the current VI API, there is no method that supports this feature. You can take a look at CloneVM_Task() http://www.vmware.com/support/developer/vc-sdk/visdk25pubs/ReferenceGuide/vim.VirtualMachine.html#clone if you want to implement a full clone and this will require you to have access to vCenter.

    In the next version of vSphere, vSphere SDK THAT will provide a way to implement the related Clones and it will be a parameter you can specify CloneVM_Task() , more precisely in the VirtualMachineRelocateSpec where you will specify diskMoveType to createNewChildDiskBacking

    You can find more information once vSphere of GA and the new QAnywhere VI documents are released, but if you are looking to implement related Clones today, you can take a look at the product of VMware View 3, which provides support for linked Clones or you can take a look at two scripts that I wrote which creates linked Clones similar to that of the view :

    Clones related to ESX

    CLones related to ESXi

    =========================================================================

    William Lam

    VMware vExpert 2009

    Scripts for VMware ESX/ESXi and resources at: http://engineering.ucsb.edu/~duonglt/vmware/

    repository scripts vGhetto

    http://Twitter.com/lamw

    If you find this information useful, please give points to "correct" or "useful".

  • How to create several site VPN on Cisco 2801

    Hello

    We use 2801 to our VPN needs. We have already configured a VPN site-to site inside. My current scenario is to create several VPN IE at different sites and a remote client VPN server for our road warriors (they use a cisco VPN client to connect).

    Let me know how can I achieve that scenario. Currently we have in VPN profiling in place. can I fill the script using VPN profiles, how it can be used. Kindly advice me at the earliest.

    Please find attached the 2801 direct configuration file, which is quite works very well

    Thanks in advance.

    Djamel.

    Djamel

    As much as I know it does no harm to have political isakmp 9 and isakmp 10 with the same parameters in each of them. But it also is not good. Others that extra isakmp policy I don't see anything that seems problematic in the config you have posted.

    HTH

    Rick

  • For loop create linked Clone

    I have a script that will create a clone that is linked to from a snapshot, apply a cuztomization and start the virtual machine, what I want to do is create a loop for who would do this for multiple virtual machines. but I have no idea how to do so I don't know a loop, that's what I need, but I don't know how I should format the code.

    Here is my script up to now:

    [Code]

    to connect-viserver 'vCenter5 '.
    $sourceVM = get - VM 'Pano-VM-1 | Get-View
    $cloneName = 'Pano-VM-1.
    $cloneFolder = $sourceVM.parent
    $cloneSpec = new-object Vmware.Vim.VirtualMachineCloneSpec
    $cloneSpec.Snapshot = $sourceVM.Snapshot.CurrentSnapshot
    $cloneSpec.Location = new-object Vmware.Vim.VirtualMachineRelocateSpec
    $cloneSpec.Location.DiskMoveType = [Vmware.Vim.VirtualMachineRelocateDiskMoveOptions]: createNewChildDiskBacking
    $sourceVM.CloneVM_Task ($cloneFolder, $cloneName, $cloneSpec)
    Set-VM 'Pano-VM-1' - OSCustomizationSpec "Pano-VDI" - confirm: $false
    Start-VM 'Pano-VM-1' - confirm: $false

    [/ Code]

    Thank you.

    for ($i=0; $i -lt 10; $i++) {
    
    $sourceVM = get - VM 'Pano-VM-1 | Get-View
    $cloneName = ' Pano-VM-Clone-$I ".
    $cloneFolder = $sourceVM.parent
    $cloneSpec = new-object Vmware.Vim.VirtualMachineCloneSpec
    $cloneSpec.Snapshot = $sourceVM.Snapshot.CurrentSnapshot
    $cloneSpec.Location = new-object Vmware.Vim.VirtualMachineRelocateSpec
    $cloneSpec.Location.DiskMoveType = [Vmware.Vim.VirtualMachineRelocateDiskMoveOptions]: createNewChildDiskBacking
    $sourceVM.CloneVM_Task ($cloneFolder, $cloneName, $cloneSpec)
    Set-VM ' Pano-VM-Clone-$I '-OSCustomizationSpec "Pano-VDI" - confirm: $false
    Start-VM ' Pano-VM-Clone-$I "-confirm: $false
    }

    It should work.

  • Create several virtual machines from a

    Is it possible to create multiple virtual machines a build? I have a 2008 R2 vm. instead of having to rebuild the whole system from scratch is there a way to make a template or something to create several virtual machines a build? I am using vcenter 5 and I have 2 servers esxi 5.

    You can create a template by right-clicking the virtual machine and choose Clone to the model and give the datstore where you want to save after that you will have a model using this model to deploy the virtual machine using Customization Wizard.

  • create a clone bound of VAPP?

    Hello

    How can I create "linked clone" of VAPP vSphere web services SDK?

    Rizwan

    Hello

    Creation of Clones related to a paralytic is not possible through the vSphere API, only full clones can be made. You can however ask an existing VAPP, take each virtual machine and create linked Clones and you can refer to the details at VMware Linked Clone WP - http://www.vmware.com/support/developer/vc-sdk/linked_vms_note.pdf

    =========================================================================

    William Lam

    VMware vExpert 2009

    Scripts for VMware ESX/ESXi and resources at: http://engineering.ucsb.edu/~duonglt/vmware/

    Twitter: @lamw

    repository scripts vGhetto

    Introduction to the vMA (tips/tricks)

    Getting started with vSphere SDK for Perl

    VMware Code Central - Scripts/code samples for developers and administrators

    VMware developer community

    If you find this information useful, please give points to "correct" or "useful".

  • Creating a clone to test the drive to the VM

    I recently installed an application on ESXi 4 with the VSphere client server.  I want to start the virtual machine as a test for a demo of client on your laptop with the VMPlayer.  Is this possible?  It seems that the only option to create a clone is to use VCenter Server, or is there another (easy) method.

    Use VMWare Converter standalone 4.0 and is also free. You will be able to convert back and forth ESXi Server VMs. Using this converter, you will also be able to P2V i.e. convert your physical server into a virtual machine.

  • Problem in creating several attributes XML with the same name of the attribute

    I am trying without success trying to create several attributes XML with the same name, as shown here in a Microsoft example configuration file:



      
         
         
         
      

    I'm calling the NewDocument GetRootElement functions and then "newelement" (appSetting), "newelement" (add)

    Then I call AddAttribute with add, key & Key0, then with add, value & 0.  This seems to work fine but when I try to add the second pair of key & Key1 and value attributes & 1 for item "Add" replaces ""and I find myself with"" only.

    I do something wrong or CVI is not able to create an XML of this type?

    Thank you

    Here's how you do it. I show not to keep things simple error checking.

    #include

    public static void CreateAddElement (mother of CVIXMLElement, const char * key, const char * value)
    {
    Add the CVIXMLElement;
    CVIXMLNewElement (parent, -1, 'Add', &add);)
    CVIXMLAddAttribute (add, "touch", key);
    CVIXMLAddAttribute (add, "value", value);
    CVIXMLDiscardElement (add);
    }

    void main (void)
    {
    CVIXMLElement root, and appSetting;
    Doc CVIXMLDocument.
     
    CVIXMLNewDocument ("configuration", &doc);)
    CVIXMLGetRootElement(doc, &root);)
    CVIXMLNewElement (root,-1, "appSetting", and appSetting);
    CreateAddElement (appSetting, "Key0", "0");
    CreateAddElement (appSetting, "Key1", "1");
    CreateAddElement (appSetting, "Key2", "2");
    CVIXMLDiscardElement (appSetting);
    CVIXMLDiscardElement (root);
    CVIXMLSaveDocument (doc, 1, "c:\\temp\\temp.xml");
    CVIXMLDiscardDocument (doc);
    }

  • How can I create several rectangles with a draw rect.vi

    How can I create several rectangles with a fire rect.vi? Thank you

    Like this...

    -DP

  • Creating a Clone of VI in the real-time platform

    Hello

    I wanted to create a clone of VI in time real LV on cRIO-9022 controller. I changed the properties to run VI and selected pre allocated incoming running clone.

    But I'm unable to generate the clone like this.

    I read from here, "you can configure LabVIEW to allocate or share a VI clones reentrant clone shared within a structure ofloop delayed or Timed Sequence" .

    My question is how can we create a clone of screws in the RT platform? clones are limited to Timed loops only?

    I use LV 2013, cRIO-9022, chassis NI 9114

    Thank you

    Thibault

    Hello

    I got it, it was similar to what you do on a normal LabVIEW VI. I expect a change in the name of VI in CloneXXXX.vi, but in real time, I think that you do not have this indication.

    As he had no name and when I try to open the instances of these real-time clone live all were directed to the real VI itself, so I thought that it did not work.

    but I think that it how it is in real time.

    I did a test using the simple addition of numbers using clones and it works very well.

    If you do not get the clone of instance names when you open the front door and we cannot highlight the real-time performance clone VI

    I think it's obvious.

    Thank you

    Thibault

  • Create several folders with several folders in the rapids

    How can I quickly create several folders with a specific set of folders in each of them?

    for example:
    Folder1-> test1, test2, test3...
    Folder2-> test1, test2, test3...
    Folder3-> test1, test2, test3...
    etc.
    I want to create several folders named specifically with an ID I'll specific, and in each of these cases, I would like to have a set of folders.
    Thank you for your help.

    Hello

    Check out the steps suggested by Steve Winograd and TechHead74 in http://answers.microsoft.com/en-us/windows/forum/windows_xp-files/how-or-can-i-create-numerous-new-folders-instaed/a2a67066-7e97-47b3-aba4-8e8a1a460ca3

    Hope this helps you.

  • How to create several classes of cascade?

    Goal: Create the button to start and stop the service.

    Situation: One button works.

    However, whenever I click on another button, the button does not work.

    Question: how to create several classes of cascade?

    or something wrong in my code?

    Mini code:

    Calls a CPP QML.

    ApplicationUI::ApplicationUI (bb::cascades:Application * app): QObject (app)

    {
    QmlDocument * qml = QmlDocument::create("asset:///main.qml").parent(this);

    CameraWrapper * wrapper = new CameraWrapper();

    QML-> setContextProperty ('wrapper', wrapper);

    AbstractPane * root = qml->() createRootObject;
    App-> setScene (root);
    }

    And then, QML calls another RPC.

    import bb.cascades 1.0

    {Page}
    {Of container
    layout: {DockLayout}
    }
    Button {}
    text: qsTr ("Start")
    onClicked: {}
    wrapper.startRec ();
    }
    }
    Button {}
    text: qsTr ("Stop")
    onClicked: {}
    wrapper.stopRec ();
    }
    }
    }
    }

    The main CPP:

    #include "cam.hpp".

    using namespace bb::cascades;

    {CameraWrapper::CameraWrapper()}

    int CameraWrapper::startRec() {}

    This button works.

    }

    int CameraWrapper::stopRec() {}

    This button does not work.

    }

    The main.hpp

    Class CameraWrapper: public QObject
    {
    Q_OBJECT
    public:
    CameraWrapper();
    Virtual ~ CameraWrapper() {}

    Q_INVOKABLE
    int startRec();
    int stopRec();
    };

    Thank you for your attention,

    Finally, we use the thread to solve the problem.

    Solution:

    loopWrapper (void * test) {void *}
    CameraWrapper * a = (CameraWrapper *) test;
    a-> startRec();
    return null;
    }

    setFlagWrapper (void * test) {void *}
    CameraWrapper * b = (CameraWrapper *) test;
    b-> setFlagFalse)
    return null;
    }

    void * CameraWrapper::setFlagFalse (void * arg) {}
    exit_application = false;
    fprintf (stderr, "Flag changed to false\n");
    return arg;
    }

    void CameraWrapper::runLoop() {}
    pthread_create (& thread_a, NULL, & loopWrapper, (void *) this);
    }

    void CameraWrapper::runSetFlag() {}
    pthread_create (& thread_b, NULL, & setFlagWrapper, (void *) this);

  • Cisco ASA cannot create several tunnels at the same address in hand?

    We have several remote sites with Linksys WRVS4400N and Smoothwall firewall/vpn devices.  I need these sites to be able to connect to several tell-contiguous subnets to our main office.  This was done easily with smoothwall and linksys.  You create a separate tunnel for each subnet, and voila, you're done.  However, when I tried this with our ASA newly installed, it won't let me create several tunnels at the same address of the remote peer.  It is a problem because these sites have only a single IP address public static.  Did I miss something or ASA not allow connections to and from multiple subnets form a site with a unique address peer?

    Resembles the limitation on the WRVS4400N as Cisco ASA supports several subnets by tunnel.

    Is there anyway that you can configure a subnet more instead of specific subnets on the ACL?

    For example:

    If you 192.168.0.0/24 and 192.168.1.0/24, instead of having 2 subnets configured, you can combine them into 1 subnet 192.168.0.0/23

  • Is Adobe Muse create several versions of a site?

    1 adobe Muse create several versions of a site, then use the correct version based on the width of the device? I know that reactive design uses the same pages for all sizes of device, from a mobile phone on the desk. Muse Adobe do this? I was expecting to export a mobile/tablet application files and worry about duplication of content.

    2. I've seen in a video tutorial Adobe Muse where a mobile version of landscape was momentarily shown and the content is okay; good size for portrait image expanded to fill the screen to the landscape, making it a gigantic. Could it be customized resized in the landscape to look 'right '?

    Thank you. Excited by the use of this program.

    Steve

    This tutorial answered question 1! Create a sensitive site with Adobe Muse | Adobe Muse CC tutorials

    It seems that you can set breakpoints and resize and move items in function. Once again, the tutorial answers above question 2!

Maybe you are looking for