Solved

How to find computer accounts that haven´t "logged in" for 3 months?

Posted on 2004-08-26
3
704 Views
Last Modified: 2012-05-05
Hi experts

A simple (?) question for you.
Is there a way to select computer inactive computer accounts i a 2003 based AD.
I need to clean up computer accounts that has not been accessing the AD for a while.

Thank you all!
/Danne_sweden
0
Comment
Question by:danne_sweden
3 Comments
 
LVL 1

Expert Comment

by:webmar45
ID: 11900396
hi here's a script i use,
you need to look for the password adge property, computers change their password every 30 days, so when the password age is 120 day's you know thats this is an old computer,
to delete computers, your the output and delete them manually
martin


Dim Container
Dim TargetDomain
Dim Member
Dim Computer
TargetDomain = "yourdomain"
Set Container = GetObject("WinNT://" & TargetDomain)
Container.Filter = Array("Computer")
For Each Member In Container
     Set Computer = GetObject("WinNT://" & TargetDomain & "/" & Member.Name
& "$,user")
     If Computer.Get("PasswordAge") > 5184000 Then      '60 Days
       Mem = Computer.ADSPath
       Secs = Computer.Get("PasswordAge")
         PWAge = Secs / 86400            '86400 Seconds per Day
    wscript.echo Mem & " " & Int(PWAge)
    End If
Next
0
 
LVL 9

Accepted Solution

by:
SamuraiCrow earned 500 total points
ID: 11900486
Use DSQuery to make these changes:

http://www.microsoft.com/windowsxp/home/using/productdoc/en/default.asp?url=/windowsxp/home/using/productdoc/en/dsquery.asp

This tool is built into 2003.  You can run simple queries from the command line and then pipe them into DSMod command:

http://www.microsoft.com/windowsxp/home/using/productdoc/en/default.asp?url=/windowsxp/home/using/productdoc/en/dsmod.asp

Below is an example of disabling all domain computer that haven't been on the network for 25 weeks:

dsquery computer -inactive 25|dsmod computer -disabled yes

Check out the links for more info on the DS family of commands here:

http://www.microsoft.com/windowsxp/home/using/productdoc/en/default.asp?url=/windowsxp/home/using/productdoc/en/ds_command_line_tools.asp

Good luck, I hope this helps
Crow
0
 

Author Comment

by:danne_sweden
ID: 11901385
Thanks webmar and Samurai.

I did it using DSQuery ..

Danne_sweden
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Recently, I had the need to build a standalone system to run a point-of-sale system. I’m running this on a low-voltage Atom processor, so I wanted a light-weight operating system, but still needed Windows. I chose to use Microsoft Windows Server 200…
ADCs have gained traction within the last decade, largely due to increased demand for legacy load balancing appliances to handle more advanced application delivery requirements and improve application performance.
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question