- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
That is exactly what I just did, and it works for me.
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