Reply to Message

View discussion in a popup

Replying to:
LucD
Leadership
Leadership

That is exactly what I just did, and it works for me.

LucD_0-1684169816875.png

It could be that your station has regional settings that are not en-US.
And unfortunately, the DateTime casting uses the en-US setting by default.
What does the following return?

Get-Culture

If that is not en-US, you can force the DateTime conversion to use en-US (as the VMKernel log uses)

$c = [cultureInfo]::GetCultureInfo('en-US')
$lastLine.LastLine.Split(' ')[0].ToDateTime($c) 


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

Reply
0 Kudos