I created a bat file to launch this powershell script - this Script you provided with a little tweaking WORKS when i run it outside of Veeam (run as administrator on the bat file) - obviously doent grab any veeam job details running outside of veeam but it does grab the currently connected USB drive name and also successfully fires off an email.
However when i tell the veeam job to execute this BAT file......the job runs ans shows that it 'executed script successfully'......however no result/email comes from the scrip when veeam runs it.
I also tried this construct for the bat file (https://www.veeam.com/kb2183
) but that does not get it working.
i added the error output to a txt file as in the above article but that just resulted in an empty txt file so assuming no errors are being reported.
Anyone know how to get veeam to run this script as 'run as administrator' - or any other ideas why this script works when run manually, but not when you ask veeam to run it?