2014-12-16 01:19 PM
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?
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
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
2014-12-22 02:40 PM
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.