PowerShell script exchange
Post Reply
shahn
Influencer
Posts: 18
Liked: 2 times
Joined: Sep 04, 2023 7:48 am
Contact:

Powershell question

Post by shahn »

i used this script.

Code: Select all

$TaskSessions = @()
$sessions = Get-VBRComputerBackupJobSession | Where-Object{$_.CreationTime -ge (Get-Date).AddDays(-$day)}
foreach ($session in $sessions) {
  $TaskSessions += Get-VBRTaskSession -Session $session | Select-Object -Property Jobname,@{n='Result';e={$_.Status}},@{n='StartTime';e={$_.Progress.StartTimeLocal}},@{n='EndTime';e={$_.Progress.StopTimeLocal}},@{n='Backup Size MB';e={[math]::Round(($_.Progress.TransferedSize/1024/1024),2)}} 
}
$TaskSessions | Sort -Property Jobname, StartTime -Descending | Format-Table >> $reportdir\Veeam-Daily-report-$dt.txt
question.
1. Do you have a Full, incremental column?
2. can i tell operating system apart? ex) window or Linux xxxxx
3. Can the results be divided into semicolons?
david.domask
Veeam Software
Posts: 2566
Liked: 603 times
Joined: Jun 28, 2016 12:12 pm
Contact:

Re: Powershell question

Post by david.domask »

Hi shahn,

From the Session objects this is a bit of a chore to do.

I would instead try to build this by first getting the backup with Get-VBRBackup and save it to a variable like $backup. Then you can pass $backup to Get-VBRRestorePoint on the -Backup flag to get a nice list with indicators for full/incremental.

For example:

Code: Select all

$backup = Get-VBRBackup | Where-Object{$_.JobId -eq $sessions[0].JobId}
$backup

Job Name                  Type            Creation Time               VM count
--------                  ----            -------------               --------
MAC-to-objectstorage      Mac Agent Po... 15.05.2023 13:22:55                1


$rp = Get-VBRRestorePoint -Backup $backup
$rp

VM Name                   Creation Time          Type
-------                   -------------          ----
someguy-mac02             17.05.2023 04:04:47    Full
someguy-mac02             18.05.2023 04:05:15    Increment
someguy-mac02             19.05.2023 04:06:10    Increment
someguy-mac02             20.05.2023 04:08:30    Increment
someguy-mac02             21.05.2023 04:05:15    Increment
someguy-mac02             22.05.2023 04:05:54    Increment
someguy-mac02             23.05.2023 04:05:53    Increment
someguy-mac02             23.05.2023 11:03:29    Full
If you want to have the session data also, you'll need to likely create a PSCustomObject in your loop:

https://learn.microsoft.com/en-us/power ... rshell-7.4

Microsoft's documentation on the Powershell behavior is surprisingly good, so give that a read and try making a custom object for your report. But if it were me I would just go with the restore points as it should have what you need.
David Domask | Product Management: Principal Analyst
Post Reply

Who is online

Users browsing this forum: No registered users and 11 guests