I have scripted IOff.bat to schedule a user log off after nnn minutes of inactivity, on all the domain workstations.

IOff.bat uses PsShutdown.exe, which it will copy to each workstation. To schedule the task, IOff.bat uses SchTasks.exe, which is built into Windows XP, Windows Server 2003, and later. It is best to run IOff.bat from Windows XP, or Windows Server 2003, while logged on as a member of the Domain Admins group, but you could run it from your Windows 2000 workstation if you implement tip 5335.

The syntax for using IOff.bat is:

IOff IdleMinutes folder

Where IdleMinutes is the number of minutes, between 1 and 999, that the user must be idle before they are logged off, and folder is the path to  PsShutdown.exe on the workstation that runs IOff.bat. PsShutdown.exe will be copied to this path on all the workstations. If folder does NOT exist on a member computer, it will be created.

NOTE: IOff.bat does NOT schedule the IOff task on the workstation that runs IOff.bat.

NOTE: IOff.bat uses NETDOM.EXE to enumerate domain workstations. NETDOM.EXE is built into Windows XP and later, or installed on the Windows 2000 computer that runs IOff.bat, from the Support Tools on the operating system CD-ROM.

IOff.bat contains:

                              @echo off                              if \{%2\}==\{\} @echo Syntax: IOff IdleMinutes folder&goto :EOF                              setlocal                              set wrk=%1                              set /a IM=1000%wrk%%%1000                              if "%wrk%" NEQ "%IM%" @echo Syntax: IOff %wrk% not valid, 1-999&endlocal&goto :EOF                              if %IM% LSS 1 @echo Syntax: IOff %wrk% not valid, 1-999&endlocal&goto :EOF                              if %IM% GTR 999 @echo Syntax: IOff %wrk% not valid, 1-999&endlocal&goto :EOF                              set folder=%2                              set lcl=%folder%                              set lcl=%lcl:"=%                              if not exist %folder% @echo IOff - %folder% NOT found.&endlocal&goto :EOF                              set folder=%folder::=$%                              set folder=%folder:"=%                              set fnd1=findstr /V /I /L /C:"List of workstations with accounts in the domain:"                              set fnd2=findstr /V /I /L /C:"The command completed successfully."                              set fnd3=findstr /V /I /L /C:"%ComputerName%"                              for /f "Tokens=*" %%c in ('netdom query WORKSTATION /DOMAIN:%USERDNSDOMAIN%^|%fnd1%^|%fnd2%^|%fnd3%') do (                               set computer=%%c                               call :doit                              )                              endlocal                              goto :EOF                              :doit                              if not exist \\%computer%\c$ @echo %computer% NOT available&goto :EOF                              if not exist \\%computer%\%folder% MD \\%computer%\%folder%                              call :cpy>nul 2>&1                              call :sch                              goto :EOF                              :cpy                              copy %lcl%\PsShutDown.exe \\%computer%\%folder%\*.*                              goto :EOF                              :sch                              @echo SCHTASKS.exe /Create /RU "SYSTEM" /SC ONIDLE /I %IM% /TN "IOff" /TR "%lcl%\PsShutdown.exe -O -F" /S %computer%                              SCHTASKS.exe /Create /RU "SYSTEM" /SC ONIDLE /I %IM% /TN "IOff" /TR "%lcl%\PsShutdown.exe -O -F" /S %computer%