PowerShell script exchange
Post Reply
volkanvk
Influencer
Posts: 10
Liked: never
Joined: Jun 21, 2021 6:27 am
Full Name: Volkan von Klass
Contact:

How do i get the Last 24 Hours as a List?

Post by volkanvk »

Hi

Whats the best way to get the "last 24 Hours" list from the console by powershell?

Thank you
Volkan
david.domask
Veeam Software
Posts: 1226
Liked: 323 times
Joined: Jun 28, 2016 12:12 pm
Contact:

Re: How do i get the Last 24 Hours as a List?

Post by david.domask »

Hi @volkanvk,

Get-VBRBackupSession and/or Get-VBRSession will have a CreationTime property. I would just do something like:

$CurrDate = Get-Date
$last24Hours = Get-VBRBackupSession | Where-Object {$_.CreationTime -ge ($CurrDate.AddDays(-1) -AND $_.CreationTime -le $CurrDate}

You can add further clauses to the Where-Object section of the pipeline, but this would be best bet.
David Domask | Product Management: Principal Analyst
volkanvk
Influencer
Posts: 10
Liked: never
Joined: Jun 21, 2021 6:27 am
Full Name: Volkan von Klass
Contact:

Re: How do i get the Last 24 Hours as a List?

Post by volkanvk »

@david.domask

That looks good, but i have no agent or tape jobs in this list.
david.domask
Veeam Software
Posts: 1226
Liked: 323 times
Joined: Jun 28, 2016 12:12 pm
Contact:

Re: How do i get the Last 24 Hours as a List?

Post by david.domask »

Hi @volkanvk, you are very welcome; both tape and agent jobs have their own *Session cmdlets:

Get-VBRSession
Get-VBRComputerBackupJobSession

SO you would need to build an array for each one, or you can use Generic List to add all of them together, but it might be best for you to just build each array, do the processing, and then send the resulting data to whatever your final destination may be for the data.
David Domask | Product Management: Principal Analyst
Herbert Sz
Veeam Software
Posts: 1036
Liked: 202 times
Joined: Oct 02, 2017 7:28 pm
Full Name: Herbert Szumovski
Contact:

Re: How do i get the Last 24 Hours as a List?

Post by Herbert Sz »

@volkanvk You can also try this one (Oldies but Goldies, refurbished. :-) Works also with 12.1, but takes time to finish in a larger environment): https://github.com/marcohorstmann/MyVeeamReport
volkanvk
Influencer
Posts: 10
Liked: never
Joined: Jun 21, 2021 6:27 am
Full Name: Volkan von Klass
Contact:

Re: How do i get the Last 24 Hours as a List?

Post by volkanvk »

@Herbert Sz

Cool, i have now all informations on a html page for the Backup/Agent and Tape Sessions but there is no option to export this to a csv file. The only option is for backup states... :(

Any idea how to get a csv from the result?
Herbert Sz
Veeam Software
Posts: 1036
Liked: 202 times
Joined: Oct 02, 2017 7:28 pm
Full Name: Herbert Szumovski
Contact:

Re: How do i get the Last 24 Hours as a List?

Post by Herbert Sz »

You could use one of the many html to csv table converters on the Internet.
Or: participate in the script enhancement and add the functionality. :-)
Post Reply

Who is online

Users browsing this forum: No registered users and 8 guests