PowerShell script exchange
Etilimos
Influencer
Posts: 16 Liked: never
Joined: Feb 16, 2022 3:17 pm
Contact:
Post
by Etilimos » Mar 24, 2022 9:04 am
this post
Hello,
I need to output an extraction of the size of the last full of our copy job.
I had made this script, but it outputs the last backup (and thus the increments).
Code: Select all
$Jobs = Get-VBRJob -Name '*COPY JOB*'
$LastSession = $jobs.FindLastSession() | % {$_ | Select-Object Name,@{Name = 'Taille'; Expression = {$_.Info.Progress.TotalUsedSize}}} | Export-csv .\size.csv -NoTypeInformation -Encoding UTF8
Can you help me with this?
Thanks in advance
david.domask
Veeam Software
Posts: 2123 Liked: 513 times
Joined: Jun 28, 2016 12:12 pm
Contact:
Post
by david.domask » Mar 24, 2022 9:42 am
this post
Hey Etilimos,
Try getting the Backups with Get-VBRBackup and then use the FindLastFullUncorruptedStorage() method. Note that such methods are not supported and are prone to change, so this may change in future releases. No support is granted for these methods.
Code: Select all
$job = Get-VBRJob -name 'vmware-pervm-ffi' #this is my job name, replace this
$backup = Get-VBRBackup -Name $job.name
$backup.FindLastFullUncorruptedStorage()
Example output:
Code: Select all
PS C:\Users\Administrator> $backup.FindLastFullUncorruptedStorage()
Info : Veeam.Backup.Model.CStorageInfo
Id : 5072440e-432d-49a3-8a3c-296e0a55c45a
LinkIdNullable :
FilePath : vmware-pervm-ffiD2022-03-19T184403_6993.vbk
PartialPath : vmware-pervm-ffiD2022-03-19T184403_6993.vbk
HostId : 6745a759-2205-4cd2-b172-8ec8f7e60ef8
BackupId : e3b8689e-b256-4f23-890b-f20922b94163
LinkableType : Storage
IsFullFast : True
IsIncrementalFast : False
IsFull : True
CreationTime : 3/19/2022 6:40:00 PM
CreationTimeWrapped : 3/19/2022 6:40:00 PM
CreationTimeUtcWrapped : 3/20/2022 1:40:00 AM
CreationTimeUtc : 3/20/2022 1:40:00 AM
Stats : Veeam.Backup.Model.CBackupStats #this is what you want
David Domask | Product Management: Principal Analyst
Etilimos
Influencer
Posts: 16 Liked: never
Joined: Feb 16, 2022 3:17 pm
Contact:
Post
by Etilimos » Mar 28, 2022 10:04 am
this post
Hello,
Thank you for your help !
And how can I get the size of these full?
david.domask
Veeam Software
Posts: 2123 Liked: 513 times
Joined: Jun 28, 2016 12:12 pm
Contact:
Post
by david.domask » Mar 28, 2022 11:42 am
this post
Always welcome!
I think you maybe missed that I hid a comment in there for you
Stats : Veeam.Backup.Model.CBackupStats
#this is what you want
Code: Select all
PS C:\Users\Administrator> $backup.FindLastFullUncorruptedStorage().Stats
BackupSize DataSize DedupRatio CompressRatio
---------- -------- ---------- -------------
2199552 2147520380 0 26
All values are in Bytes.
You can use the [Math]::Round() to do the math, and Powershell respects Byte values:
https://docs.microsoft.com/en-us/previo ... dfrom=MSDN
Code: Select all
PS C:\Users\Administrator> $backup.FindLastFullUncorruptedStorage().Stats.Backupsize / 1Gb
0.00204849243164063
PS C:\Users\Administrator> $backup.FindLastFullUncorruptedStorage().Stats.Backupsize / 1Mb
2.09765625
PS C:\Users\Administrator> 2199552 / 1024 /1024
2.09765625
David Domask | Product Management: Principal Analyst
Users browsing this forum: No registered users and 14 guests