Powershell Report Date Issue

PowerShell script exchange

Powershell Report Date Issue

Veeam Logoby OWTech » Tue Oct 16, 2012 10:16 am

While creating a powershell script to email and html report containing the server name, the result, the last run time and the next run time I noticed that the last run was correctly formatted as type date but the next run was formatted as type string, and because of that displayed in US format. Is this by design? Should both not be of type date?

> (Get-VBRJob)[0].scheduleoptions.nextrun.gettype()

IsPublic IsSerial Name BaseType
-------- -------- ---- --------
True True String System.Object


> (Get-VBRJob)[0].scheduleoptions.latestrun.gettype()

IsPublic IsSerial Name BaseType
-------- -------- ---- --------
True True DateTime System.ValueType
OWTech
Novice
 
Posts: 7
Liked: never
Joined: Mon Jan 16, 2012 11:32 am
Full Name: James Richmond

Re: Powershell Report Date Issue

Veeam Logoby Vitaliy S. » Wed Oct 17, 2012 9:26 am

Hi James, yes, that is by design. Thanks!
Vitaliy S.
Veeam Software
 
Posts: 19539
Liked: 1097 times
Joined: Mon Mar 30, 2009 9:13 am
Full Name: Vitaliy Safarov

Re: Powershell Report Date Issue

Veeam Logoby pizzim13 » Thu Oct 18, 2012 12:59 pm 1 person likes this post

This can be turned into a datetime object by using get-date.
Code: Select all
(Get-VBRJob)[0].scheduleoptions.nextrun | get-date
pizzim13
Enthusiast
 
Posts: 86
Liked: 6 times
Joined: Thu Apr 21, 2011 7:37 pm


Return to PowerShell



Who is online

Users browsing this forum: Exabot [Bot], Google [Bot], Yahoo [Bot] and 6 guests