MSEndpointMgr / ConfigMgr

Microsoft Endpoint Configuration Manager scripts and tools
633 stars 281 forks source link

Time field incorrect in log file #121

Closed vorlon77 closed 5 years ago

vorlon77 commented 5 years ago

In some of the scripts like Invoke-CMDownloadBIOSPackage.ps1 the time field is incorrect in the log file which causes issues when displaying the log file with CMTrace depending on the local timezone. For example:

13:51:24.650+-420

Instead of:

$Time = -join @((Get-Date -Format "HH:mm:ss.fff"), "+", (Get-WmiObject -Class Win32_TimeZone | Select-Object -ExpandProperty Bias))

which ends up with the +- you can use

$Time = "{0:HH:mm:ss.fff}{1:+####;-####;+000}" -f @((Get-Date), (-(Get-WmiObject -Class Win32_TimeZone | Select-Object -ExpandProperty Bias)))