With PS get latsetresult

PowerShell script exchange

With PS get latsetresult

Veeam Logoby Markol » Fri Nov 28, 2014 9:05 am

Hi all,

I'm trying to get this to work for me.

Thinking like this..

Code: Select all
$sendmail =$False
(get-vbrjob -name backupjob_name).GetLastResult()

if ($GetLastResult -eq $Fail )
{
$Sendmail=$True
}

if ($sendmail -eq $True {

My email function

}
Markol
Enthusiast
 
Posts: 26
Liked: 2 times
Joined: Fri Apr 20, 2012 12:12 pm
Full Name: Marko Lehto

Re: With PS get latsetresult

Veeam Logoby v.Eremin » Fri Nov 28, 2014 9:08 am

It seems that you need something like this, right? Thanks.
v.Eremin
Veeam Software
 
Posts: 13291
Liked: 973 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: With PS get latsetresult

Veeam Logoby Markol » Fri Nov 28, 2014 9:20 am

v.Eremin wrote:It seems that you need something like this, right? Thanks.



aa thanks alot v.Eremin. hmm then I was not that faraway of solving it my self... haha just a few rows =)
Markol
Enthusiast
 
Posts: 26
Liked: 2 times
Joined: Fri Apr 20, 2012 12:12 pm
Full Name: Marko Lehto

Re: With PS get latsetresult

Veeam Logoby v.Eremin » Fri Nov 28, 2014 9:24 am

Yep, the missing part was assigning either job or its result to a variable. Thanks.
v.Eremin
Veeam Software
 
Posts: 13291
Liked: 973 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: With PS get latsetresult

Veeam Logoby Markol » Tue Dec 09, 2014 1:30 pm

Sorry, but I need to wake up this post again..

How can I get the lastresult into a variable?

Code: Select all
$Job = Get-VBRJob -name "Name of your job"
If ($job.GetLastresult() -eq "Warning" -or $job.GetLastresult() -eq "Success")
{
write-host "The backup $job did not go so well, it ended up in (???$job.GetLastresult())
}
Markol
Enthusiast
 
Posts: 26
Liked: 2 times
Joined: Fri Apr 20, 2012 12:12 pm
Full Name: Marko Lehto

Re: With PS get latsetresult

Veeam Logoby v.Eremin » Tue Dec 09, 2014 8:09 pm

The script referenced by you should work as expected. My point was that you had to assign either Job or its result to a variable and then make a comparison ("if" portion). Thanks.
v.Eremin
Veeam Software
 
Posts: 13291
Liked: 973 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: With PS get latsetresult

Veeam Logoby Markol » Wed Dec 10, 2014 11:39 am 1 person likes this post

aa now the coin fell down =)

Thanks a lot v.Eremin
Markol
Enthusiast
 
Posts: 26
Liked: 2 times
Joined: Fri Apr 20, 2012 12:12 pm
Full Name: Marko Lehto

Re: With PS get latsetresult

Veeam Logoby v.Eremin » Wed Dec 10, 2014 5:36 pm

No problem. Feel free to reach us, should other help be needed. Thanks.
v.Eremin
Veeam Software
 
Posts: 13291
Liked: 973 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 5 guests