Data Backup and Recovery

SMVI Backup DOS Script

BEStorageAdmin
3,361 Views

Hello,
I am trying to set up a pre_backup SMVI script that connects to the SnapDrive service on the target machine(s) but I'm getting hung up parsing the VIRTUAL_MACHINE.# variable in DOS. Does anyone have this figured out and want to share?

I don't suppose there's a Powershell library for SDCLI?
Thanks

 

set LoopCount=1

set retention=5
set path=%path%;"C:\Program Files\NetApp\SnapDrive"

 

REM Inherits BACKUP_PHASE=PRE_BACKUP, VIRTUAL_MACHINES=2, VIRTUAL_MACHINE.1,2,...

 

if %BACKUP_PHASE% NEQ PRE_BACKUP goto out
if %VIRTUAL_MACHINES% LSS 1 goto out


:StartMachine

  set handle=
  set PowerStatus=
  set mounts=
  set c=1
  set ThisHost=VIRTUAL_MACHINE.%LoopCount%


FOR /f "tokens=1,2,3 delims=|" %%G IN (%ThisHost%) DO @set PowerStatus=%%I

If %PowerStatus% NEQ POWERED_ON goto out

 

FOR /F "tokens=1 delims=|" %%G IN (%ThisHost%) DO set ComputerNM=%%G

 

 

2 REPLIES 2

BEStorageAdmin
3,321 Views

So since array handling in DOS is problematic, I bounce the variables out to a text file and can parse them on the way back.  Not the best but it's working.

Powershell would have been an option as well but it would be endless shelling back and forth to PS and DOS.

Public