PowerShell script exchange
Post Reply
lewch
Novice
Posts: 3
Liked: never
Joined: Jun 28, 2017 3:27 pm
Full Name: Chris Lewis
Contact:

Post-Job Script to disconnect repository

Post by lewch »

I have a simple post-job powershell script to detect running jobs. If there are jobs running, end, otherwise disconnect the iSCSI network connection.

Code: Select all

asnp "VeeamPSSnapIn" -ErrorAction SilentlyContinue
$active_sessions = Get-VBRBackupSession | ?{$_.State -eq "Working"} | Sort JobName, Name
if (!$active_sessions) { Disable-NetAdapter iSCSI -Confirm:$false}
I did some testing and it appeared to work. But last night, there were two jobs running, one ended first and disconnected the storage repository connection and caused the second job to fail midway. Now I can't re-run the job because I get the error "Error: '.', hexadecimal value 0x00, is an invalid character. Line 1, position 1."

What am I missing?
veremin
Product Manager
Posts: 20284
Liked: 2258 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Post-Job Script to disconnect repository

Post by veremin »

The last restore point might have become corrupted and you might need need to delete it first before proceeding further. Open a support ticket and let them confirm that. Thanks.
lewch
Novice
Posts: 3
Liked: never
Joined: Jun 28, 2017 3:27 pm
Full Name: Chris Lewis
Contact:

Re: Post-Job Script to disconnect repository

Post by lewch »

Eremin,

I will open a ticket about the corrupt backup.

Any thoughts on the Powershell script for detecting running jobs? In testing, it works great. But in production, it fails...
veremin
Product Manager
Posts: 20284
Liked: 2258 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Post-Job Script to disconnect repository

Post by veremin »

Chances are .State property had a different value at the time of script execution: "starting" or similar. Thus, the script proceeded further and disconnected the backup storage. Thanks.
Post Reply

Who is online

Users browsing this forum: Semrush [Bot] and 17 guests