JSI Tip 1252. Report of all users' User Manager settings.


Using only standard commands, I have scripted two batch jobs.

JSIUsersBIG <Drive:>\Folder\ReportFile.txt produces a report with all user data elements, even if the data element is null or the default. Here is a small sample:

User name                    test10 
Full Name                    User Test10 
Comment                      User Test10 
User's comment               User Comment 
Country code                 000 (System Default) 
Account active               Yes 
Account expires              Never 
Password last set            04/21/1999 06:30 
Password expires             05/31/1999 06:30 
Password changeable          04/21/1999 06:30 
Password required            Yes 
User may change password     Yes 
Workstations allowed         JSI00000000001,JSI00000000002,JSI000000000003
Logon script                 jsi 
User profile                  
Home directory                
Last logon                   04/11/1999 09:12 
Logon hours allowed          Sunday 06:00 - 18:00 
                             Monday 06:00 - 19:00 
                             Tuesday 06:00 - 19:00 
                             Tuesday 23:00 - Wednesday 00:00 
                             Wednesday 06:00 - 20:00 
                             Wednesday 22:00 - Thursday 20:00 
                             Thursday 21:00 - Friday 00:00 
                             Friday 06:00 - 21:00 
                             Friday 22:00 - Saturday 00:00 
                             Saturday 08:00 - Sunday 00:00 
Local Group Memberships       
Global Group memberships     *Domain Users          
_______________________________________________________________________________________________ 
                                                                                              * 
User name                    test11 
Full Name                    User Test11 
Comment                       
User's comment                
Country code                 000 (System Default) 
Account active               Yes 
Account expires              Never 
Password last set            04/21/1999 06:30 
Password expires             05/31/1999 06:30 
Password changeable          04/21/1999 06:30 
Password required            Yes 
User may change password     Yes 
Workstations allowed         All 
Logon script                  
User profile                  
Home directory                
Last logon                   04/12/1999 08:10
Logon hours allowed          Wednesday 22:00 - Thursday 06:00 
                             Friday 06:00 - 22:00 
Local Group Memberships       
Global Group memberships     *Domain Users          
_______________________________________________________________________________________________ 
                                                                                              * 
I prefer using JSIUsers <Drive:>\Folder\ReportFile.txt, which eliminates most null and default elements, as in the following sample:
User name                    test10 
Full Name                    User Test10 
Comment                      User Test10 
User's comment               User Comment 
Password last set            04/21/1999 06:22 
Password expires             05/31/1999 06:22 
Password changeable          04/21/1999 06:22 
Workstations allowed         JSI00000000001,JSI00000000002,JSI000000000003
Logon script                 jsi 
Last logon                   04/11/1999 09:12 
Logon hours allowed          Sunday 06:00 - 18:00 
                             Monday 06:00 - 19:00 
                             Tuesday 06:00 - 19:00 
                             Tuesday 23:00 - Wednesday 00:00 
                             Wednesday 06:00 - 20:00 
                             Wednesday 22:00 - Thursday 20:00 
                             Thursday 21:00 - Friday 00:00 
                             Friday 06:00 - 21:00 
                             Friday 22:00 - Saturday 00:00 
                             Saturday 08:00 - Sunday 00:00 
Global Group memberships     *Domain Users          
_______________________________________________________________________________________________ 
                                                                                              * 
User name                    test11 
Full Name                    User Test11 
Password last set            04/21/1999 06:22 
Password expires             05/31/1999 06:22 
Password changeable          04/21/1999 06:22 
Last logon                   04/12/1999 08:10 
Logon hours allowed          Wednesday 22:00 - Thursday 06:00 
                             Friday 06:00 - 22:00 
Global Group memberships     *Domain Users          
_______________________________________________________________________________________________ 
                                                                                              * 
JSIUsersBIG.bat contains:
@echo off
if NOT "%1"

"" goto begin :syntax @echo Syntax: JSIUsersBIG File goto end :begin setlocal set file=%1 if exist %file% del /q %file% 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 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 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 for /f "Tokens=*" %%i in ('net user "%substr%"') do call :parse1 "%%i" goto end :sep @echo _______________________________________________________________________________________________ >> %file% @echo * >> %file% goto end :logon set lh=Y goto out :parse1 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 out if %ln%

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

"Global G" set ln=N&goto out set ustr= %ustr% :out @echo %ustr% >> %file% :end

JSIUsers.bat contains:
@echo off
if NOT "%1""" goto begin
:syntax
@echo Syntax: JSIUsers File 
goto end
:begin
setlocal
set file=%1
if exist %file% del /q %file%
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 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 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 for /f "Tokens=*" %%i in ('net user "%substr%"') do call :parse1 "%%i" goto end :sep @echo _______________________________________________________________________________________________ >> %file% @echo * >> %file% goto end :logon set lh=Y :work if "%ustr:~29,3%"

"All" goto end goto out1 :acc if "%ustr:~29,3%"

"Yes" goto end if "%ustr:~29,3%"

"Nev" goto end goto out1 :pass if "%ustr:~29,3%"

"Yes" goto end goto out1 :ctry if "%ustr:~29,3%"

"000" goto end goto out1 :parse1 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 %ln%

"Workstat" goto work if %ln%

"Account " goto acc if %ln%

"Password" goto pass if %ln%

"User may" goto pass if %ln%

"Country " goto ctry if "%lh%"

"N" goto out if %ln%

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

"Global G" set ln=N&goto out set ustr= %ustr% :out if "%ustr:~29,1%"=="" goto end :out1 @echo %ustr% >> %file% :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