Skip navigation

JSI Tip 1284. Report "missing" user data.

In tip 1252, JSIUsersBig produced a report all user data elements. JSIUMD produces a similar report if one or more user data elements are "missing."

In tip 1252, JSIUsersBig produced a report all user data elements.

JSIUMD produces a similar report if one or more user data elements are "missing". The syntax for using JSIUMD.bat is:

JSIUMD <Drive:>\Folder\ReportFile.txt \[/FN\] \[/C\] \[/UC\] \[/PE\] \[/PR\] \[/UCP\] \[/W\] \[/LS\] \[/UP\] \[/HD\] \[/LH\] \[/LG\] \[/GG\]

where at least one switch must be specified. You may specify as many switches as you wish. The switches have the following meaning:

Switch  M e a n i n g  /FN  Full Name is missing.  /C  Comment is missing.  /UC  User Comment is missing.  /PE  Password never expires.  /PR  Password is not required.  /UCP  The User may not change their passowrd.  /W  The user may logon at any workstation.  /LS  Logon Script is missing.  /UP  The User Profile path is missing.  /HD  The Home Directory path is missing.  /LH  There are no Logon Hours restrictions.  /LG  The user is not a member of any Local Group.  /GG  The user is not a member of any Global Group. 

JSIUMD.bat contains:

@echo off
if NOT "%1"

"" goto begin :syntax @echo Syntax: JSIUMD File goto end :begin setlocal set file=%1 if exist %file% del /q %file% if "%2"

"" goto syntax :switch shift if "%1"

"" goto check if /i "%1"

"/fn" set sfn=%1&goto switch if /i "%1"

"/c" set sc=%1&goto switch if /i "%1"

"/uc" set suc=%1&goto switch if /i "%1"

"/pe" set spe=%1&goto switch if /i "%1"

"/pr" set spr=%1&goto switch if /i "%1"

"/ucp" set sucp=%1&goto switch if /i "%1"

"/w" set sw=%1&goto switch if /i "%1"

"/ls" set sls=%1&goto switch if /i "%1"

"/up" set sup=%1&goto switch if /i "%1"

"/hd" set shd=%1&goto switch if /i "%1"

"/lh" set slh=%1&goto switch if /i "%1"

"/lg" set slg=%1&goto switch if /i "%1"

"/gg" set sgg=%1&goto switch goto syntax :check @echo ____________%sfn% %sc% %suc% %spe% %spr% %sucp% %sw% %sls% %sup% %shd% %slh% %slg% %sgg%______________________ >> %file% @echo * >> %file% set prev=ZZZZZZZZZZZZ for /f "Skip=4 Tokens=*" %%i in ('net users') do call :parse "%%i" endlocal goto end :parse set str=#%1# set str=%str:#"=% set str=%str:"#=% if "%str%"

"The command completed successfully." goto end set substr=%str:~0,25%# set substr=%substr: =% set substr=%substr: #=% set substr=%substr:#=% if "%substr%"

"" goto end set /a cnt=0 for /f "Tokens=*" %%i in ('net user "%substr%"') do call :parse1 "%%i" set substr=%str:~25,25%# set substr=%substr: =% set substr=%substr: #=% set substr=%substr:#=% if "%substr%"

"" goto end set /a cnt=0 for /f "Tokens=*" %%i in ('net user "%substr%"') do call :parse1 "%%i" set substr=%str:~50,25%# set substr=%substr: =% set substr=%substr: #=% set substr=%substr:#=% if "%substr%"

"" goto end set /a cnt=0 for /f "Tokens=*" %%i in ('net user "%substr%"') do call :parse1 "%%i" goto end :parse1 set /a cnt=%cnt% + 1 set ustr=%1 if %ustr%

"The command completed successfully." goto end set ustr=%ustr:"=% if %cnt% GTR 18 goto parse2 goto tst%cnt% :tst1 set lh=N goto end :tst2 if /i not "%sfn%"

"/fn" goto end if /i not "%ustr:~29,1%"

"" goto end goto out :tst3 if /i not "%sc%"

"/c" goto end if /i not "%ustr:~29,1%"

"" goto end goto out :tst4 if /i not "%suc%"

"/uc" goto end if /i not "%ustr:~29,1%"

"" goto end goto out :tst9 if /i not "%spe%"

"/pe" goto end if /i not "%ustr:~29,5%"

"Never" goto end goto out :tst11 if /i not "%spr%"

"/pr" goto end if /i not "%ustr:~29,2%"

"No" goto end goto out :tst12 if /i not "%sucp%"

"/ucp" goto end if /i not "%ustr:~29,2%"

"No" goto end goto out :tst13 if /i not "%sw%"

"/sw" goto end if /i not "%ustr:~29,3%"

"All" goto end goto out :tst14 if /i not "%sls%"

"/ls" goto end if /i not "%ustr:~29,1%"

"" goto end goto out :tst15 if /i not "%sup%"

"/up" goto end if /i not "%ustr:~29,1%"

"" goto end goto out :tst16 if /i not "%shd%"

"/hd" goto end if /i not "%ustr:~29,1%"

"" goto end goto out :tst17 goto end :tst18 set lh=Y if /i not "%slh%"

"/lh" goto end if /i not "%ustr:~29,3%"

"All" goto end goto out :parse2 if "%ustr:~0,1%"

"*" goto end set ln="%ustr:~0,8%" if %ln%

"Local Gr" set ln=N&goto tstlg if %ln%

"Global G" set ln=N&goto tstgg goto end :tstlg if /i not "%slg%"

"/lg" goto end if /i not "%ustr:~29,1%"

"" goto end goto out :tstgg if /i not "%sgg%"

"/gg" goto end if /i not "%ustr:~29,1%"

"" goto end :out if "%substr%"

"%prev%" goto end set prev=%substr% set substr=%substr%# set substr=%substr: #=% set substr=%substr:#=% for /f "Tokens=*" %%i in ('net user "%substr%"') do call :parse3 "%%i" goto end :sep @echo * >> %file% @echo ____________%sfn% %sc% %suc% %spe% %spr% %sucp% %sw% %sls% %sup% %shd% %slh% %slg% %sgg%______________________ >> %file% @echo * >> %file% goto end :logon set lh=Y goto out1 :parse3 set ustr=%1 if %ustr%

"The command completed successfully." goto sep set ustr=%ustr:"=% if "%ustr%"

"" goto end if "%ustr:~0,1%"

"*" set ustr=%ustr% set ln="%ustr:~0,8%" if %ln%

"User nam" set lh=N if %ln%

"Logon ho" goto logon if "%lh%"

"N" goto out1 if %ln%

"Local Gr" set ln=N&goto out1 if %ln%=="Global G" set ln=N&goto out1 set ustr= %ustr% :out1 @echo %ustr% >> %file% :tst5 :tst6 :tst7 :tst8 :tst10 :end

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish