Cheap disaster recovery

At the Dutch VMUG, together with my colleague Jos Vanaubel, I presented about how to do cheap disaster recovery using only PowerShell. At the London VMUG I held the same presentation again and promised to upload the scripts to my blog. Well, here it is in PDF format:

Cheap Disaster Recovery

The scripts can be downloaded by clicking this link -> Cheap Disaster Recovery Scripts

Before we can failover to DR site, we need the data from the production site. Therefore run the “preparation” scripts weekly or daily, depending on the number of changes. These are your backups. When failover needs to occur, first run failover step 1 and 2, then start the import section. Last step is to boot the vms in failover step 3.

Use the scripts in this order (in the zip file an Excel sheet is included with this info):

Nr Preparation: Script name
1 Export custom attributes at vCenter level export-01-attributes
2 Export resource pools export-02-resource-pools
3 Export resource pool – VM relation export-03-resource-pools-with-vms
4 Export folders export-04-folders
5 Export folders – VM relation export-05-vms-with-folderpath
6 Export roles and permissions export-06-roles-permissions-xml
7 Export notes from VMs export-07-vms-with-notes
8 Export custom attributes from VMs export-08-vms-with-attributes
Nr Failover: Script name
1 Stop all VMs on production site failover-01-stop-vms
2 Scan datastores for VMs failover-02-find-register-vms
Nr Import: Script name
1 Import custom attributes at vCenter level import-01-attributes
2 Import resource pools import-02-resource-pools
3 Move VMs to resource pools import-03-move-vms-resource-pools
4 Import folders import-04-folders
5 Move VMs to folders import-05-move-vms-folders
6 Import roles and permissions import-06-roles-permissions-xml
7 Import notes from VMs (skipped because included in VMX) n/a
8 Import custom attributes from VMs import-08-add-VM-attributes
Nr Failover: Script name
3 Start all VMs on DR site failover-03-start-vms

A special word of thanks to the guys who helped me with these scripts:
Alan Renouf – http://www.virtu-al.net
Luc Dekens – http://www.lucd.info/
Arnim van Lieshout – http://www.van-lieshout.com
Maish Saidel-Keesing – http://technodrone.blogspot.com/

If you have improvements or additions to the scripts, let me know, I’d be happy to post them here.

UPDATE:

Bjørn-Ove Kill found an error in the “export-06-roles-permissions-xml.ps1” script and was able to fix it. Since I can’t test all possible scenario’s in PowerShell combinations, I’m leaving the original script up and offer the simple fix here:

From his e-mail:

The script generated errors on line 64, 65 and 68 in the Attached script file (modified Your script – just one line needed to be modified to make it work).

At line 76 you have specified

[XML]$vInventory = “

I replaced that With this: $global:vInventory = 
“<Inventory><Roles/><Permissions/></Inventory>”

Thank you for your solution Bjørn-Ove !!! Visit his blog at http://www.auxilium.no/auxilium/blogg.