-
- Enthusiast
- Posts: 67
- Liked: 6 times
- Joined: Aug 07, 2015 8:45 pm
- Full Name: David Engler
- Contact:
Get-VBRRestoreSession object
I'm trying to track down information from restore sessions but I'm not able to find some of the information in the PS restore session object that is in the GUI. Looking at the log tab from the GUI from a failed session the last two entries are "Session became orphaned" and "Restore job is failed: Restore session closed unexpectedly" Does anyone know where I can find this information from the history of the restore sessions?
-
- Product Manager
- Posts: 20415
- Liked: 2302 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Get-VBRRestoreSession object
Can you tell me what type of restore session was executed: FLR, Instant VM Recovery, Full VM Recovery, Tape Recovery, etc.? Thanks!
-
- Enthusiast
- Posts: 67
- Liked: 6 times
- Joined: Aug 07, 2015 8:45 pm
- Full Name: David Engler
- Contact:
Re: Get-VBRRestoreSession object
File level restore
-
- Product Manager
- Posts: 20415
- Liked: 2302 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Get-VBRRestoreSession object
Then, you can use something like this (should output restore session log):
Thanks!
Code: Select all
Asnp VeeamPSSNapin
$RestoreSession = Get-VBRRestoreSession | sort creationtimeutc -Descending | select -First 1
$RestoreSession.Logger.Getlog().updatedrecords.title
-
- Enthusiast
- Posts: 67
- Liked: 6 times
- Joined: Aug 07, 2015 8:45 pm
- Full Name: David Engler
- Contact:
Re: Get-VBRRestoreSession object
Thanks for the quick response, I will give this a try
-
- Product Manager
- Posts: 20415
- Liked: 2302 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Get-VBRRestoreSession object
The script assumes that the session you need to query is the latest executed one. If that's not true, add some filter parameter: creation time, VM name or similar. Thanks!
-
- Enthusiast
- Posts: 67
- Liked: 6 times
- Joined: Aug 07, 2015 8:45 pm
- Full Name: David Engler
- Contact:
Re: Get-VBRRestoreSession object
Thanks, I am able to get the information I'm looking for. I have an open case where it appears for some of the failed FLR restores its causing scheduled jobs not to start.
Using the code you provided I was able to find a log entry "Exception of type 'Veeam.Backup.AgentProvider.AgentClosedException' was thrown." So far I have found at least one example of this on the days we have experienced the scheduled job issue.
I have other failed FLR sessions that do not contain this Exception but they are not causing the scheduled jobs to stop running.
Using the code you provided I was able to find a log entry "Exception of type 'Veeam.Backup.AgentProvider.AgentClosedException' was thrown." So far I have found at least one example of this on the days we have experienced the scheduled job issue.
I have other failed FLR sessions that do not contain this Exception but they are not causing the scheduled jobs to stop running.
-
- Enthusiast
- Posts: 67
- Liked: 6 times
- Joined: Aug 07, 2015 8:45 pm
- Full Name: David Engler
- Contact:
Re: Get-VBRRestoreSession object
Adding a portion of my script in case someone else could use it. I used the same code minus the -and $restoreSession.Result -eq "Failed" and log information to pull back a csv from the past year of FLR restores. Parsing the data I found that our SD has ran over 400 restores from the same server, looks like I found my next script to automate those restores for them
Code: Select all
$restoreSessions = Get-VBRRestoreSession
foreach ($restoreSession in $restoreSessions)
{
$item = "" | Select Server, RestorePoint, Start, End, Who, Result, Log
if ($restoreSession.JobType -eq "FileLevelRestore" -and $restoreSession.Result -eq "Failed")
{
$item.Server = $restoreSession.Info.VmDisplayName
$item.RestorePoint = $restoreSession.Info.OibCreationTime
$item.Start = $restoreSession.CreationTime
$item.End = $restoreSession.EndTime
$item.Who = $restoreSession.Info.Initiator.Name
$item.Result = $restoreSession.Result
$tmplog = $restoreSession.Logger.GetLog().updatedrecords.title
foreach ($log in $tmplog)
{
$item.Log += $log
$item.Log += ","
}
$results += $item
}
}
$results | Export-Csv $resultsFile -NoTypeInformation
-
- Product Manager
- Posts: 20415
- Liked: 2302 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Get-VBRRestoreSession object
Thanks for sharing the resulting script with fellow forum members; appreciated!
Who is online
Users browsing this forum: No registered users and 4 guests