JSI Tip 3433. How can I mass update the logon script name and other properties?

In Windows NT 4.0, you could use tip 0198 to alter a property for all the users.

Active Directory Users and Computers has no such functionality. To perform mass maintenance in Windows 2000, you must use a script.

NOTE: You can also use a script for Windows NT 4.0.

In tip 3410, I scripted JSIDUGet..bat, to retrieve all the user names in a domain and pass them to a standard or custom reporting script. You can use this capability to perform mass maintenance.

If you wanted to change the logon script name for every active user in your domain:

JSIDUGet Full_Path_To_YourBat.bat C:\Folder\logonscript.log

where Full_Path_To_YourBat.bat contains:

@echo off
If "%Final%" EQU "Y" goto end
if "%actv%" EQU "N" goto end
net user "%UserAcnt%" /scriptpath:<Your script name> /domain  
@echo "%UserAcnt%" >>%file%

To prevent salespersons from logging on between 01:00AM and 06:00 A.M on Sundays:
@echo off
If "%Final%" EQU "Y" goto end
if "%actv%" EQU "N" goto end
If %max% LSS 19 goto end
set sales=N
for /l %%i in (19,1,%max%) do call :parse %%i
if "%sales%" EQU "N" goto end
net user "%UserAcnt%" /times:Su,1AM-6AM /domain
set fullname=%line02:~29,50%
set work=%UserAcnt%                      #
set user=%work:~0,20%
@echo %User% %fullname% >>%file%
goto end
if "%sales%" EQU "Y" goto end
set lne=%1
for /f "Tokens=2 Delims==" %%j in ('set line%lne%') do @set line=%%j
if "%line:~29,6%" EQU "*Sales" set sales=Y&goto end
if "%line:~51,6%" EQU "*Sales" set sales=Y

NOTE: See tip 2815 for help with the 'net user' command.

Hide 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.