Get-SCSMIncidet -CreatedBefore argument-Problems

Dec 3, 2010 at 4:56 PM


I'm not able to understand the date format needed for the -createdbefore argument.

Using -CreatedBefore 2010-08-12 ... gives me results

Using -CreatedBefore 2010-30-01 ... gives me an error (Invalid Argument)

Using -CreatedBefore 2010-01-30 ... gives me also an error (Invalid Argument)

Using -CreatedBefore 2010-08-8 ... gives me results

Using -CreatedBefore 2010-08-1 ... gives me an error (Invalid Argument)

Using -CreatedBefore 2010-01-12 ... gives me results

What's the right way ? Want to get this cmdlet working. Please help.



Dec 3, 2010 at 11:46 PM

The error you describe is a little vague, so I'm not sure I'm answering it correctly, but the CreatedBefore parameter is of type System.DateTime, so you need to provide a string which can be converted into a datetime object.

You can check if your string can be converted into this type as follows:


PS# [DateTime]"2010-01-30"

Saturday, January 30, 2010 12:00:00 AM

PS# [DateTime]"2010-30-1"
Cannot convert value "2010-30-1" to type "System.DateTime". Error: "String was not recognized as a valid DateTime."
At line:1 char:11
+ [DateTime] <<<< "2010-30-1"
    + CategoryInfo          : NotSpecified: (:) [], RuntimeException
    + FullyQualifiedErrorId : RuntimeException

Dec 5, 2010 at 1:35 PM


thanks for your reply. I've tested your suggestion. It doesn't work also. Same error message:

Get-SCSMIncident -Createdbefore "2010-01-30" gives the same error back as

Get-SCSMIncident -Createdbefore 2010-01-30

--> String was not recognized as a valid DateTime

Get-SCSMIncident -Createdbefore 2010-01-13 still works. It would be great if there is someone out there able to explain and to solute this.