Using only native commands, JSILLD.bat produces a sorted/formated report of Users who have not logged on since YYYYMMDD.

The report is sorted by UserName and list the user's full name and last logon date.

The syntax for using JSILLD.bat is:

JSILLD <Drive:>\Folder\OutputFile.Ext YYYYMMDD \[/N\]

where:

YYYYMMDD will report all users who have not logged on since this date.

/N                   is an optional parameter that will bypass users who have never logged on.

JSILLD.bat contains:

@echo off
setlocal
if \{%2\}<h1><a name="_goto_syntax_if_3_">\{\} goto syntax
if "%3"</a></h1>"" goto begin
if /i "%3"<h1><a name="_n_goto_begin_syntax_echo_Syntax_JSILLD_File_yyyymmdd_N_endlocal_goto_EOF_begin_if_i_2_">"/n" goto begin
:syntax
@echo Syntax: JSILLD File yyyymmdd \[/N\]
endlocal
goto :EOF
:begin
if /i "%2"</a></h1>"/n" goto syntax
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
set never=X
if /i "%3"<h1><a name="_n_set_never_n_set_file_1_if_exist_file_del_q_file_for_f_Skip_4_Tokens_i_in_net_user_domain_findstr_v_c_findstr_v_i_c_The_command_completed_do_do_call_parse_i_endlocal_goto_EOF_parse_set_str_#_1#_set_str_str_#_set_str_str_#_set_substr_str_0_25_#_set_substr_substr_set_substr_substr_#_set_substr_substr_#_if_substr_">"/n" set never=/n
set file=%1
if exist %file% del /q %file%
for /f "Skip=4 Tokens=*" %%i in ('net user /domain^|findstr /v /c:"----"^|findstr /v /i /c:"The command completed"') do (
 do call :parse "%%i"
)
endlocal
goto :EOF
:parse
set str=#%1#
set str=%str:#"=%
set str=%str:"#=%
set substr=%str:~0,25%#
set substr=%substr:  =%
set substr=%substr: #=%
set substr=%substr:#=%
if "%substr%"</a></h1>"" goto :EOF
for /f "Skip=1 Tokens=*" %%i in ('net user "%substr%" /domain') do call :parse1 "%%i"
set substr=%str:~25,25%#
set substr=%substr:  =%
set substr=%substr: #=%
set substr=%substr:#=%
if "%substr%"<h1><a name="_goto_EOF_for_f_Skip_1_Tokens_i_in_net_user_substr_domain_do_call_parse1_i_set_substr_str_50_25_#_set_substr_substr_set_substr_substr_#_set_substr_substr_#_if_substr_">"" goto :EOF
for /f "Skip=1 Tokens=*" %%i in ('net user "%substr%" /domain') do call :parse1 "%%i"
set substr=%str:~50,25%#
set substr=%substr:  =%
set substr=%substr: #=%
set substr=%substr:#=%
if "%substr%"</a></h1>"" goto :EOF
for /f "Skip=1 Tokens=*" %%i in ('net user "%substr%" /domain') do call :parse1 "%%i"
goto :EOF
:parse1
set ustr=%1
if %ustr%<h1><a name="_The_command_completed_successfully_goto_EOF_set_ustr_ustr_if_i_ustr_0_9_">"The command completed successfully." goto :EOF
set ustr=%ustr:"=%
if /i "%ustr:~0,9%"</a></h1>"Full Name" set fullname=%ustr:~29,99%
if /i not "%ustr:~0,10%"<h1><a name="_Last_logon_goto_EOF_set_txt_ustr_29_99_for_f_Tokens_1_2_3_Delims_i_in_echo_txt_do_set_MM_i_amp_set_DD_j_amp_set_YY_k_if_i_MM_">"Last logon" goto :EOF
set txt=%ustr:~29,99%
for /f "Tokens=1,2,3 Delims=/ " %%i in ('@echo %txt%') do set MM=%%i&set DD=%%j&set YY=%%k
if /i "%MM%"</a></h1>"Never" goto tstnvr
goto year
:tstnvr
if /i "%never%"=="/n" goto :EOF
goto report
:year
if "%YY%" GTR "1000" goto mmm
if "%YY%" GTR "92" goto Y19
set /a YY=100%YY%%%100
set YY=%YY% + 2000
goto mmm
:Y19
set YY=19%YY%
:mmm
set /a XX=100%MM%%%100
if %XX% LSS 10 set MM=0%XX%
set /a XX=100%DD%%%100
if %XX% LSS 10 set DD=0%XX%
set YMD=%YY%%MM%%DD%
if "%YMD%" GEQ "%dte%" goto :EOF
:report
set fullname=%fullname%                                                    #
set fullname=%fullname:~0,35%
set substr=%substr%                                                        #
set substr=%substr:~0,30%
@echo %substr% %fullname% %txt% >> %file%