![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
br> br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| Guest | PowerShell Script for Distaster Recovery Hello all -- I'm trying to create a DR script for restoring our ESX images using Vizioncore's esxRanger product. I have the below script hardcoded in a BAT file but was looking for a way to make the script more dymanic. Basically, many of the command-line options could change depending on the server image being restored. Items such as VLAN for network cards, LUN name on SAN, source path of backup image, etc. Initially, I was thinking that I'd like to put this in an XML file and have a node by server with all the standard items that I could pull. I know I could just leave the below in a BAT file and just do a search/replace when things change, but what fun would that be? Any help or insight would be appreciated. "C:\Program Files\vizioncore\esxRanger Professional\esxRangerProCli.exe -restore -local X:\ESX\20080223\VMECOM03\VMECOM03_1.tvzc.info -forcepoweroff -restoreconfig -registervm -destserver dresx01.mke.fiserv.net -destvmfs "VM's Configuration,SRVVASTDISK3;VMECOM03_1-flat.vmdk,SRVVASTDISK3;VMECOM03_2-flat.vmdk,SRVVASTDISK3;" -networkname ethernet0,DRVLAN249;ethernet1,DRVLAN254; -temp VMECOM03 "C:\Program Files\vizioncore\esxRanger Professional\esxRangerProCli.exe -restore -local Y:\ESX\20080223\VMECOM07\VMECOM07_4.tvzc.info -forcepoweroff -restoreconfig -registervm -destserver dresx01.mke.fiserv.net -destvmfs "VM's Configuration,SRVVASTDISK3;VMECOM07-flat.vmdk,SRVVASTDISK3;VMECOM07_1-flat.vmdk,SRVVASTDISK3;" -networkname ethernet0,DRVLAN249;ethernet1,DRVLAN500; -temp VMECOM07 "C:\Program Files\vizioncore\esxRanger Professional\esxRangerProCli.exe -restore -local Z:\ESX\20080223\VMECORP01\VMECORP01_4.tvzc.info -forcepoweroff -restoreconfig -registervm -destserver dresx01.mke.fiserv.net -destvmfs "VM's Configuration,SRVVASTDISK4;VMECORP01-flat.vmdk,SRVVASTDISK4;VMECORP01_1-flat.vmdk,SRVVASTDISK4;" -networkname ethernet0,DRVLAN249;ethernet1,DRVLAN500; -restoreas VMECORP01 "C:\Program Files\vizioncore\esxRanger Professional\esxRangerProCli.exe -restore -local W:\ESX\20080223\VMECORP02\VMECORP02_4.tvzc.info -forcepoweroff -restoreconfig -registervm -destserver dresx01.mke.fiserv.net -destvmfs "VM's Configuration,SRVVASTDISK1;VMECORP02-flat.vmdk,SRVVASTDISK1;VMECORP02_1-flat.vmdk,SRVVASTDISK1;" -networkname ethernet0,DRVLAN249;ethernet1,DRVLAN500; -temp VMECORP02 "C:\Program Files\vizioncore\esxRanger Professional\esxRangerProCli.exe -restore -local W:\ESX\20080223\VMECORP04\VMECORP04_4.tvzc.info -forcepoweroff -restoreconfig -registervm -destserver dresx01.mke.fiserv.net -destvmfs "VM's Configuration,SRVVASTDISK1;VMECORP04-flat.vmdk,SRVVASTDISK1;VMECORP04_1-flat.vmdk,SRVVASTDISK1;" -networkname ethernet0,DRVLAN249;ethernet1,DRVLAN500; -temp VMECORP04 "C:\Program Files\vizioncore\esxRanger Professional\esxRangerProCli.exe -restore -local W:\ESX\20080309\VMIMSAPP01\VMIMSAPP01_2.tvzc.info -forcepoweroff -restoreconfig -registervm -destserver dresx01.mke.fiserv.net -destvmfs "VM's Configuration,SRVVASTDISK3;VMIMSAPP01-flat.vmdk,SRVVASTDISK3;VMIMSAPP01_1-flat.vmdk,SRVVASTDISK3;" -networkname ethernet0,DRVLAN16;ethernet1,DRVLAN254; -temp VMIMSAPP01 "C:\Program Files\vizioncore\esxRanger Professional\esxRangerProCli.exe -restore -local W:\ESX\20080219\VMDMZAD01\VMADDMZ01_3.tvzc.info -forcepoweroff -restoreconfig -registervm -destserver dresx01.mke.fiserv.net -destvmfs "VM's Configuration,SRVVASTDISK3;VMADDMZ01-flat.vmdk,SRVVASTDISK3;" -networkname ethernet0,DRVLAN249; -temp VMDMZAD01 "C:\Program Files\vizioncore\esxRanger Professional\esxRangerProCli.exe -restore -local Z:\ESX\20080220\VMNAV01\VMNAV01_3.tvzc.info -forcepoweroff -restoreconfig -registervm -destserver dresx01.mke.fiserv.net -destvmfs "VM's Configuration,SRVVASTDISK3;VMNAV01-flat.vmdk,SRVVASTDISK3;VMNAV01_1-flat.vmdk,SRVVASTDISK3;" -networkname ethernet0,DRVLAN16;ethernet1,DRVLAN254; -temp VMNAV01 "C:\Program Files\vizioncore\esxRanger Professional\esxRangerProCli.exe -restore -local Z:\ESX\20080220\VMNAV02\VMNAV02_3.tvzc.info -forcepoweroff -restoreconfig -registervm -temp VMNAV02 -destserver dresx01.mke.fiserv.net -destvmfs "VM's Configuration,SRVVASTDISK3;VMNAV02-flat.vmdk,SRVVASTDISK3;VMNAV02_1-flat.vmdk,SRVVASTDISK3;" -networkname ethernet0,DRVLAN16;ethernet1,DRVLAN254; "C:\Program Files\vizioncore\esxRanger Professional\esxRangerProCli.exe -restore -local W:\ESX\20080220\VMNAV04\VMNAV04_3.tvzc.info -forcepoweroff -restoreconfig -registervm -destserver dresx01.mke.fiserv.net -destvmfs "VM's Configuration,SRVVASTDISK3;VMNAV04-flat.vmdk,SRVVASTDISK3;VMNAV04_1-flat.vmdk,SRVVASTDISK3;" -networkname ethernet0,DRVLAN16;ethernet1,DRVLAN254; -temp VMNAV04 "C:\Program Files\vizioncore\esxRanger Professional\esxRangerProCli.exe -restore -local W:\ESX\20080220\VMNAV05\VMNAV05_3.tvzc.info -forcepoweroff -restoreconfig -registervm -destserver dresx01.mke.fiserv.net -destvmfs "VM's Configuration,SRVVASTDISK1;VMNAV05-flat.vmdk,SRVVASTDISK1;VMNAV05_1-flat.vmdk,SRVVASTDISK1;" -networkname ethernet0,DRVLAN16;ethernet1,DRVLAN254; -temp VMNAV05 "C:\Program Files\vizioncore\esxRanger Professional\esxRangerProCli.exe -restore -local W:\ESX\20080310\VMNAV06\VMNAV06_2.tvzc.info -forcepoweroff -restoreconfig -registervm -destserver dresx01.mke.fiserv.net -destvmfs "VM's Configuration,SRVVASTDISK1;VMNAV06-flat.vmdk,SRVVASTDISK1;VMNAV06_1-flat.vmdk,SRVVASTDISK1;" -networkname ethernet0,DRVLAN16;ethernet1,DRVLAN254; -temp VMNAV06 "C:\Program Files\vizioncore\esxRanger Professional\esxRangerProCli.exe -restore -local Z:\ESX\20080222\VMNAV07\VMNAV07_4.tvzc.info -forcepoweroff -restoreconfig -registervm -destserver dresx01.mke.fiserv.net -destvmfs "VM's Configuration,SRVVASTDISK2;VMNAV07-flat.vmdk,SRVVASTDISK2;VMNAV07_1-flat.vmdk,SRVVASTDISK2;" -networkname ethernet0,DRVLAN16;ethernet1,DRVLAN254; -temp VMNAV07 "C:\Program Files\vizioncore\esxRanger Professional\esxRangerProCli.exe -restore -local W:\ESX\20080310\VMNAV08\VMNAV08_2.tvzc.info -forcepoweroff -restoreconfig -registervm -destserver dresx01.mke.fiserv.net -destvmfs "VM's Configuration,SRVVASTDISK1;VMNAV08-flat.vmdk,SRVVASTDISK1;VMNAV08_1-flat.vmdk,SRVVASTDISK1;" -networkname ethernet0,DRVLAN16;ethernet1,DRVLAN254; -temp VMNAV08 "C:\Program Files\vizioncore\esxRanger Professional\esxRangerProCli.exe -restore -local W:\ESX\20080305\VMDNSDMZ01\VMDNSDMZ01_1.tvzc.info -forcepoweroff -restoreconfig -registervm -destserver dresx01.mke.fiserv.net -destvmfs "VM's Configuration,SRVVASTDISK1;VMDNSDMZ01_1-flat.vmdk,SRVVASTDISK1;" -networkname ethernet0,DRVLAN249;ethernet1,DRVLAN500; -temp VMDNSDMZ01 "C:\Program Files\vizioncore\esxRanger Professional\esxRangerProCli.exe -restore -local W:\ESX\20080219\VMDMZAD02\VMADDMZ02_3.tvzc.info -forcepoweroff -restoreconfig -registervm -destserver dresx01.mke.fiserv.net -destvmfs "VM's Configuration,SRVVASTDISK4;VMADDMZ02-flat.vmdk,SRVVASTDISK4;" -networkname ethernet0,DRVLAN249; -temp VMDNSDMZ02 "C:\Program Files\vizioncore\esxRanger Professional\esxRangerProCli.exe -restore -local W:\ESX\20080219\VMWEB01\VMWEB01_3.tvzc.info -forcepoweroff -restoreconfig -registervm -destserver dresx01.mke.fiserv.net -destvmfs "VM's Configuration,SRVVASTDISK3;VMWEB01-flat.vmdk,SRVVASTDISK3;" -networkname ethernet0,DRVLAN249;ethernet1,DRVLAN500; -temp VMWEB01 "C:\Program Files\vizioncore\esxRanger Professional\esxRangerProCli.exe -restore -local W:\ESX\20080305\VMDNSDMZ01\VMDNSDMZ01_1.tvzc.info -forcepoweroff -restoreconfig -registervm -destserver dresx01.mke.fiserv.net -destvmfs "VM's Configuration,SRVVASTDISK1;VMDNSDMZ01_1-flat.vmdk,SRVVASTDISK1;" -networkname ethernet0,DRVLAN249;ethernet1,DRVLAN500; -temp VMDNSDMZ01 |
| | #2 (permalink) | ||||||||||||||||||||||||||||||||||||
| Guest | Re: PowerShell Script for Distaster Recovery dm3281 wrote:
little to do with this particular scenario (mostly because you're using a third party tool), but you will love it I'm sure.
datasource simply because the editing is moderately annoying. If you've got a schema in mind, post that and we can give you a concrete example. Otherwise, I'd stick to spreadsheets or flat text files for now. For the record, XML in Posh is this easy (example file is an NMAP scan): PS> [xml]$data = get-content $xmlfile PS> $data xml xml-stylesheet #comment nmaprun --- -------------- -------- ------- version="1.0" href="nmap.xsl" typ... Nmap 4.21ALPHA4 sc... nmaprun PS> $data.nmaprun verbose : verbose scanner : nmap runstats : runstats taskprogress : taskprogress scaninfo : scaninfo startstr : Thu Oct 25 14:12:13 2007 args : C:\Program Files\Nmap\nmap.exe -oX file.xml 192.168.0.4 host : host debugging : debugging start : 1193335933 version : 4.21ALPHA4 xmloutputversion : 1.01
![]() Send me your email address in email or twitter (http://twitter.com/halr9000) and I'll send you a script privately (that I'm not allowed to publish widely). this script reads stuff from a flat file in a manner similar to what you'd need to do. -- Author, Tech Prosaic blog (http://halr9000.com) Webmaster, Psi (http://psi-im.org) Community Director, PowerShellCommunity.org Co-host, PowerScripting Podcast (http://powerscripting.net) | ||||||||||||||||||||||||||||||||||||
| |
| |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Powershell script help | Tboz | PowerShell | 3 | 4 Weeks Ago 08:58 AM |
| when run powershell script as windows service ,powershell fail | powershell fail on winodws 2008 | PowerShell | 6 | 01-15-2008 03:20 PM |
| PowerShell and Script Configs | dm3281 | PowerShell | 4 | 12-19-2007 08:53 PM |
| Has anyone used Powershell to script WSUS? | Bob Landau | PowerShell | 4 | 12-10-2007 02:01 PM |
| PowerShell script using PowerSMO | Marco Shaw | PowerShell | 0 | 09-25-2007 08:06 AM |