[Management.ManagementDateTimeConverter]::ToDateTime($WMIDate)
DetailsWhen using the Get-WmiObject cmdlet datetimes are returned using the Common Information Model (CIM) format. This command will convert these to standard datetime objects.
Example
PS C:\> $WMIDate = (Get-WmiObject -Class Win32_OperatingSystem).LastBootUpTime >> [Management.ManagementDateTimeConverter]::ToDateTime($WMIDate) Tuesday, April 9, 2019 12:54:35 PM
Share this:
- Click to share on LinkedIn (Opens in new window)
- Click to share on Mastodon (Opens in new window)
- Click to share on Bluesky (Opens in new window)
- Click to share on Reddit (Opens in new window)
- Click to share on Twitter (Opens in new window)
- Click to share on Facebook (Opens in new window)
- Click to email a link to a friend (Opens in new window)