-
- Enthusiast
- Posts: 27
- Liked: 2 times
- Joined: Oct 23, 2014 3:39 pm
- Full Name: Dan Nordquist
- Contact:
how to translate TargetHostID to the guest server name?
I'm using powershell to GetLastResult for veeam jobs that have failed or warning status, but the result only gives me a binary hash for the guest server. How do I get the actual name of the server, and if possible, how do I return the failure or warning message with powershell?
Anyone know how to do this?
Thank you,
Dan
Anyone know how to do this?
Thank you,
Dan
-
- Product Manager
- Posts: 20413
- Liked: 2301 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: how to translate TargetHostID to the guest server name?
Hi, Dan,
Kindly, try the following script:
Thanks.
Kindly, try the following script:
Code: Select all
$Job = Get-VBRJob -name "Name of your Job"
$LastSession = $Job.FindLastSession()
$LastSession | Get-VBRTaskSession | ?{$_.status -eq "Failed"} | select name
-
- Enthusiast
- Posts: 27
- Liked: 2 times
- Joined: Oct 23, 2014 3:39 pm
- Full Name: Dan Nordquist
- Contact:
Re: how to translate TargetHostID to the guest server name?
Excellent! That's perfect. Thank you.
-
- Enthusiast
- Posts: 27
- Liked: 2 times
- Joined: Oct 23, 2014 3:39 pm
- Full Name: Dan Nordquist
- Contact:
Re: how to translate TargetHostID to the guest server name?
Any advice on how to pull the warning/error message text?
-
- Product Manager
- Posts: 20413
- Liked: 2301 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: how to translate TargetHostID to the guest server name?
You can get text strings from the latest task session, using the following script. The error message should be there:
Thanks.
Code: Select all
$LastSession.Logger.GetLog().updatedrecords | sort starttime | select title
-
- Enthusiast
- Posts: 27
- Liked: 2 times
- Joined: Oct 23, 2014 3:39 pm
- Full Name: Dan Nordquist
- Contact:
Re: how to translate TargetHostID to the guest server name?
That gives me "Job finished with warning at 11/9/2014" but it's the details of the warning I'm looking for
-
- Product Manager
- Posts: 20413
- Liked: 2301 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: how to translate TargetHostID to the guest server name?
What about querying Task sessions, then:
Thanks.
Code: Select all
$TaskSession = $LastSession | Get-VBRTaskSession
$TaskSession.Logger.GetLog().updatedrecords | sort starttime | select title
-
- Enthusiast
- Posts: 27
- Liked: 2 times
- Joined: Oct 23, 2014 3:39 pm
- Full Name: Dan Nordquist
- Contact:
Re: how to translate TargetHostID to the guest server name?
$Job = Get-VBRJob -name "Tier4d-MD-VM1"
$LastSession = $Job.FindLastSession()
$LastSession | Get-VBRTaskSession | ?{$_.status -eq "Warning"} | select name
Name
----
server01
$TaskSession = $LastSession | Get-VBRTaskSession
$TaskSession.Logger.GetLog().updatedrecords | sort starttime | select title
You cannot call a method on a null-valued expression.
At line:1 char:27
+ $TaskSession.Logger.GetLog <<<< ().updatedrecords | sort starttime | select title
+ CategoryInfo : InvalidOperation: (GetLog:String) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
$LastSession = $Job.FindLastSession()
$LastSession | Get-VBRTaskSession | ?{$_.status -eq "Warning"} | select name
Name
----
server01
$TaskSession = $LastSession | Get-VBRTaskSession
$TaskSession.Logger.GetLog().updatedrecords | sort starttime | select title
You cannot call a method on a null-valued expression.
At line:1 char:27
+ $TaskSession.Logger.GetLog <<<< ().updatedrecords | sort starttime | select title
+ CategoryInfo : InvalidOperation: (GetLog:String) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
-
- Enthusiast
- Posts: 27
- Liked: 2 times
- Joined: Oct 23, 2014 3:39 pm
- Full Name: Dan Nordquist
- Contact:
Re: how to translate TargetHostID to the guest server name?
Any idea why I'm getting the null error?
Thank you!
Thank you!
-
- Product Manager
- Posts: 20413
- Liked: 2301 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: how to translate TargetHostID to the guest server name?
I've just tried the script and everything seems to have worked properly. Does $TaskSession contain something in your case? Can you just input it and see whether it returns something or not? Thanks.
-
- Enthusiast
- Posts: 27
- Liked: 2 times
- Joined: Oct 23, 2014 3:39 pm
- Full Name: Dan Nordquist
- Contact:
Re: how to translate TargetHostID to the guest server name?
Yes, when I input $TaskSession it returns a list of all the guest server sessions, but the "$TaskSession.Logger.GetLog().updatedrecords | sort starttime | select title" command still returns the null-value error.
-
- Product Manager
- Posts: 20413
- Liked: 2301 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: how to translate TargetHostID to the guest server name?
If $TaskSession contains a list of sessions, try to access just one session that has a problematic VM:
Thanks.
Code: Select all
$TaskSession = $LastSession | Get-VBRTaskSession | where {$_.name -eq "Name of problematic VM"}
$TaskSession.Logger.GetLog().updatedrecords | sort starttime | select title
-
- Enthusiast
- Posts: 27
- Liked: 2 times
- Joined: Oct 23, 2014 3:39 pm
- Full Name: Dan Nordquist
- Contact:
Re: how to translate TargetHostID to the guest server name?
Ok, yes, thank you. I can work with that. It returns the details for that vm. Thank you very much!
-
- Enthusiast
- Posts: 27
- Liked: 2 times
- Joined: Oct 23, 2014 3:39 pm
- Full Name: Dan Nordquist
- Contact:
Re: how to translate TargetHostID to the guest server name?
Hey Vladimir, quick question... I've been searching the documentation and looking through returned data with different commands and I can't find where to discover if the running job is an incremental or a full. Can you help? Thank you.
-
- Product Manager
- Posts: 20413
- Liked: 2301 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: how to translate TargetHostID to the guest server name?
The backup session should have a parameter indicating session type. If my memory serves me well, the parameter is called .IsFullMode:
Thanks.
Code: Select all
$LastSession.IsFullMode
-
- Enthusiast
- Posts: 27
- Liked: 2 times
- Joined: Oct 23, 2014 3:39 pm
- Full Name: Dan Nordquist
- Contact:
Re: how to translate TargetHostID to the guest server name?
you are THE MAN! Yep, that returns a bool... thank you!
-
- Enthusiast
- Posts: 27
- Liked: 2 times
- Joined: Oct 23, 2014 3:39 pm
- Full Name: Dan Nordquist
- Contact:
Re: how to translate TargetHostID to the guest server name?
Another quick question if you don't mind. The veeam jobs sometimes report warnings on the job itself while all the server backups have successfully completed, like this one, "Backup location "E:\Veeam\Backups" is getting low on free disk space (757.3 GB left of 7.3 TB)."
Can you suggest a way to pull the details of that warning?
Also, I am going to post the code I have to share with the forum in a following post. This is so people can use the script you have taught me and improve upon it if they so desire.
Thanks for all your help!
Dan
Can you suggest a way to pull the details of that warning?
Also, I am going to post the code I have to share with the forum in a following post. This is so people can use the script you have taught me and improve upon it if they so desire.
Thanks for all your help!
Dan
-
- Veeam Software
- Posts: 649
- Liked: 170 times
- Joined: Dec 10, 2012 8:44 am
- Full Name: Nikita Efes
- Contact:
Re: how to translate TargetHostID to the guest server name?
Here is the code I use in testing, may require some improvements:
Code: Select all
$session = (Get-VSBSession -Name $jobName | Sort-Object StartTime -Descending)[0] # I use it in SureBackup, use corresponding commandlet to search your type of session
$warnings = $session.Logger.GetLog().UpdatedRecords | ?{$_.Status -eq "EWarning"} | Sort-Object UpdateTime | Select -ExpandProperty Title
$fails = $session.Logger.GetLog().UpdatedRecords | ?{$_.Status -eq "EFailed"} | Sort-Object UpdateTime | Select -ExpandProperty Title
-
- Enthusiast
- Posts: 27
- Liked: 2 times
- Joined: Oct 23, 2014 3:39 pm
- Full Name: Dan Nordquist
- Contact:
Re: how to translate TargetHostID to the guest server name?
Thanks nefes, I'll play with that.
-
- Enthusiast
- Posts: 27
- Liked: 2 times
- Joined: Oct 23, 2014 3:39 pm
- Full Name: Dan Nordquist
- Contact:
Re: how to translate TargetHostID to the guest server name?
Can't get that script to work, nefes. I'm a C# expert but not a PS expert so I don't know how to fix the errors I'm getting. I sure am learning PS quickly, though! haha
Vladimir, do you have any suggestions for me, to get the job failure when it's not associated with a server, like the disk space warning above?
Thanks!
Vladimir, do you have any suggestions for me, to get the job failure when it's not associated with a server, like the disk space warning above?
Thanks!
-
- Product Manager
- Posts: 20413
- Liked: 2301 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: how to translate TargetHostID to the guest server name?
Don't those warnings show up, if you query backup sessions, like I've described previously? Thanks.
-
- Enthusiast
- Posts: 27
- Liked: 2 times
- Joined: Oct 23, 2014 3:39 pm
- Full Name: Dan Nordquist
- Contact:
Re: how to translate TargetHostID to the guest server name?
I'll see if I can figure it out based on your previous scripts.
-
- Enthusiast
- Posts: 27
- Liked: 2 times
- Joined: Oct 23, 2014 3:39 pm
- Full Name: Dan Nordquist
- Contact:
Re: how to translate TargetHostID to the guest server name?
yes, you were right, I just needed to getLog() for the job level result in addition to the task level results
thanks again for your help!
thanks again for your help!
-
- Product Manager
- Posts: 20413
- Liked: 2301 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: how to translate TargetHostID to the guest server name?
No worries. Glad to hear that my input has been helpful. Thanks.
Who is online
Users browsing this forum: No registered users and 8 guests