PowerShell script exchange
Post Reply
Cragdoo
Veeam Vanguard
Posts: 629
Liked: 251 times
Joined: Sep 27, 2011 12:17 pm
Full Name: Craig Dalrymple
Location: Scotland
Contact:

v11 - Export-VBRAudit date issue

Post by Cragdoo »

Was looking around the new cmdlets and trying out the new Export-VBRAudit , according to the example here https://helpcenter.veeam.com/docs/backu ... ml?ver=110

Code: Select all

Export-VBRAudit -From 02.02.2020 -To 02.22.2020 -FileFullPath "C:\Reports\Reports\JanuaryReport.txt"
however if I follow the date format in my lab

Code: Select all

Export-VBRAudit -from 03.17.2021 -to 03.19.2021 -fielfullpath c:\reports\test1.txt
I get the following error
Export-VBRAudit : Cannot bind parameter 'From'. Cannot convert value "03.17.2021" to type "System.DateTime". Error:
"String was not recognized as a valid DateTime."

if I change the date format to my locale (UK)

Code: Select all

Export-VBRAudit -from 17.03.2021 -to 19.03.2021 -filefullpath c:\reports\test1.txt
the command successfully runs.

Is that a documentation mistake? a local issue? something else
jhoughes
Veeam Vanguard
Posts: 279
Liked: 112 times
Joined: Apr 20, 2017 4:19 pm
Full Name: Joe Houghes
Location: Castle Rock, CO
Contact:

Re: v11 - Export-VBRAudit date issue

Post by jhoughes »

Hey Craig, those parameters are supposed to take a DateTime object. We'll need to get the example updated.

Here's a working example:

Code: Select all

PS C:\Users\svc_veeam_br> $fromdate = Get-Date '03.17.2021'
PS C:\Users\svc_veeam_br> $todate = Get-Date '03.19.2021'
PS C:\Users\svc_veeam_br> Export-VBRAudit -from $fromdate -to $todate -FileFullPath "C:\Users\svc_veeam_br\Documents\vbrdateaudit.txt"
C:\Users\svc_veeam_br\Documents\vbrdateaudit.txt
Husband, Father, Solutions Architect, Geek Extraordinaire | @DenverVMUG, @AustinVMUG & @ATXPowerShell leader | VMware vExpert | Cisco Champion
Cragdoo
Veeam Vanguard
Posts: 629
Liked: 251 times
Joined: Sep 27, 2011 12:17 pm
Full Name: Craig Dalrymple
Location: Scotland
Contact:

Re: v11 - Export-VBRAudit date issue

Post by Cragdoo »

still think it's locale setting issue ... using your example above

Code: Select all

PS C:\Users\Administrator> $fromdate = Get-Date '03.17.2021'
Get-Date : Cannot bind parameter 'Date'. Cannot convert value "03.17.2021" to type "System.DateTime". Error: "String
was not recognized as a valid DateTime."


but changing it to match my locale, UK

Code: Select all

PS C:\Users\Administrator> $fromdate = Get-Date '17.3.2021'
PS C:\Users\Administrator>
jhoughes
Veeam Vanguard
Posts: 279
Liked: 112 times
Joined: Apr 20, 2017 4:19 pm
Full Name: Joe Houghes
Location: Castle Rock, CO
Contact:

Re: v11 - Export-VBRAudit date issue

Post by jhoughes »

Yep, I had looked at the help for the cmdlet and saw the parameter type, then didn't look further.

I just verified that can input a string that would be valid for a DateTime lookup, which means it will be locale specific.

Sorry about that.
Husband, Father, Solutions Architect, Geek Extraordinaire | @DenverVMUG, @AustinVMUG & @ATXPowerShell leader | VMware vExpert | Cisco Champion
Cragdoo
Veeam Vanguard
Posts: 629
Liked: 251 times
Joined: Sep 27, 2011 12:17 pm
Full Name: Craig Dalrymple
Location: Scotland
Contact:

Re: v11 - Export-VBRAudit date issue

Post by Cragdoo » 1 person likes this post

no worries .... I should have RTFM'd a little more

so it's a documentation example update needed ..used something like

Code: Select all

$fromdate = (Get-Date).AddDays(-7)
$todate = Get-Date
Export-VBRAudit -from $fromdate -to $todate -FileFullPath c:\reports\Last7daysReport.txt
Post Reply

Who is online

Users browsing this forum: No registered users and 12 guests