In tip 964, I scripted JSILLD.bat to report on user accounts that have not logged on since a given date.

JSINoLogoff.bat reports on logged on user accounts that have not logged off since a given date.

The syntax is:

JSINoLogoff <Drive:>\Folder\OutputFileName.txt \[YYYYMMDD\]

YYYYMMDD is an optional parameter, which defaults to today. If the user's Last Logon Date is earlier, they are reported.

The report format is:

ComputerName        UserName       YYYY MM DD   HH:MM

JSINoLogoff.bat contains:

@echo off
If "%1"<h1><a name="_goto_syntax_if_exist_1_del_q_1_if_2_">"" goto syntax
if exist %1 del /q %1
if "%2"</a></h1>"" goto today
set dte=%2
set XX=%dte:~0,4%
if "%XX%" LSS "1993" goto syntax
set XX=%dte:~4,2%
if "%XX%" LSS "01" goto syntax
if "%XX%" GTR "12" goto syntax
set XX=%dte:~6,2%
if "%XX%" LSS "01" goto syntax
if "%XX%" GTR "31" goto syntax
goto begin
@echo Syntax: JSINoLogoff Output_File \[YYYYMMDD\]
endlocal & goto end
for /f "tokens=1,2,3,4* delims=/ " %%i in ('date /t') do set TDDAY=%%i&set TDMM=%%j&set TDDD=%%k&set TDYY=%%l
set dte=%TDYY%%TDMM%%TDDD%
set output=%1
for /f "Skip=4 Tokens=*" %%i in ('net session') do call :parse "%%i"
endlocal & goto end
set str=%1
set str=%str:"=%
if "%str%"<h1><a name="_The_command_completed_successfully_goto_end_set_user_str_23_20_set_user_user_set_user_user_set_user_user_if_user_">"The command completed successfully." goto end
set user=%str:~23,20%?
set user=%user:  =%
set user=%user: ?=%
set user=%user:?=%
if "%user%"</a></h1>"" goto end
set cn=%str:~0,20%
set /a cnt=0
for /f "Tokens=*" %%i in ('net user "%user%"') do call :parse1 "%%i"
goto end
set /a cnt=%cnt% + 1
set ustr=%1
if %ustr%<h1><a name="_The_command_completed_successfully_goto_end_if_cnt_NEQ_17_goto_end_set_ustr_ustr_set_txt_ustr_29_8_for_f_Tokens_1_3_Delims_i_in_echo_txt_do_set_MM_i_amp_set_DD_j_amp_set_YY_k_if_i_MM_">"The command completed successfully." goto end
if %cnt% NEQ 17 goto end
set ustr=%ustr:"=%
set txt=%ustr:~29,8%
for /f "Tokens=1-3* Delims=/ " %%i in ('@echo %txt%') do set MM=%%i&set DD=%%j&set YY=%%k
if /i "%MM%"</a></h1>"Never" goto end
if "%YY%" GTR "97" goto Y19
set YY=20%YY%
goto mmm
set YY=19%YY%
set /a XX=%MM%
if %XX% LSS 10 set MM=0%XX%
set /a XX=%DD%
if %XX% LSS 10 set DD=0%XX%
set YMD=%YY%%MM%%DD%
if "%YMD%" GEQ "%dte%" goto end
set user=%user%                                #
set user=%user:~0,25%
set txt=%ustr:~33,12%
for /f "Tokens=1,2 Delims= " %%i in ('@echo %txt%') do set hhmm=%%j
@echo %cn%%user% %yy% %mm% %dd% %hhmm% >> %output%