VMware Cloud Community
VCPGuru
Contributor
Contributor
Jump to solution

Clone VM with powershell

Hi all, i have two quesitons:

1. how are you cloning today VMs with powershell (command)= ...?

2. are you having an errorhandling integrated, f.e. if a VM cloning fails you get an email alert?

Thank you in advance

Best Regards Simon Ciglia
0 Kudos
22 Replies
LucD
Leadership
Leadership
Jump to solution

Didn't notice the -Runasync on the New-VM cmdlet. In this case you can not use the pipeline.

Have a look at my About Async tasks, the Get-Task cmdlet and a hash table post.

It uses RunAsync and in line 16 you can see how the script starts the guest, provided the New-VM completes successfully.


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

0 Kudos
sOltanOBreens
Contributor
Contributor
Jump to solution

LucD, thank you, this works great!!

0 Kudos
DjinjiRinji
Enthusiast
Enthusiast
Jump to solution

Hi sOltanOBreens,

I am trying to implement a script with similar features.... Could you please share your last version to try it in my enviroment? Thanks for your help Smiley Happy

Kindly mark as solved if your questions are answered.
>>>>>
Guillermo R
LinkedIn: https://www.linkedin.com/in/gramallo
Web: http://bakingclouds.com/
0 Kudos