That should work. This script does the same, but is shorter:
@echo off
rasdial.exe entryname username password
for /l %%a in (1 1 20) do (
ping -n 2 127.0.0.1 > nul
if exist W:\. exit 0
)
echo iSCSI drive not mounted, backup aborted.
exit 5
Modify 20
in the for /l...
line to adjust the number of times the check is performed.
Modify 2
in the ping -n
line to set the wait time between checks.
Modify W:\.
to an existing path on your iSCSI drive.
If the path is found, the script exits and the backup will start.
If the path is not found after 20 attempts, the script exits with error level 5 and the backup aborts.