Advanced Customization Learning Performance vCenter

Using VMware Instant Clone via PowerCLI Extensions Fling


In the last post I anounced the new PowerCLI Extensions fling, which allows admins to leverage the Instant Clone abilities found in vSphere 6. Today I’m going to walk you through how to use it.


To be able to fully leverage PowerCLI Extensions, you will need to meet the following requirements:

  • VMware PowerCLI 6.0 R1 or higher
  • PowerShell v2 or higher
  • vSphere 6


  1. Download the latest release of PowerCLI
  2. Download PowerCLI Extensions on the VMware Fling page HERE
  3. Right-Click the PowerCLI Extensions zip file, click Properties, and select ‘Unblock’.
  4. Unzip the contents of the PowerCLI Extensions fling and place them in your PowerShell modules directory (do not rename the folder)
  5. Ensure the VMware.VimAutomation.Extensions folder is only a single directory deep. (module files should be in the next level down)

Using Instant Clone

before creating a parent VM, you will want to ensure that you get your intended-parent VM is in the intended state for the child VMs to pick up and continue. You will also want to create a ‘Post Clone Script’ to attach to the parent VM which will run as each child VM is started. For Windows, this would be a batch (.bat) script, for linux this would be a shell (.sh) script. an example of a Windows Post Clone Script created by  Deji Akomolafe, Staff Solutions Architect at VMware is below:

##### In-Guest Customization script
“%programfiles%\vmware\vmware tools\rpctool” “info-get guestinfo.fork.ipaddress” > c:\ip.txt
“%programfiles%\vmware\vmware tools\rpctool” “info-get guestinfo.fork.gateway” > c:\gateway.txt
set /p ip=<c:\ip.txt
set /p gateway=<c:\gateway.txt
FOR /F “tokens=2,3* ” %%j in (‘netsh interface show interface ^| find “Connected”‘) do set ConnnectedNet=%%l
netsh interface ipv4 set address name=%ConnnectedNet% static %ip% %gateway%
netsh interface set interface %ConnnectedNet% DISABLED
netsh interface set interface %ConnnectedNet% ENABLED

Once you’ve created your Post Clone Script, you can move on to creating your Parent VM

  • Open PowerCLI and import the module
    • import-module VMware.VimAutomation.Extensions

Import Extensions

  • Connect to your vCenter Server
    • Connect-VIServer <your vCenter address>

Connect to vCenter

  • Specify your intended parent VM
    • $parentVM = Get-VM Parent2012

Get-VM Parent2012

  • Enable the $parentVM as an instant-clone parent
    • $parentForkVM = Enable-InstantCloneVM -VM $parentVM -guestUser “administrator” -GuestPassword “VMw@re123” -PostCloneScript C:\temp\WindowsPostScript.bat


  • Add any configuration parameters you want to be able to pass to the child VM
    • $ConfigSettings = @{
      ‘ipaddress’ = “”;
      ‘netmask’ = ‘’;
      ‘gateway’ = ‘’;
      ‘dns’ = ‘’;

Config Settings

  • Create the Instant-clone child VM and attach the configuration parameters
    • $childForkVm = New-InstantCloneVM -ParentVM $parentForkVM -Name Child2012 -ConfigParams $ConfigSettings


  • Start the child VM
    • $childForkVm | Start-VM



Creating multiple child VMs

Using the same commands as we did above, we can create as many instant-clone VMs as we want. To keep things simple as far as IP addresses go, this example will deploy 9 child VMs from the 2012 parent.

1..9 | Foreach {

$configSettings = @{
‘ipaddress’ = “$_”;
‘netmask’ = ‘’;
‘gateway’ = ‘’;

Write-Host “Creating Clone$($_)…”

$childForkVm = New-InstantCloneVM -ParentVM $parentforkVm -Name “2012ChildClone$_” -ConfigParams $configSettings

$childForkVm | Start-Vm -RunAsync | Out-Null

as you can see from above, the only items that have really changed from creating a single child VM is that we piped a series of numbers (1-9) in the command and for each number, it creates a virtual machine with an ip address where _ is the number that was piped in. The names of the VMs are also identified using the piped value, creating

Additional Actions

Sections 7 and 8 of the PowerCLI extensions guide give many examples of what can be done with Instant Clone. For additional examples please refer to these sections.

Things to know

Parent VMs

Once a VM becomes a parent VM, it has limited operations it can do. Parent VMs cannot be used or edited while running as a parent. To release it from being a parent VM, you must power that VM off. You will notice that the other power options are not available while running as a parent. See section 5.1 of the PowerCLI Extensions guide for more details on parent operations.

Child VMs

A child VM can be powered-on, off, and reset. It can be deleted once the VM is powered-off. It can be unregistered, and it can be reconfigured to add disks only. additional operations may be supported in the future, but are not at this current time.


13 comments have been added so far

  1. Does this work if the parent and child are using DHCP assigned IP addresses? Also what happens to the child hostname(s)? We currently use linked clones in vsphere 5.5 and the process of spinning up clones is fast but the guest customization to make sure the children have unique names, reboot etc takes longer than we would like.

    1. Hi Jeremy,
      1) For DHCP, You can use a different post clone script, something like:
      netsh interface ipv4 set address dhcp
      netsh interface set interface DISABLED
      netsh interface set interface ENABLED
      2) For hostname configurations, you can simply add ‘hostname’ param to the $configSettings part, and then use it from within the post clone script just like the other params.

      1. Ammm…for some reason my last comment seem to be only partially submitted. (probably it’s removing env vars automatically)
        Anyway.. Of course in each line you’ll need the interface name (for example: “Local Area Connection”)

  2. Hi,
    Can you help me? I see this and I’m not sure how to get around it. THANKS!!!!

    PowerCLI C:\> $vm = get-vm Win10_1
    PowerCLI C:\> $parentvm = Enable-InstantCloneVM -VM $vm -guestUser “Administrator” -GuestPassword “XXXXX” -PostCloneScript “C:\PostCloneScript.bat”
    Enable-InstantCloneVM : 4/28/2016 5:10:16 PM Enable-InstantCloneVM Method not found: ‘System.Web.Services.Protocols.SoapHttpClientProtocol VMware.Vim.VimClient.get_VimService()’
    At line:1 char:13
    + $parentvm = Enable-InstantCloneVM -VM $vm -guestUser Administrator -GuestPasswor …
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : NotSpecified: (:) [Enable-InstantCloneVM], VimException
    + FullyQualifiedErrorId : Core_BaseCmdlet_UnknownError,VMware.VimAutomation.Extensions.InstantClone.Commands.EnableInstantCloneVM

    PowerCLI C:\>

    1. You are getting this error because, I think, you are not running the PowerCLi 631R1 specific extension. When you go to download the extension zip file, make sure to select the one for 631R1 and above from the dropdown menu. That did it for me.

  3. Hi, Can someone please help me, Getting error as below most of the time and not able to proceed further. (Followed the same steps mentioned here in this blog, and was able to succeed earlier, but now getting this error)


    New-InstantCloneVM : Cannot bind argument to parameter ‘VM’ because it is null.
    At line:1 char:45
    + $childForkVM = New-InstantCloneVM -ParentVM $parentForkVM -Name vMtest
    -Confi …
    + ~~~~~~~~~~~~~
    + CategoryInfo : InvalidData: (:) [New-InstantCloneVM], Parameter BindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,VMware.VimAutomation.Extensions.InstantClone.Commands.NewInstantCloneVM

  4. is this working on vsphere 6.5? Why the instantclone cmdlets are not included in PowerCLI 6.5? I am running 6.5 and downloaded the extension (VMware.VimAutomation.Extensions_for_PCLI_65R1) but fails with this error:

    PowerCLI C:\> Enable-InstantCloneVM -vm $a -GuestUser administrator -GuestPassword password -PostCloneScript C:\pscript.bat

    Enable-InstantCloneVM : 1/9/2017 2:36:45 AM Enable-InstantCloneVM A general system error occurred: vix error codes =
    (1, 0).

    At line:1 char:1
    + Enable-InstantCloneVM -vm $a -GuestUser administrator -GuestPassword …
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : NotSpecified: (:) [Enable-InstantCloneVM], SystemError
    + FullyQualifiedErrorId : Client20_VmGuestServiceImpl_RunScriptInGuest_ViError,VMware.VimAutomation.Extensions.Ins

    Enable-InstantCloneVM : 1/9/2017 2:36:45 AM Enable-InstantCloneVM Object reference not set to an instance of an
    At line:1 char:1
    + Enable-InstantCloneVM -vm $a -GuestUser administrator -GuestPassword …
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo : NotSpecified: (:) [Enable-InstantCloneVM], VimException
    + FullyQualifiedErrorId : Core_BaseCmdlet_UnknownError,VMware.VimAutomation.Extensions.InstantClone.Commands.Enabl

    1. Hi albert I have encountered the same problem with you. Do you slove it now? I have no idea with it…

  5. Now the world is all on the mobile phone. There is no outing and none other entertainment. So in this Difficult era of World Pinoy TV is providing the Special Show of Pinoy Lambingan and Pinoy Tambayan.

Leave a Reply

Your email address will not be published. Required fields are marked *