Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - Re: script to read disabled and enabled computer for 180 days inactive

Reply
 
Old 03-05-2009   #1 (permalink)
Richard Mueller [MVP]


 
 

Re: script to read disabled and enabled computer for 180 days inactive

Jack wrote:
Quote:

> Is there a vb script to read the ActiveDirectory of
>
> * all the computers for 180 days inactive
> * show me the computers they are disabled and enabled.
> * lastlogon of the computer
>
> it must be in one script
>
You can use Joe Richards' free oldcmp utility to find inactive computers:

http://www.joeware.net/freetools/tools/oldcmp/index.htm

To find disabled computers (or enabled) you can use ADO in a VBScript
program. See this link:

http://www.rlmueller.net/ADOSearchTips.htm

The filter for disabled computers would be:

strFilter = "(&(objectCategory=computer)" _
& "(userAccountControl:1.2.840.113556.1.4.803:=2))"



For enabled computers:



strFilter = "(&(objectCategory=computer)" _

& "(!userAccountControl:1.2.840.113556.1.4.803:=2))"



If your domain is at Windows 2003 functional level you can use the
lastLogonTimeStamp attribute of the computer object. If your domain is not
at this functional level, you must query every Domain Controller in the
domain to find the largest lastLogon value, because this attribute is not
replicated. It's easier to use oldcmp. If your really need the lastLogon
value for all computers, you can modify this program:



http://www.rlmueller.net/Last%20Logon.htm



This program documents lastLogon for all users in the domain. To modify it
for computers instead, replace this filter:



strFilter = "(&(objectCategory=person)(objectClass=user))"


with this:



strFilter = "(objectCategory=computer)"


The page I linked above also has a link to a program to document
lastLogonTimeStamp. That program can also be modified for computers (instead
of users) in the same way.


--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--
--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--



My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
VSync - Recommended enabled or disabled? Gaming
Script Must Be Enabled Error But It Is Enabled Vista General
Inactive printer-checking script PowerShell
SLi enabled, or disabled. Gaming
UAC slowing down startup both enabled and disabled... Vista performance & maintenance


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46