[wpkg-users] Still WPKG users around?

Stefan Pendl stefan.pendl.71 at gmail.com
Sat May 5 10:01:47 CEST 2018


Am 05.05.2018 um 09:49 schrieb Holger Kröber:
> 
> how is your scheduled task implemented exactly? Does it run on the 
> system account? Does it run on logon or before?

The scheduled task runs as SYSTEM at a specified time in the evening.
Startup, Shutdown, Logon and Logoff are no longer good options due to 
the tightened security introduced with Windows 8 and above.

Main Windows command script "ScheduledWPKG.cmd" executed by the 
scheduled task:
rem --- code start (watch for line wraps)

@rem
@echo off

set isUserLoggedOn=0
for /F "tokens=1" %%P in ( 'tasklist' ) do if /i "%%~P" == 
"explorer.exe" set isUserLoggedOn=1
if %isUserLoggedOn% EQU 1 goto :EOF

if not defined MY_WPKG_SOFTWARE goto :finish
if not defined MY_WPKG_ROOT     goto :finish

rem run WPKG
Set SOFTWARE=%MY_WPKG_SOFTWARE%
Set WPKG_ROOT=%MY_WPKG_ROOT%

echo.
call "%WPKG_ROOT%\tools\WPKGclearLog.cmd"
echo.
cscript.exe "%WPKG_ROOT%\wpkg.js" /synchronize /nonotify /quiet
echo.
call "%WPKG_ROOT%\tools\WPKGclientCollect.cmd"
echo.

:finish
shutdown.exe -s -t 600 -d p:4:1

rem --- code end

Windows command script "WPKGclearLog.cmd":
rem --- code start (watch for line wraps)

for /f "tokens=*" %%V in ('ver') do set os_ver=%%V

echo %DATE% %TIME% ERROR : %os_ver% - WPKG did not finish successfully! 
 >"%SOFTWARE%\WPKG\ClientLogs\%COMPUTERNAME%.log"

rem --- code end

Windows command script "WPKGclientCollect.cmd":
rem --- code start (watch for line wraps)

set script_name=%~n0

echo %DATE% %TIME% INFO : WPKG successfully finished! 
 >"%SOFTWARE%\WPKG\ClientLogs\%COMPUTERNAME%.log"

echo SOFTWARE .... %SOFTWARE% >"%TMP%\%script_name%.log"
echo WPKG_ROOT ... %WPKG_ROOT% >>"%TMP%\%script_name%.log"

if exist "%TMP%\wpkg-%COMPUTERNAME%.log" copy /Y 
"%TMP%\wpkg-%COMPUTERNAME%.log" 
"%SOFTWARE%\WPKG\ClientLogs\%COMPUTERNAME%.log" >>"%TMP%\%script_name%.log"
if exist "%SystemRoot%\system32\wpkg.xml" copy /Y 
"%SystemRoot%\system32\wpkg.xml" 
"%SOFTWARE%\WPKG\ClientStatus\%COMPUTERNAME%.xml" 
 >>"%TMP%\%script_name%.log"

rem --- code end


-- 
*Stefan P.*

Top-posting:
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing in e-mail?


More information about the wpkg-users mailing list