PowerShell script exchange
Post Reply
jsobell
Novice
Posts: 5
Liked: never
Joined: Nov 07, 2024 2:36 am
Full Name: Jason Sobell
Contact:

Retrieving Fileshare backup information and status...

Post by jsobell »

I'm trying to export job status and data volume results using PowerShell, and some of our jobs are 'File Backup'. Using `Get-VBRUnstructuredBackup` I can see the two jobs, one of which has six fileshares, but I don't see any way of retrieving a list of the backup job results and the individual shares (and their success status) that we see through the UI. The UI shows a status for each fileshare, but the VBR API result simply shows a single Success status and no file share information.

I can't find any documentation regarding this, so does anyone have any pointers or example of code?
david.domask
Veeam Software
Posts: 2109
Liked: 509 times
Joined: Jun 28, 2016 12:12 pm
Contact:

Re: Retrieving Fileshare backup information and status...

Post by david.domask »

Hi Jason, welcome to the forums.

If you want to check the results of a given session, start with Get-VBRUnstructuredBackupSession and pass the job name on the -Name parameter and save the desired session to some variable.

Pass that variable to Get-VBRUnstructuredBackupTaskSession and you will get the status of the last backup of each share within the job.

Code: Select all

PS C:\temp> $unstrBackupSess = Get-VBRUnstructuredBackupSession -Name "Some Example Job Name"
PS C:\temp> Get-VBRUnstructuredBackupTaskSession -Session $unstrBackupSess[0]


Progress        : Veeam.Backup.PowerShell.Infos.VBRUnstructuredBackupTaskSessionProgress
BackupSessionId : d64621f3-6545-4033-9055-d332f4b2a41f
Name            : 172.21.237.12:/mnt/nfs
CreationTime    : 05.09.2024 20:04:55
EndTime         : 05.09.2024 20:08:40
JobId           : 4d669e0b-7017-4cee-b385-c6d891be2729
Result          : Warning
State           : Stopped
Id              : 25f1b8d8-740e-4c39-bd2a-21afee408ce5
David Domask | Product Management: Principal Analyst
jsobell
Novice
Posts: 5
Liked: never
Joined: Nov 07, 2024 2:36 am
Full Name: Jason Sobell
Contact:

Re: Retrieving Fileshare backup information and status...

Post by jsobell »

Brilliant, thanks David, that is exactly what I was looking for!
The only additional item I'd like to find is the message associated with Warnings or Errors. There's no property on the `VBRUnstructuredBackupTaskSession` object. Is that data also accessible?

Many thanks,
Jason
david.domask
Veeam Software
Posts: 2109
Liked: 509 times
Joined: Jun 28, 2016 12:12 pm
Contact:

Re: Retrieving Fileshare backup information and status...

Post by david.domask »

Hi Jason,

You're very welcome, glad I could assist.

For the additional details, we can take a slightly different path for the moment. Pass the ID from the object returned by Get-VBRUnstructuredBackupSession to Get-VBRTaskSession on the -Session parameter:

Get-VBRTaskSession -Session $unstrBackupSess

Will give you what you need.
David Domask | Product Management: Principal Analyst
jsobell
Novice
Posts: 5
Liked: never
Joined: Nov 07, 2024 2:36 am
Full Name: Jason Sobell
Contact:

Re: Retrieving Fileshare backup information and status...

Post by jsobell »

Brilliant, I will try that on Monday!

Thanks again,
Jason
jsobell
Novice
Posts: 5
Liked: never
Joined: Nov 07, 2024 2:36 am
Full Name: Jason Sobell
Contact:

Re: Retrieving Fileshare backup information and status...

Post by jsobell »

Thought I'd have a quick look over the weekend.
The call returns a CBackupTaskSession object which as an Info property, but this doesn't seem to have any of the reasons for a warning:

Code: Select all

Id                     : 286250f5-6a9f-406c-b186-5d78983bd503
Uid                    : 286250f56a9f406cb1865d78983bd503
ObjectName             : \\xxyysvm012.xxyy.local\dbbackups
Reason                 : 0 files and 0 folders (0 B) transferred at 0 KB/s
QueuedTime             : 17/10/2024 8:30:31 PM
SessionId              : 69aab6b5-17e2-4ce9-9a0f-1e315d9e2170
ParentTaskSessionId    : 00000000-0000-0000-0000-000000000000
WorkDetails            : Veeam.Backup.Model.CBackupTaskWorkDetails
ObjectPlatform         : ENasBackup
Progress               : Veeam.Backup.Model.CBackupProgressData
ObjectId               : d7eaaeb8-1e6b-4c96-92c8-fff43d395bd8
Status                 : Warning
Operation              : 
SourceMode             : Unknown
ChangeTracking         : False
RetryCounter           : 0
Tooltip                : 
Log                    : 
LogsSubFolder          : 
CurrentPointId         : 55ffae47-d901-41c7-9d73-b530c7603458
IsFullMode             : False
Tag                    : 286250f5-6a9f-406c-b186-5d78983bd503
SupportsBackupCommands : True
The HTML reports have a 'Details' column with this feedback as a reason:

Code: Select all

0 files and 0 folders (0 B) transferred at 0 KB/s
Unable to rescan 3 folders
Processing finished with warnings at 18/10/2024 1:57:03 PM
Some files remained locked for the entire duration of the backup job, and were skipped. Skipped files report can be found on the backup server at D:\Veeam Logs\XX00-MIDSVM012_File_Shares\__xxsvm012.xxyy.local_dbbackups\Report\__xxsvm012.xxyy.local_dbbackups_2024-10-17T203045.csv
Is there a nested property or function I can call to retrieve this meaningful message?

Thanks,
Jason
david.domask
Veeam Software
Posts: 2109
Liked: 509 times
Joined: Jun 28, 2016 12:12 pm
Contact:

Re: Retrieving Fileshare backup information and status...

Post by david.domask »

Hi Jason,

For the details, you'll need to go into slightly unsupported territory. Please see my post here: post449831.html#p449831

It shows how to pull this information from any *Session object with the Logger() method.
David Domask | Product Management: Principal Analyst
jsobell
Novice
Posts: 5
Liked: never
Joined: Nov 07, 2024 2:36 am
Full Name: Jason Sobell
Contact:

Re: Retrieving Fileshare backup information and status...

Post by jsobell »

Great, thanks. We'll probably do it manually for now, but I'll look at implementing this using code sometime in the future.

Thanks,
Jason
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests