I have successfully set up a pre-scan command and it does what I want.
Now I also want it to output a line of information into any of the standard Commvault logs, so that it will appear when I right-click the job > View logs > For the job.
The command is simply a line of Windows CMD.exe instead of a script. This is for a NAS backup, using snapshots as the content source, and what the command does is find the most recent snapshot (a different pathname every time) and create a symbolic link to it (the same pathname every time).
But it would also be useful to record against the job, in Commvault logs, the name of the snapshot that was selected.
I tried adding a statement (echo “Using snapshot <snapshotname> for backup">&2) to see if it would get picked up, but what happened was the Pre-Scan phase hung and the command never completed.
Is there any file handle that the Commvault logger monitors on pre/post commands, or do I need to set up a custom logfile for this?
For anyone interested, the pre-scan command is:
C:\Windows\System32\cmd.exe /V:ON /C "(set NAS=\\mynas) & (set VOL=myvolume) & (for /F "usebackq" %S in (`dir /B /O:N %NAS%\%VOL%\.snapshot\%VOL%.????_??_??_00_0?`) do @set LASTSNAPSHOT=%S) && (mklink /D !NAS!\!VOL!\.backup_snapshot_link .snapshot\!LASTSNAPSHOT!)" /suppress
And the post-backup command is:
C:\Windows\System32\cmd.exe /C "rmdir \\mynas\myvolume\.backup_snapshot_link" /suppress