PowerShell Quick Tip

PowerShell Quick Tip: Convert Local Time to UTC

PowerShell Quick Tip: How to convert local time to UTC. This is useful when you run Powershell against systems in different timezones 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 currently hold active 15 Microsoft certifications. Certified on Windows Server, Windows Client, SQL, Exchange and System Center Configuration Manager. Anders Rødland also holds an ITIL 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.