VAPP cloning without vCloud

Hello

We currently use the cloning of vApps on vCenter to wring an environment for our users when necessary.  Our current process is to use Powershell scripts called from a web service to clone a paralytic, but due to various problems with implementation, we are looking to move to Orchestrator.  I have looked around various resources on how to clone a VAPP using Orchestrator but just short.  There are a few items I found how to clone a paralytic, but everything is for all those who use vCloud Director.  I tried a Scriptable task to cloning by creating a new object VirtualApp defining any additional information to send in the clonevapp_task of coding, but I ran into issues trying to create the object VirtualApp.  Then, I tried to send in the VAPP object in the script task to ensure at least it works, but the clonevapp_task command is to launch a mistake because my VAppCloneSpec is not correctly identified.

Can someone point me in the right direction in order to clone the VAPP?  Ideally, I would like to send a name of a paralytic to clone and the name of the new TIME and have the code/workflow do the rest.

Thank you
Dan

Hello scrappy - I do not have the time nor resources that look entirely at the moment, but your task scriptable should resemble the following:

// Initialize the VcVappCloneSpec and assign properties
var vAppCloneSpec = new VcVAppCloneSpec();
// vAppCloneSpec.host = targetHost; // online docs say this is not needed and resource pool will determine behavior: http://www.vmware.com/support/orchestrator/doc/vco_vsphere55_api/html/VcVAppCloneSpec.html
vAppCloneSpec.location = targetDatastore; // Input: VC:Datastore
vAppCloneSpec.vmFolder = targetVmFolder; //Input: VC:vmFolder
vAppCloneSpec.provisioning = provisioningType; // one of the following strings: thin, thick, sameAsSource

// Need to get source vApp networks so they may be mapped to destination vApp networks:
var sourceNetworks = vApp.network;
var networkMapping = new Array();

// The following code needs to be rewritten to account for more/less networks:
// Assumes the array "targetNetworks" has matching destination networks for each of the source networks
for each (net in sourceNetworks){
    var networkMappingPair = new VcVAppCloneSpecNetworkMappingPair();
    networkMappingPair.source = net;
    networkMappingPair.destination = targetNetworks[0]; // Input: Array of VC:Network that matches up to the source networks by index - as noted above, this should be written to be more dynamic
    networkMapping.push(networkMappingPair);
}
// Now that the network mappings are ready, add property to clonespec:
vAppCloneSpec.networkMapping = networkMapping;

var task = vApp.cloneVApp_Task(newVAppName , targetPool , vAppCloneSpec);
// Pass this task out to another workflow element that waits for the task to complete...

Yet, I have not validated the code above, but looking at the objects in the API Explorer, this seems to be common sense. Pay attention to my comment lines in the above code, because it requires some adjustments.

Tags: VMware

Similar Questions

  • Problem deploying Multi-VM. VAPP in vCAC vcloud

    Hello

    Has anyone encountered problem with vCloud Director during commissioning Multi-VM. VAPP using vCAC?

    I am facing this problem while commissioning Multi - VM vCAC VAPP, initially, everything looks promising, but everything in the middle of provisioning error occurs at the vCAC

    vcac-er1.JPG

    After this error, the paralytic is removed from the Machine my registration while VAPP is still exists in vCloud Director.

    Log Viewer under the error checking inlet

    vcac_log.JPG

    the Stack Trace is as below

    "at DynamicOps.VCloudModel.Interface.VCloudManagementServices.WaitForTask (Int32 periodInSeconds, task, Int32 retryCount) at DynamicOps.VCloudModel.Interface.VCloudManagementServices.CreateVAppFromTemplate (String vdcId, String appName, String templateName, networkName string, String storageName, String templateHref) at DynamicOps.VCloudModel.Activities.VCloudCreateVAppFromTemplate.Execute (CodeActivityContext context) at System.Activities.CodeActivity.InternalExecute (ActivityInstance, executor, BookmarkManager bookmarkManager ActivityExecutor instance) to System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody (ActivityExecutor executor, BookmarkManager bookmarkManager, location resultLocation).

    It seems that for me, this could be the issue of the Workflow timeout to expire or terminate the process.

    Reson this assumption is, if I have available TIME equipped with unique virtual machine, it available very smoothly and thus obtain PowerON.

    Any thoughts!

    Kind regards

    MG

    It had been as Bug by VMware Support that is fixed in the new version 5.2

    55734

    [Service/vCD release] A scheduled 10-minute time-out occurs during the configuration of a paralytic

    This requires a long time to finish

    SH cloning. To resolve th

    is question, a new vCloud

    overall activity timeout, special activity property

    Timeout, was added and sets the timeout for all

    vCloud activities, for example the data inventory co

    create, power options, and provisioning. The

    default value is 30 minutes and can be changed

    vCAC as is demanded by the administrator.

  • Sheesh!  Is it possible to add more disk space to a computer existing virtual or cloned without rebuilding the whole OS?

    Going too for workstation.  Thank you.

    Eric reading page here http://www.vmware-land.com/Resizing_Virtual_Disks.html for all the info you need.

  • Nested VApps in vcloud Director

    Is it possible to create the vapps nested within vcloud Director?

    Nesting vapps won't happen in vCD.  They will be parallel vApps.  Is not stop you from writing a tool/site Web automation, which would show you have there.

    vRA will address finally that, but they do not use vApps.  all virtual machines just became machines to manage without the concept of being part of a paralytic.  It will be that you have a plan of several computers that uses two other plans several computers (a DB level on the application layer).

  • vCloud 5.1 without vSheild

    Guys,

    I just want to check if it is possible to implement vCloud Director 5.1 without vCloud Networking & Security Components (IE vShield Manager?

    Thank you

    When you attach a vCenter Server in your environment for vCloud Director you will also need to provide details of the associated vShield Manager, so it is a requirement, even if you are not using routed oVDC/VAPP networks.

  • Sharing a vApp, catalog by using the vCloud API

    I need to share the vApp using the vCloud API but cannot find anything it either relating to the sharing of operation in the API documentation. If someone was able to perform using the API please give me the steps or the example code to do the same.

    Hello

    You can share vApps among members of your organization.

    'Control of access to the catalogues and vApps' - vCloud API Guide 1.5, Pg No. 157.

    GET https://vcloud/api/vApp/{VAPP id} / controlAccess - read access control settings on the vApp.

    POST https://vcloud/api/vApp/{VAPP id} / action/controlAccess - update settings for access control on the paralytic.

    Kind regards

    Rajesh Kamal.

  • Consult VAPP name UUID

    Hello

    I am trying to solve some of the content of a message that we receive for a failure of AMQP event. The names of some events are more useful than the UUID. I haven particular, I'm looking to retrieve the name of vApp (among other data) using the provided uuid. Here is a sample of the XML that is generated from the AMQP message:

    <?xml version="1.0" encoding="UTF-8"?>
    <vmext:Notification xmlns:vmext="http://www.vmware.com/vcloud/extension/v1.5" type="com/vmware/vcloud/event/task/complete" eventId="dfa10892-e93a-4b7d-8201-cbac0713fee3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.vmware.com/vcloud/extension/v1.5 http://172.16.254.25/api/v1.5/schema/vmwextensions.xsd">
        <vmext:Link rel="entityResolver" href="https://172.16.254.25/api/entity/"/>
        <vmext:EntityLink rel="entity" type="vcloud:task" name="vappDeploy" id="urn:vcloud:task:338bfbfa-09ee-49c3-8b49-883251099f5d"/>
        <vmext:EntityLink rel="down" type="vcloud:user" name="system" id="urn:vcloud:user:ac696d01-12d9-4763-9fd6-26a06b6a3778"/>
        <vmext:EntityLink rel="up" type="vcloud:org" name="ORG" id="urn:vcloud:org:3cde66f6-a81e-47a0-ace0-80725d158604"/>
        <vmext:EntityLink rel="task:owner" type="vcloud:vapp" id="urn:vcloud:vapp:94144a90-04f4-41c3-87a5-722d7b219634"/>
        <vmext:Timestamp>2013-07-31T16:36:28.170-04:00</vmext:Timestamp>
        <vmext:OperationSuccess>false</vmext:OperationSuccess>
    </vmext:Notification>
    

    And here's a message JSON is also generated with the same event.

    {"eventId":"dfa10892-e93a-4b7d-8201-cbac0713fee3","type":"com/vmware/vcloud/event/task/complete","operationSuccess":false,"timestamp":"2013-07-31 16:36:28.170","user":"urn:vcloud:user:ac696d01-12d9-4763-9fd6-26a06b6a3778","org":"urn:vcloud:org:3cde66f6-a81e-47a0-ace0-80725d158604","entity":"urn:vcloud:task:338bfbfa-09ee-49c3-8b49-883251099f5d","taskOwner":"urn:vcloud:vapp:94144a90-04f4-41c3-87a5-722d7b219634"}

    I currently have a vCO code that can extract the UUID. However, I can't seem to figure out how the query VCloud to the properties of the object using the UUID.

    Examples on how to proceed is appreciated.

    Why not try something like obtaining an object by ID... Once you have the object, you can obtain some properties you like...

    var vApp = Server.findForType("vCloud:VApp","urn:vcloud:vapp:94144a90-04f4-41c3-87a5-722d7b219634");
    System.log("vApp Name: "+vApp.name);
    

    I used the VAPP id you have demonstrated in your post here... try this code and see if it works...

  • VAPP networks need to connect to the network Org?

    I installed my test environment and have created a network of VAPP is not connected to a net Org.   In theory, it is an isolated network VAPP, but showing trade in my vDS, I see that a portgroup VAPP is not created for this network VAPP.   Without the support of a portgroup VAPP VMs would be unable to communicate with eachother if they land on different hosts, right?

    So if it is possible to configure vApps 'isolated' in this way, it would be impractical to that virtual machines would not be able to communicate?

    Thank you

    -Matt

    Also, you need power vApp on for the Portgroup to create.

  • How to get VAPP model mem and CPU information processing

    Hi people,

    As part of the development of a workflow approval to instantiate a vApp, I need to shoot the details of memory and cpu for a VAPP model to vcloud director, which lies in a catalog.

    I'm not finding any option under "VclQueryResultAdminVAppTemplateRecord" in the search for the API.

    Please advise.

    Unfortunately, this info is not available when the Instantiate vAppTemplate task is blocked. My team has reported that genius and asked that these additional information made available via the api. Here is an example of the level of information that we can currently extract in this task of blocking:

    User

    • Name: jdoe
    • Description:
    • Full name: John Doe
    • E-mail address: [email protected]
    • Phone number: (555) 555-1212
    • Instant Messenger ID:
    • Quota VM has deployed: unlimited
    • Stored the Quota VM: unlimited
    • Role: VAPP author

    vApp

    • Name: vApp_jdoe_4
    • Description:
    • VDC: Demo-Org-vDC
    • Created: Saturday, February 11, 2012 02:14:05 GMT - 0000 (UTC)
    • Number of virtual machines: 2
    • Disk size: 9728 MB
    • Rental storage: Saturday, February 11, 2012 03:14:05 GMT - 0000 (UTC)

    VM

    • Name: XP-Pro-TEMPLATE2
    • Guest OS: Microsoft Windows XP Professional (32-bit)
    • Network name: Test-NAT-routed

    VM

    • Name: blanktest
    • Guest OS: Microsoft Windows Server 2003, Standard Edition (32-bit)
    • Network name: Test-NAT-routed
  • Retrieve the status of VM cloning

    Hi all, is - anyone has any sample power CLI to retrieve the State of the virtual machine cloning without having to go through the vSphere Client?

    Why don't you just...

    Get task? | {$_ .name - like 'CloneVm_Task'}

  • Bizzare vShield Edge-NAT/VPN problem Post - 5.1 upgrade

    Hoping someone can shed some light on this issue for us - the TLDR is that NAT rules seem to be causing unexpected behavior on the VPN traffic after a vCloud 1.5 to 5.1 upgrade.

    Background: We work with a hosting provider to manage our vCloud environment. Quite simple - 2 ESXi hosts, a few NFS data stores. They have recently updated us of 1.5 and 5.1. For most of our committees, we have just one network of vSE/Routed that connects a subnet to a network of "WAN" and pulls a public IP address from a pool. Send us (NAT network address) and leave (firewall) ports (for example port 3389 for RDP) to the virtual machines selected. Most of these networks also have a VPN tunnel from site to site with a physical Firewall through the internet. After the upgrade, we went and converted our rules to match the period of initial and active INVESTIGATION "multiple interfaces" - effectively subtracts to compatibility mode. Everything was going well (even for devices of vSE always in compatibility mode)

    Question: We first noticed this, when a customer reported that they are unable to access a virtual machine via RDP using it is internal (protected VSE) IP through a VPN tunnel but could access the virtual machine via RDP using its public hostname/IP address. Allow us all traffic between the VPN (firewall has a whole: a rule for VPN traffic). When we connected to troubleshoot (just thinking that the VPN was down), we found that we could connect to any port on the computer through the VPN tunnel except 3389remote virtual. I can ping from the local subnet to the VM troubled on the VAPP network without problem. I was able to connect to other ports that have been opened on the remote virtual machine without problem. I couldn't connect to 3389 through the VPN.

    We thought he could be isolated, but found the question on each VSE we have: If there were a the DNAT rule to translate the inbound for a particular port, this port would be insensitive when traffic through the VPN tunnel that is meant to be the target of the DNAT rule.

    Someone has an idea what could be the cause?

    Looks like it is a problem experienced during the upgrade. These hidden firewall rules will not disappear until the firewall configuration is updated in some way. So go as - upgrade

    (1) upgrade VCD

    (2) update VSM

    (3) to redeploy the entry door to upgrade the edge of the gateway to version 5.1

    (4) convert the firewall rules to the new format (where firewall rules have no management interface or traffic)

    (5) to change the properties of the bridge and the multiple interface mode

    (6) change the specification of the firewall somehow, that is to add a dummy firewall and remove it, turn off, then turn on the firewall, etc..

    Which should cause the deny rule go away

  • URL of Java sdk sample programs

    In the following example, where can I find the vCloudApiVersionsURL and https://vcloud/api/versions.

    I have already installed vsphere and vcenter. Do I need to install any other software?


    /*
    * *******************************************************
    * Copyright VMware, Inc. 2009-2010.  All rights reserved.
    * *******************************************************
    *
    * WARNING. THIS PROGRAM IS PROVIDED TO YOU "AS WHAT ' WITHOUT
    * WARRANTIES OR CONDITIONS # IF ORAL, WRITTEN, OR ANY
    * EXPLICIT OR IMPLICIT. THE AUTHOR SPECIFICALLY # DISCLAIMS ANY IMPLIED
    * WARRANTIES OR CONDITIONS OF MERCHANTABILITY, SATISFACTORY # QUALITY,
    * ABSENCE OF INFRINGEMENT AND APPROPRIATENESS HAS A PARTICULAR PURPOSE.
    */
    package com.vmware.vcloud.sdk.samples.extra;
    import java.io.IOException;
    import java.security.KeyManagementException;
    import java.security.NoSuchAlgorithmException;
    import java.util.Map;
    Import org.apache.commons.httpclient.protocol.Protocol;
    Import org.apache.commons.httpclient.protocol.ProtocolSocketFactory;
    import com.vmware.vcloud.api.rest.schema.ReferenceType;
    import com.vmware.vcloud.api.rest.schema.versioning.VersionInfoType;
    import com.vmware.vcloud.sdk.Organization;
    import com.vmware.vcloud.sdk.VCloudException;
    import com.vmware.vcloud.sdk.Vapp;
    import com.vmware.vcloud.sdk.VcloudClient;
    import com.vmware.vcloud.sdk.Vdc;
    /**
    * This example search details VAPP given one of the ip of the virtual machine
    *
    * @author ecosystem Engineering
    *
    */
    public class FindvAppByIp {}
    public static VcloudClient customer;
    /**
    * This method searches the VAPP for ip of the given virtual machine.
    *
    @param expectedIp
    * @return
    * @throws VCloudException
    */
    public static ReferenceType findvAppByIp (String expectedIp)
    get {VCloudException}
    {for (orgRef ReferenceType: {client.getOrgRefs ())}
    Organization org = Organization.getOrganizationByReference (customer,
    orgRef);
    {for (vdcRef ReferenceType: {org.getVdcRefs ())}
    VCC Vcc = Vdc.getVdcByReference (customer, vdcRef);
    {for (vappRef ReferenceType: {vdc.getVappRefs ())}
    VAPP vapp = Vapp.getVappByReference (customer, vappRef);
    {for (VAPP vm: {vapp.getChildrenVms ())}
    {for (String actualIp: {vm.getIpAddresses ())}
    If (actualIp! = null)
    If (actualIp.equals (expectedIp)) {}
    Return vm.getParentVappReference ();
    }
    }
    }
    }
    }
    }
    Returns a null value.
    }
    Public Shared Sub main (string args []) throws VCloudException,
    KeyManagementException NoSuchAlgorithmException, IOException {}
    If (args.length < 5) {}
    System.out
    .println ("java FindvAppByIp vCloudApiVersionsURL 1.0 user@organization ipaddress password");
    System.out
    .println ("java FindvAppByIp https://vcloud/api/versions 1.0 user@Organizaiton ipaddress password");
    System.Exit (0);
    }
    Implementation for SSL access. Do not use production environment
    Https protocol = new Protocol ('https',
    ((ProtocolSocketFactory) new FakeSSLSocketFactory(), 443);
    Protocol.registerProtocol ("https", https);
    client = new VcloudClient(args[0]);
    Versions of map < String, VersionInfoType > = client.getSupportedVersions ();
    customer. Login (args [2], args [3], versions.get(args[1]));
    ReferenceType vappRef = findvAppByIp(args[4]);
    VAPP vapp = Vapp.getVappByReference (customer, vappRef);
    System.out.println (vApp.GetResource (). GetName());
    System.out.println (vApp.GetResource () .getHref ());
    }
    }

    Hello

    What is the vcenter sdk?

    -4.1 ESX/ESXi and vCenter Server 4.1 systems provide a Web service that you can access using the vSphere API. The vSphere Web Services SDK facilitates the development of client applications that target the vSphere API.

    http://www.VMware.com/support/developer/VC-SDK/

    Can't, I used without vCloud Director?

    -Talk to the vCloud API by using the SDK vCloud, to vCloud Director.

    Kind regards

    Wangzi

  • Cannot start new disc

    I'm upgrading from the internal drive in an early 2011 13 "MC700LL/A macbook pro.

    1. I bought a new HGST Travelstar 7 K 1000 1 TB drive and put in a disk external usb dock. I then formatted with extended (journaled) as Mac OS disk with GUID utility.

    2. I then used Carbon Copy Cloner to clone the old internal system disk to the new disk.

    3. He cloned without problem and I can always boot from the new drive while it is in the external case.

    4. I installed the new internal drive and now it won't start. It turns right on the gray apple screen.

    I can boot into recovery and check the drive with disk utility. But if I try to select it as a boot disk, that it says that it cannot be blessed. If I put the old drive back in there fine boots. If I put the new drive in the external enclosure usb, it starts very well. I also tried to reset the PRAM

    I found people with similar problems online and often arrange it a new cable from hard drive. But they often try to install an SSD (which I think is more sensitive to bad hard drive cables), and they also seem to have a file system with a line through it. I get the circle of rotation and want to install a regular reader. It starts very well inside my old drive.

    Any ideas on why the drive can't be blessed and boot? I have spent a lot of time on this and would appreciate all the advice really. Thank you.

    Hi Seggeth,

    Thank you for using communities Support from Apple!

    I understand that your new drive is not start as expected when you try to select it as your startup disk. To begin troubleshooting, I would suggest reinstalling the new disk and reinstalling OS X on it.

    How to reinstall OS X on your Mac - Apple Support

    After installation of OS X, try to select it as your diskette of starting again.

    Best!

  • Hotfix for KB 2470478 Vista moved it - error 0xc8000247

    I have a HP Pavilion dv6700 laptop running Windows Vista Home Premium SP2. I got my drive hard original factory replaced with a Western Digital Scorpio Black 750 GB hard drive, WD7500BPKT-22PK4T0. The store of the computer creates an image of my old drive using Acronis True Image Home. Everything seemed to work fine until I noticed that Windows Update did not work and said that the service was not working, while he was actually. The error in the WindowsUpdate log was 0xc8000247.

    I discovered a thread from 2011 indicating this problem, others that I lived because of my new HDD is an advanced Format drive that uses a 4 K sector size rather than size of 512 K older sector. The Microsoft Knowledge Base has an article on issues that I am experiencing. specifically, the 2470478 KB. I tried to install the fix that is provided in this article, but it won't work. It throws the same error, 0xc8000247. Similarly, I can not install the system update readiness tool.

    I read that Microsoft could be published a new version of this fix that works in 2011 (!) or including a fix in Vista SP3. However, none of them happened. Is there a way to fix this?

    Thank you!

    Hello

    Going to answer my own question here, because I finally found the answer in this thread of the Acronis forum:
    I followed the steps posted by tubebend and ncsdiver towards the end of the thread.
    Bottom line, to make Vista works on the new hard drive for Advanced formatting, I had to restart the old drive hard in, install the Microsoft KB 2553708 hotfix on the old disk and then re - clone the drive on my new advanced Format drive.
    Then, because my computer has an Intel chipset, I also had to install a driver Intel Rapid Storage Technology 9.6 versioned (or most recent) on the new drive to support Advanced Format drives.
    After these steps, we worked through Windows Update.
    Research still wasn't working, so the last step was to boot from the Vista installation disc, choose repair, open a command prompt and issue the command /FixMbr. Bootrec After that, all the services and applications that depend on ESENT worked again.
    Here's a great article for anyone installing Windows Vista or Windows 7 disk Advanced Format that explains the problem in simple terms and provides a bunch of good links:
    One of the links is to the next page of Microsoft which has a table showing what it takes to run correctly on a hard drive of the Advanced Format various Microsoft OSes:
    Hope this post makes this information more visible and help others who have cloned without wanting their systems Windows Vista or Windows 7 on an older drive on an advanced Format drive. The problems that Windows running on Advanced Format drives don't seem to be common knowledge.
  • Set up a pre-production environment...

    My current employer has a pre-production environment that is being updated nightly from the production. I started to look at how it is done (powerCLI script) and I'm trying to make things better.

    Here's how it works.

    A snapshot is taken of production servers, which 'freeze' the base vmdk disk. A new virtual machine is created for pre-production and it uses the 'frozen' drive to the production server database, because it is not persistent mode, clean disc. Of course, the virtual machine is connected to a group of isolated ports. Basically, this allows the team dev/infra to have an identical copy of the production servers anytime (just run the refresh script).

    While this works very well, I have a problem on using disks of production for this purpose. Usually, I prefer to leave only one production and complete clones have either fully provisioned pre-production environment.

    Suppose I'm onboard with happens like that and I want to automate the creation of these reservoirs of pre-production. Right now they are built manually to the new servers, and then the refresh script.

    Refresh the script:

    (A) pre-production shutdown server

    (B) remove the snapshot on the production server (committing the latest changes to the base vmdk)

    (C) create new snapshot to the production server (freeze the base vmdk)

    (D) Power Server pre-production (with validated changes)


    This script is scheduled every night to start the next day with a cool environment. Another advantage of this approach that is not persistent, it is that a simple reboot brings the pre-production back to a clean version (if tests are not doing well).

    Issues related to the:

    Is there a way to clone a virtual machine without the disc? This would make the easy creation of new servers in pre-production. Clone, log drives, change the port group. Fact.

    Is there a better way to achieve that kind of result without this kind of 'false linked clones?

    The following seems to work for me. A few notes:

    • The virtual machine is cloned without any of its VMDK
    • The new virtual machine is created on the same node of ESXi and store data as a source of VM (since you don't seem to have special requirements in this aspect)
    • This script does not work for a virtual computer with RDM disks

    $vmName = "sourceVM".

    $vmClone = "cloneVM".

    $folderName = "MyBlueFolder".

    $vm = get-VM-name $vmName

    $folder = get-file-name $folderName

    $spec = new-Object - TypeName VMware.Vim.VirtualMachineCloneSpec

    $spec. Location = New-Object - TypeName VMware.Vim.VirtualMachineRelocateSpec

    $spec. Location.Datastore = $vm. ExtensionData.Datastore [0]

    $spec. Location.Host = $vm. ExtensionData.Runtime.Host

    $spec. Config = New-Object - TypeName VMware.Vim.VirtualMachineConfigSpec

    Get-disk hard - VM $vm | %{

    $dev = new-Object - TypeName VMware.Vim.VirtualDeviceConfigSpec

    $dev. Device = $_. ExtensionData

    $dev. Operation = [VMware.Vim.VirtualDeviceConfigSpecOperation]: remove

    $dev. FileOperation = [VMware.Vim.VirtualDeviceConfigSpecFileOperation]: destroy

    $Spec.Config.DeviceChange += $dev

    }

    $vm. ExtensionData.CloneVM_Task ($folder. ExtensionData.MoRef, $vmClone, $spec)

Maybe you are looking for