VMware Cloud Community
BaluVirigineni
Enthusiast
Enthusiast
Jump to solution

Can someone provide me a powercli script to mass clone a powered on vm and customize them.

Can someone provide me a Powercli script to mass clone a powered on vm and customize them.

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

And from where shall the script fetch that information ?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

0 Kudos
12 Replies
LucD
Leadership
Leadership
Jump to solution

Basically, you need the New-VM cmdlet with the VM and OSCustomizationSpec parameters.

It would help if you could give some details on what you want to do.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
BaluVirigineni
Enthusiast
Enthusiast
Jump to solution

I would like to create 20VMs by cloning a powered on VM, as we were cloning powered on vm we need to wait till the clone completes for one vm to proceed with other.

I need this to be done through powercli script, can you have a script meeting the above requirement.

0 Kudos
LucD
Leadership
Leadership
Jump to solution

What should the customization do ?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
BaluVirigineni
Enthusiast
Enthusiast
Jump to solution

Customiation should assign the IP, DNS,Hostnames to newly created VMs.

0 Kudos
LucD
Leadership
Leadership
Jump to solution

And from where shall the script fetch that information ?


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
BaluVirigineni
Enthusiast
Enthusiast
Jump to solution

From Excel sheet.

0 Kudos
LucD
Leadership
Leadership
Jump to solution

Have a look at Re: Create VM using PowerCLI and csv file

I think that more or less does what you envisage to do


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
BaluVirigineni
Enthusiast
Enthusiast
Jump to solution

The above script is used to clone vms from template, where as in my case I would like to clone a Powered VM and create multiple VMs.

0 Kudos
LucD
Leadership
Leadership
Jump to solution

Like I said earlier, you use the VM parameter in your case, and drop the Template parameter.

The rest should stay the same


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
BaluVirigineni
Enthusiast
Enthusiast
Jump to solution

Thanks Lucd for the update, I have one doubt regarding the script.

As we cant clone more than once a powered on VM, does the above script wait till the vm clone completes and proceed with next after it is done.

0 Kudos
LucD
Leadership
Leadership
Jump to solution

The script uses the RunAsync switch, that means that the cmdlet will come back immediately, while the clone process runs in the background.

There will be a limit on the number of active clones that can run, but that is imposed by your HW.


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

BaluVirigineni
Enthusiast
Enthusiast
Jump to solution

Thanks for the upfate LucD.. I am very much grateful to u..

0 Kudos