I've just updated to the new "ServiceNow" module, but when calling Get-ServiceNowIncident it now throws the error:
Cannot convert value "15-01-2018 18:01:12" to type "System.DateTime". Error: "String was not recognized as a valid
DateTime."
At C:\Program Files\WindowsPowerShell\Modules\servicenow\1.0.0\Public\Get-ServiceNowTable.ps1:88 char:5
+ $SNResult.$Property = [datetime]$SNResult.$Property
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvalidCastParseTargetInvocationWithFormatProvider
I've pulled the code from Update Get-ServiceNowTable.ps1 and this is what I get returned:
PS > $CultureDateTimeFormat = (Get-Culture).DateTimeFormat
$DateFormat = $CultureDateTimeFormat.ShortDatePattern
$TimeFormat = $CultureDateTimeFormat.LongTimePattern
$DateTimeFormat = "$DateFormat $TimeFormat"
PS > $DateTimeFormat
dd/MM/yyyy HH:mm:ss
If I revert back to the previous psservicenow module (v0.1.15) I can successfully return the tickets using the same command:
PS > get-module "servicenow"
ModuleType Version Name ExportedCommands
Script 0.1.15 psservicenow {Get-ServiceNowChangeRequest, Get-ServiceNowConfigurationI...
PS > $OpenTickets | select -first 1
number short_description opened_at
TEST001 Test...1...2...3 12-01-2018 13:13:29
UPDATE
Just read the updated read me - I think it's due to the implementation of returning date/time #22