Script help

PowerShell script exchange

Script help

Veeam Logoby karlbackups » Fri Mar 04, 2016 12:59 pm

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
karlbackups
Lurker
 
Posts: 2
Liked: never
Joined: Fri Mar 04, 2016 12:52 pm

Re: Script help

Veeam Logoby v.Eremin » Fri Mar 04, 2016 1:43 pm

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.
v.Eremin
Veeam Software
 
Posts: 13255
Liked: 968 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: Script help

Veeam Logoby karlbackups » Fri Mar 04, 2016 2:30 pm

Thanks, that all worked, but I think argument was suppose to be "-ne" rather than "-eq"
karlbackups
Lurker
 
Posts: 2
Liked: never
Joined: Fri Mar 04, 2016 12:52 pm

Re: Script help

Veeam Logoby v.Eremin » Fri Mar 04, 2016 3:54 pm

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

Updated the code already.
v.Eremin
Veeam Software
 
Posts: 13255
Liked: 968 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin


Return to PowerShell



Who is online

Users browsing this forum: Yahoo [Bot] and 13 guests