Microsoft Virtualization Discussions

Using PowerCLI with Flexclone rapidclone

jgriffin123
3,119 Views

Hi,

I have a PowerCLI script that allows me to clone Linux Vm's from a template and configure their customisations from a csv file. Creating 5 Vm's can take 50mins+..

We recently invested in FlexClone licensing with our NetApp and I'm wondering how/if I could update my script to use the rapidclone technology from NetApp instead of the  "CloneVM_Task" to clone the Vm's faster.

I would also like for the script to first check if a clone to be created (VMName from csv file) already exists and if so skip...

Here is my existing script

Connect-VIServer YOUR VCENTER

Import-CSV -path linuxvdi.csv | `

  ForEach-Object {

  Get-OSCustomizationSpec LinuxVDI | Get-OSCustomizationNicMapping | Set-OSCustomizationNicMapping -IpMode UseStaticIP -IPAddress $_.IpAddress -Subnetmask $_.SubnetMask -DefaultGateway$_.DefaultGateway

    New-VM -Name $_.VMName -VMHost $_.VMHost -Template $_.Template -Datastore $_.Datastore -Description $_.Description -OSCustomizationSpec LinuxVDI -RunAsync

      }

while (Get-Task -Status Running | where {$_.Name -eq "CloneVM_Task"}){sleep 10}

Get-Task -Status Success | where {$_.Name -eq "CloneVM_Task"} | %{(Get-View -Id$_.Result).PowerONVM($null)}

The Column heading's in my csv file are

VMName

VMHost

Template

Datastore

IPAddress

Subnetmask

DefaultGateway

Description

I installed the DataONTAP Toolkit but have used cmdlets like this before..

Any help is appreciated.

Thanks

Jason

1 REPLY 1

costea
3,119 Views

Hi Jason,

You can use the cmdlets here (https://communities.netapp.com/docs/DOC-11407) along with the VSC to create the clones for you.

-George

Public