PowerShell script exchange
Post Reply
OWTech
Novice
Posts: 7
Liked: never
Joined: Jan 16, 2012 11:32 am
Full Name: James Richmond
Contact:

Powershell Report Date Issue

Post by OWTech »

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
Vitaliy S.
VP, Product Management
Posts: 27114
Liked: 2720 times
Joined: Mar 30, 2009 9:13 am
Full Name: Vitaliy Safarov
Contact:

Re: Powershell Report Date Issue

Post by Vitaliy S. »

Hi James, yes, that is by design. Thanks!
pizzim13
Enthusiast
Posts: 94
Liked: 6 times
Joined: Apr 21, 2011 7:37 pm
Contact:

Re: Powershell Report Date Issue

Post by pizzim13 » 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
Post Reply

Who is online

Users browsing this forum: No registered users and 13 guests