Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

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.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > PowerShell

PowerShell Script for Distaster Recovery

Closed Thread
 
Thread Tools Display Modes
Old 06-30-2008   #1 (permalink)
dm3281
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

Old 07-01-2008   #2 (permalink)
Hal Rottenberg
Guest


 

Re: PowerShell Script for Distaster Recovery

dm3281 wrote:
Quote:

> 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
#1, you need to grab the VI toolkit at http://vmware.com/go/powershell. Has
little to do with this particular scenario (mostly because you're using a third
party tool), but you will love it I'm sure.
Quote:

> 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.
Powershell is pretty handy with XML, but most people don't like to use it as a
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
Quote:

> 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?
No fun at all.

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)
Closed Thread

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








Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50