AdamGrossTX/Windows10FeatureUpdates

NewDateTime variable output may vary depending on culture settings

Opened this issue · 0 comments

Hi!

The following variable may be blank depending on culture settings:

$NewDateTime = (Get-Date).GetDateTimeFormats()[72]

See Remarks for explanation: DateTime.GetDateTimeFormats Method

Example:
Open PowerShell, run:
Set-Culture lt-LT
Close & re-open PowerShell, run:
(Get-Date).GetDateTimeFormats()[72]
Output will be blank.

This causes the DateTime registry value in HKLM:\System\Setup\MoSetup\Volatile\SetupDiag to be blank which causes the discovery script of the CI Feature Update - SetupDiag Results to always be non-compliant. This means SetupDiag will run every time the CI runs.

I suggest replacing it with:
$NewDateTime = Get-Date -Format G