PowerShell Quick Tip

PowerShell Quick Tip: PowerShell UTC Time from Local Time

PowerShell Quick Tip: How to get PowerShell UTC time from local time. This is useful when you run PowerShell against systems in different time zones and don’t want to deal with client local time.

The [DateTime] object in PowerShell have the ToUniversalTime() method, which converts the current time of the object to UTC time.

PowerShell Convert to UTC

The local time of my computer is UTC+1, and the content of $DateTime contains that time. But executing the method ToUniversalTime() on $DateTime now shows the UTC time instead.

Anders Rødland

Anders Rødland started his IT career in 2006. My main focus is MS Configuration Manager and client management, and I have passed 17 Microsoft certifications since then. My main expertise is on client management with Microsoft Endpoint Manager: Intune and Configuration Manager. I also do a lot of work on the security side with Microsoft Defender for Endpoint. In addition to my Microsoft certification, I also have an ITIL v3 Foundation certification. This is my private blog and do not represent my employer. I use this to share information that I find useful. Sharing is caring.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.