Automatically Suspend a User Account

  • Thread starter Thread starter Yowler
  • Start date Start date
Y

Yowler

Gday All

Was wondering if any of you professionals out there would know how to
get XP to Automatically disable/suspend a User account after a period
of Inactivity i.e. 30 days.

The PC in question is not on a Network (standalone PC). But we have
several users using this PC in a business related area.

Thanks for your help in advance.
 
Yowler said:
Gday All

Was wondering if any of you professionals out there would know how to
get XP to Automatically disable/suspend a User account after a period
of Inactivity i.e. 30 days.

The PC in question is not on a Network (standalone PC). But we have
several users using this PC in a business related area.

Thanks for your help in advance.

I'm not aware of any such function but you could do it yourself
like so:
1. Place the batch file "netlogon.bat" into the Startup subfolder of
the "All Users" profile folder. It should have these lines:
@echo off
if not exist c:\Logs md c:\Logs
echo %date% %time% %UserName% > "c:\Logs\%UserName%.log"
Its purpose is to create a log file each time a user logs on.

2. Create the batch file "c:\Tools\Audit.bat" like so:
Line1 @echo off
Line2 dir "%UserProfile%\.." /b /ad | find /i /v "Administrator" | find /i
/v "All Users" | find /i /v "Default User" > c:\Users.tmp
Line3
Line4 for /F %%a in (c:\users.tmp) do (
Line5 c:\tools\xxcopy /db#31 /L c:\Logs\%%a.log" c:\ | find /i "no
files" && goto :eof
Line6 net user "%%a" /active:no
Line7 )

Line2 will compile a list of all current profiles, i.e. of all
users. It will exclude system profiles. Add more exclusions
if necessary.

Line5 will check if the the user has logged on during the past
31 days. You can download xxcopy.exe from several sites.

Line6 will suspend the account if he has not.

3. Run these commands from the Command prompt to "prime"
the pump:
md c:\Logs
cd /d "%UserProfile%\.."
for /d %a in (*.*) do echo. > "c:\Logs\%a.log"

4. Create a scheduled task that runs c:\Tools\Audit.bat once
every 24 hours.
 
Back
Top