Page 1 of 1 1
Topic Options
#169366 - 2006-10-13 04:54 PM Script to check for active PC's
Nukes Offline
Fresh Scripter

Registered: 2005-11-11
Posts: 11
Loc: Kent - UK
Hi guys,

I have been asked to clean up our domain by running a report to list all inactive PC's. This is because we are going to be sorting out Microsoft SMS 2.0 as it's in a dire state!

I thought maybe running a script to check for active PC's that have been not been logged into in the last 30 days?

Has anyone tried to write a kix script to perform this function?

All help appreicated.

Cheers,

Tom
_________________________
Write down the problem Think real hard Write down the answer

Top
#169367 - 2006-10-13 05:28 PM Re: Script to check for active PC's
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
I think you should search somewhere for LastLogonTimeStamp in Active Directory for every computer, but just cannot find a script....
Top
#169368 - 2006-10-13 05:45 PM Re: Script to check for active PC's
Nukes Offline
Fresh Scripter

Registered: 2005-11-11
Posts: 11
Loc: Kent - UK
Unfortunately we are still running a NT 4.0 domain.

I have found this, see below:

FUNCTION LASTLOGDATE( $Username )
break on
Dim $usr
$usr = GetObject("WinNT://bdc/"+$Username+",user")
$lastlogofb = $usr.LastLogoff
$lastloginb = $usr.LastLogin
? "Last logoff according to bdc = "+$lastlogofb
? "Last logon according to bdc = "+$lastloginb$usr = GetObject("WinNT://pdc/"+$Username+",user")$lastlogofp = $usr.LastLogoff
$lastloginp = $usr.LastLogin
? "Last logoff according to pdc = "+$lastlogofp
? "Last logon according to pdc = "+$lastloginp
ENDFUNCTION

When I run this though nothing is displayed?


Edited by Nukes (2006-10-13 05:47 PM)

Top
#169369 - 2006-10-13 05:56 PM Re: Script to check for active PC's
Gargoyle Offline
MM club member
*****

Registered: 2004-03-09
Posts: 1597
Loc: Valley of the Sun (Arizona, US...
Have a look at this UDF http://www.kixtart.org/ubbthreads/showfl...true#Post146543
Top
#169370 - 2006-10-13 06:27 PM Re: Script to check for active PC's
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
Gargoyle,
Correct me if I am wrong. This only works for Users, not for Computers.

Top
#169371 - 2006-10-13 06:43 PM Re: Script to check for active PC's
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
ja, just like the code nukes has.
Top
#169372 - 2006-10-14 01:04 AM Re: Script to check for active PC's
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Check the Machine Account Password Age.
Top
Page 1 of 1 1


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

Who's Online
0 registered and 1188 anonymous users online.
Newest Members
StuTheCoder, M_Moore, BeeEm, min_seow, Audio
17884 Registered Users

Generated in 0.208 seconds in which 0.013 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