PowerShell to Clone VM’s

PowerShell to Clone VM’s

/ / /

I need to create a Provisioning Server of my own. We don’t want to purchase the software to do so and we may not need to do so… VMWare has PowerCLI which may provide enough to do the following:

1) Notify the VM that it needs to disable Citrix logins
2) Have the VM disable logins and then check for logins. If none are found kick-off the cloning process. Kick off consists of:
2a) Unjoin from the domain
2b) Shutdown
If users are still logged in, log them off forcefully at midnight and start the process
3) Use VMWare Templates to clone the VM with the VM name.
4) Shutdown original VM’s with the same names
5) Startup new VM’s and join to domain…


I have a script that does the cloning… I got it from this site:

I had issues with running it though. For some reason my PowerShell wouldn’t run it with the comments in it so I had to take them out:

You can run it with a command like so:

Get-VM MyVM | Clone-List

I will need to modify this script to see if I can use VMWare Templates (I think that’s the right terminology) and Citrix XA PowerShell to see if I can get this to work… We shall see 🙂

EDIT – It’s not VMWare Templates… It’s OSCustomizationSpec I think.

Post a Comment

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


This site uses Akismet to reduce spam. Learn how your comment data is processed.