PowerShell script exchange
Post Reply
nate_c16
Novice
Posts: 3
Liked: never
Joined: Dec 01, 2017 10:54 pm
Contact:

Post job script question

Post by nate_c16 »

Hello, I'm hoping someone can help me out.

So I have a job that runs a post job script that disables a backup job connects to another backup server and starts a replication. And even though the VM finishes backing up successfully, the action for the post job script says 'running.' And it goes until it times out.

Oddly enough the script will successfully finish when the replication on the remote server completes. Is there any reason as to why that's happening? I assumed that once the script is done running it's done running. Like it doesn't have to wait for the other job to finish.

This is what I have

Code: Select all

Add-PSSnapin veeampssnapin

Disable-VBRJob -Job 'BackupJob' | Out-Null
Disconnect-VBRServer
Connect-VBRServer -Server Remote-Server
Start-VBRJob -Job 'ReplicationJob' | Out-Null
Disconnect-VBRServer
veremin
Product Manager
Posts: 20389
Liked: 2298 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Post job script question

Post by veremin »

Try to use -RunAsync switch with Start-VBRJob cmdlet, so that the script does not wait till replication job finishes. Thanks.

Code: Select all

Start-VBRJob -Job 'ReplicationJob' -RunAsync
nate_c16
Novice
Posts: 3
Liked: never
Joined: Dec 01, 2017 10:54 pm
Contact:

Re: Post job script question

Post by nate_c16 »

That worked liked a charm! Thanks a bunch for the help!
veremin
Product Manager
Posts: 20389
Liked: 2298 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Post job script question

Post by veremin »

By default most of VB&R cmdlets return an output only after completion of the requested tasks.

If you want a cmdlet to return to the command line immediately, without waiting for the tasks to complete, you can specify the RunAsync parameter.

Good to know that everything is up and running now.

Thanks.
Post Reply

Who is online

Users browsing this forum: No registered users and 20 guests