Page 1 of 1 1
Topic Options
#101649 - 2003-05-29 03:44 PM Script to disable inactive users
daltilio Offline
Fresh Scripter

Registered: 2003-05-27
Posts: 20
[Moderator (Sealeopard): Moved thread from 'Scripts' to 'General' forum due to lack of script in body]

I am trying to find a way to disable domain users after a period of inactivity, say 30 days. I figured kix would be able to do it. Does anyone know how I could does this with a script?

Thanks.
Brian

[ 29. May 2003, 16:05: Message edited by: sealeopard ]
_________________________
Brian

Top
#101650 - 2003-05-29 04:12 PM Re: Script to disable inactive users
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Check the eventlogs of all DCs for the last login time for the specific user. You can use the ReadEventlog() UDF for this. Then use any of the date math routines to determine how many days ago the last login happened.

In an AD environment, you can also check the LastLogin property of the user object, not sure whether this also works in an NT domain.
code:
' VBScript
on error resume next
set oDomain = GetObject("WinNT://DOMAIN")
WScript.echo "Domain : " + oDomain.name
for each oDomainItem in oDomain
if oDomainItem.Class = "User" then
WScript.echo "UserName=" + oDomainItem.Name + "Last login=" + formatdatetime(oDomainItem.LastLogin)
end if
next

And please do a Google search for this as it shows you ways to accomplish this.

[ 29. May 2003, 16:35: Message edited by: sealeopard ]
_________________________
There are two types of vessels, submarines and targets.

Top
#101651 - 2003-05-29 04:21 PM Re: Script to disable inactive users
daltilio Offline
Fresh Scripter

Registered: 2003-05-27
Posts: 20
Thank you.

BTW, I did look on google and had trouble finding an useable info, that is why I posted.

--------------
Brian
_________________________
Brian

Top
Page 1 of 1 1


Moderator:  Arend_, Allen, Jochen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 580 anonymous users online.
Newest Members
Sir_Barrington, batdk82, StuTheCoder, M_Moore, BeeEm
17886 Registered Users

Generated in 0.026 seconds in which 0.011 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org