cancel
Showing results for 
Search instead for 
Did you mean: 

Get-BEJobHistory

bawright
Level 4
Certified

Hi There

I'm running the below command. However it returns more than the last 12 hours.

Get-BEJobHistory -JobStatus Error -FromStartTime (Get-Date).AddHours(-12) | ft -auto

Any help with would be great?


Cheers,

 

Brett

1 ACCEPTED SOLUTION

Accepted Solutions

bawright
Level 4
Certified

However this works

 

$a = (Get-Date).AddHours(-12)
 
Get-BEJobHistory -JobStatus Error | where-object {$_.StartTime -gt $a} | ft -auto
 
Cheers,
 
Brettw

View solution in original post

4 REPLIES 4

pkh
Moderator
Moderator
   VIP    Certified

Have you tried this?

$a = (Get-Date).AddHours(-12)

Get-BEJobHistory -JobStatus Error -FromStartTime $a | ft -auto

If the above also does not work, try filtering it another way.

$a = (Get-Date).AddHours(-12)

Get-BEJobHistory -JobStatus Error | where-object {($_.StartTime > $a)} | ft -auto

bawright
Level 4
Certified

Both of these don't work. The first comes be the last couple of months of jobs and the second one I get the below error.

 

Cannot find drive. A drive with the name '01/20/2013 20' does not exist.
At line:3 char:65
+ Get-BEJobHistory -JobStatus Error | where-object {$_.StartTime > <<<<  $a} | ft -auto
    + CategoryInfo          : ObjectNotFound: (01/20/2013 20:String) [], DriveNotFoundException
    + FullyQualifiedErrorId : DriveNotFound
 
Cheers,
 
Brett

bawright
Level 4
Certified

However this works

 

$a = (Get-Date).AddHours(-12)
 
Get-BEJobHistory -JobStatus Error | where-object {$_.StartTime -gt $a} | ft -auto
 
Cheers,
 
Brettw

nPc
Level 4

Make the 'Get-Date' item fully evaluate.

Try:

Get-BEJobHistory -JobStatus "Error" -FromStartTime "$((Get-Date).AddHours(-12))" | ft -auto