Ok, I've got your script modification. A few things for you (and potentially anyone else who finds this thread later) to be aware of upfront:
- This modification assumes the definition file specifies a single destination by drive letter. Definition files that specify their destination by volume identifier and/or specify alternative destinations will not work properly. I could probably build support for that, but it would add more complication.
- If a backup job refuses to run because the wrong disk/cartridge is connected, the script will return an exit code that indicates an error. This means that if you call this script from a scheduled task, the "Last Run Result" will indicate an error. However, Reflect itself will not have a log entry for this failed job at all, and therefore if you have email notifications set up for job failures within Reflect, they will not be applied.
The reason is that this script stops Reflect from running at all if the wrong disk/cartridge is connected. That's necessary to achieve the desired outcome here because if Reflect were to start, it would run the backup job, since it doesn't have a concept of right vs. wrong disk. You could however extend the script itself to generate an email notification (or take other action) if it quits due to having the wrong disk attached.
If you're ok to proceed, here's what to do:
1. If you haven't already, create a definition file for your job.
2. In Reflect, go to the Backup Definition Files tab, right-click your definition file, and select "Generate a PowerShell script file". Make any desired selections in the wizard dialog (though none are required for this), then click OK.
3. Still in Reflect, go to the "PowerShell Files" tab, right-click your new script, and select Edit.
4. Take the contents of the attached Before-Main.txt file and paste them into your script immediately above
the line near the end of the script that reads: "# Execute the Main function"
5. Underneath the line that reads "Main;", add a close brace/curly bracket character -- } -- in order to complete the "Else" statement begun by the content you just pasted in above. Having the "Main" function inside the Else block means the backup will now run only if the expected disk is attached.
6. In the switch block at the top of the content you pasted in, change the $ExpectedVolName values for each day to the labels you'll be using for each disk.
7. Now make sure that your schedules, desktop shortcuts, and any manual job executions are associated with this new script, not the original definition file. To do that, go to the PowerShell Files tab, right-click your script, and select Schedule and/or Create Desktop Shortcut to create your new items. If you've been using scheduled backups, the last step is to go to the Backup Definition Files tab and remove your original schedule entries from the definition file. And whenever you want to run a backup manually, right-click the script rather than the definition file and select Run Now.
8. If you want to test your script manually and interactively to make sure it fails when it should and still runs when it should, open PowerShell Console with elevated privileges and try running it from there. If you've never used PowerShell before, PowerShell scripts have to be called by entering the syntax of .\MyScript.ps1 as opposed to batch files in Command Prompt where you can just enter "MyScript".