PowerShell – Reusable function to convert WMI date to readable output

Although I’m still troubleshooting and re-writing my previous posted re-usable function, here’s another one. And yes, this time I’ve tested it thoroughly Knipogende emoticon

Whenever you get the date from a computer by using WMI, you will receive output such as:

image

Now this is just plain nasty… I don’t know of anyone that can read this without using a calculator… so how to convert this to “readable” output? I’ve written a small function to do just that Emoticon met brede lach

function WMI-DateStringToDate($lastboottime)
{    [System.Management.ManagementDateTimeconverter]::ToDateTime($lastboottime) 

And by using this, one would get a proper and readable output:

image

Note: As you can see, I’ve got a system installed in my native language Dutch). So an English installed OS would give you some English output Knipogende emoticon

Leave a Reply

Your email address will not be published. Required fields are marked *