From 9708ca2825fa245d0c7e2bf417498f7a7bde7573 Mon Sep 17 00:00:00 2001 From: eylenburg <84839316+eylenburg@users.noreply.github.com> Date: Mon, 23 Jun 2025 14:37:54 +0100 Subject: [PATCH] Schedule timesync.ps1 in install.bat Signed-off-by: Oskar Manhart <52569953+oskardotglobal@users.noreply.github.com> --- oem/install.bat | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/oem/install.bat b/oem/install.bat index 018c510..9a1b208 100644 --- a/oem/install.bat +++ b/oem/install.bat @@ -23,3 +23,20 @@ if %ERRORLEVEL% equ 0 ( ) else ( echo Failed to create scheduled task. ) + +REM Create time sync task to be run by the user at login +copy %~dp0\TimeSync.ps1 %windir% +set "taskname2=TimeSync" +set "command2=powershell.exe -WindowStyle Hidden -ExecutionPolicy Bypass -File \"%windir%\TimeSync.ps1\"" + +schtasks /query /tn "%taskname2%" >nul +if %ERRORLEVEL% equ 0 ( + echo %DATE% %TIME% Task "%taskname2%" already exists, skipping creation. +) else ( + schtasks /create /tn "%taskname2%" /tr "%command2%" /sc onlogon /rl HIGHEST /f + if %ERRORLEVEL% equ 0 ( + echo %DATE% %TIME% Scheduled task "%taskname2%" created successfully. + ) else ( + echo %DATE% %TIME% Failed to create scheduled task %taskname2%. + ) +)