Script to copy App Volumes AppStacks to another datastore

Script to copy App Volumes AppStacks to another datastore

Like most IT guys i like to reduce the amount of repeating work where possible.
At a customer we build a VDI/Workspace One staging environment where VDI/RDS templates are build, tested and updated. Also all VMware App Volumes AppStacks are created on this platform.
When the AppStacks are ready for production you want to be able to copy these to the Production storage for App Volumes. For this, there is no proper solution.. Either stack those AppStacks again or get them transported with the fling and Veeam. Both of these solutions are time consuming and try explaining this to the support staff.

To make life more easy, I wrote a PowerShell script to properly copy App Volumes AppStacks and it’s metadata from the source datastore to any (shared) datastore.
Yes this includes from VSAN! Where you needed to fling and Veeam before to get your AppStacks to your production environment.
Manually copying these files via SSH is an option but time consuming. Copying the AppStacks from a VSAN via the Datastore browser will even end you up with CrapStacks (Broken AppStacks because something with a .flat file and some VSAN headers that are missing)

The template script i wrote can be downloaded below and requires VMware PowerCLI.
#v1 Added metadata copy option (Download)
#v2 merged metadata copy with AppStack copy. (Download)
#v3 made script variable, only need to change 3 parts. vCenter Server, Source Datastore and Destination Datastore. (Download)

#1. Change vCenter Address and account. (can be multiple vCenter but untested)
#2. Change paths to your source and target datastores. (Source staging App Volumes Datastore and target Production Datastore)
#3. No Support, know what you are doing and change whatever you like to suit your needs.

Current options build in:

“Press ‘1’ To Connect to Staging vCenter.” (Connect to source vCenter)
“Press ‘2’ To List AppStacks Staging.” (List current AppStacks on source datastore)
“Press ‘3’ To List AppStacks Production.” (List current AppStacks on destination datastore)
“Press ‘4’ To Copy AppStacks to Production.” (Copy AppStacks and matching metadata to destination datastore)
“Press ‘5’ To Copy AppStack Metadata to Production.” (Copy Metadata to destination datastore)
“Press ‘6’ To Backup AppStacks.” (Copy all AppStacks to a backup datastore, be aware no metadata is copied along. working on this)
“Press ‘Q’ To Quit.”

After Copying your AppStacks and Metadata to the target datastore import them on your production App Volumes Manager.
Presto, Your AppStacks are now available on your Productions environment with the corresponding metadata! No legacy status

Source: Script to copy App Volumes AppStacks to another datastore - vDrone

Tags (1)
Version history
Revision #:
1 of 1
Last update:
‎06-07-2017 12:46 PM
Updated by: