Schedule timesync.ps1 in install.bat

Signed-off-by: Oskar Manhart <52569953+oskardotglobal@users.noreply.github.com>
This commit is contained in:
eylenburg
2025-06-23 14:37:54 +01:00
committed by Oskar Manhart
parent 3f909c5ec0
commit 9708ca2825

View File

@@ -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%.
)
)