Ensure time is set correctly on windows

This commit is contained in:
Manuel Thalmann 2024-03-24 17:09:28 +01:00
parent 94024951ff
commit 79cc1e3db4

View file

@ -7,6 +7,16 @@
function Initialize-Configuration { function Initialize-Configuration {
# Fix synchronization between Linux and Windows clock # Fix synchronization between Linux and Windows clock
Set-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Control\TimeZoneInformation" -Name "RealTimeIsUniversal" -Value 1 -Type "DWord"; Set-ItemProperty "HKLM:\SYSTEM\CurrentControlSet\Control\TimeZoneInformation" -Name "RealTimeIsUniversal" -Value 1 -Type "DWord";
# Force time resynchronization
$service = Get-Service W32Time;
$stopped = ($service.Status -eq "Stopped");
Start-Service $service;
w32tm /resync /force;
if ($stopped) {
Stop-Service $service;
}
} }
function Restore-Apps { function Restore-Apps {