Get-Date in UTC

Need to show time in UTC (Universal Time)? There is a 'method' with the Get-Date cmdlet. If you run:

Get-Date | Get-Member

You'll find that one of the methods is ToUniversalTime() which allows you to output the time of the local machine, converted to the UTC time. Run the code below to show how the method works:

$DateTime = Get-Date
$Datetime.ToUniversalTime()

Write-host $Datetime.ToUniversalTime()