PowerShell script exchange
Post Reply
karlbackups
Novice
Posts: 3
Liked: never
Joined: Mar 04, 2016 12:52 pm
Contact:

Script help

Post by karlbackups »

Hello,

I'm having difficulties setting up a custom script and was wondering, would anyone know how could I achieve below with one script?
Disable backup job.
Display status of this running job and keep updating its status every 15 seconds in powershell window
when backup finished or status changed to stopped, run another powershell script.

Thanks
veremin
Product Manager
Posts: 20415
Liked: 2302 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Script help

Post by veremin »

1) Check this cmdlet.
2), 3) Try this:

Code: Select all

$Job = Get-VBRJob -Name "Name of your job"
do {
$Job.FindLastSession().State
Start-Sleep -Seconds 15
} while ($Job.FindLastSession().State -ne "Stopped")
#Your next command
Thanks.
karlbackups
Novice
Posts: 3
Liked: never
Joined: Mar 04, 2016 12:52 pm
Contact:

Re: Script help

Post by karlbackups »

Thanks, that all worked, but I think argument was suppose to be "-ne" rather than "-eq"
veremin
Product Manager
Posts: 20415
Liked: 2302 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Script help

Post by veremin »

You're right indeed. Sometimes that happens when you're posting scripts created for testing purposes. :)

Updated the code already.
Post Reply

Who is online

Users browsing this forum: No registered users and 23 guests