Dsquery computer
Hi, I have stupid problem,I use the "dsquery computer -inactive 4" command, but nothing happen.no error no result.I know there are some inactive computer but I can`t get the query. Am I using a wrong command!!!!!!!?
November 14th, 2010 2:26am

Hello, to get you correct, you are not searching for disabled accounts, instead you mean accounts that are not used over 4 weeks? There is a difference between disabled and inactive Here is also a script doing that job: http://gallery.technet.microsoft.com/ScriptCenter/en-us/6b8163d1-5fae-43b5-a664-a2d1f6e1e2daBest regards Meinolf Weber Disclaimer: This posting is provided "AS IS" with no warranties or guarantees , and confers no rights.
Free Windows Admin Tool Kit Click here and download it now
November 14th, 2010 7:04am

Yes,I looking for computer accunts that are not used over 4 weeks.and thanks for the script.but why is that command dose not work?
November 14th, 2010 11:13am

Maybe you don’t have any computer within that range. Did you try with different “inactive” value? Here are some examples: http://portal.sivarajan.com/2010/03/delete-stale-or-inactive-computer.html Santhosh Sivarajan | MCTS, MCSE (W2K3/W2K/NT4), MCSA (W2K3/W2K/MSG), CCNA, Network+ Houston, TX Blogs - http://blogs.sivarajan.com/ Articles - http://www.sivarajan.com/publications.html Twitter: @santhosh_sivara - http://twitter.com/santhosh_sivara This posting is provided AS IS with no warranties, and confers no rights.
Free Windows Admin Tool Kit Click here and download it now
November 14th, 2010 11:38am

I have 120 client and 163 object in computer container,yes I did use them. the interesting part is I have problem only with " -inactive " other syntax work corectly.
November 14th, 2010 11:56am

Are they really inactive? Santhosh Sivarajan | MCTS, MCSE (W2K3/W2K/NT4), MCSA (W2K3/W2K/MSG), CCNA, Network+ Houston, TX Blogs - http://blogs.sivarajan.com/ Articles - http://www.sivarajan.com/publications.html Twitter: @santhosh_sivara - http://twitter.com/santhosh_sivara This posting is provided AS IS with no warranties, and confers no rights.
Free Windows Admin Tool Kit Click here and download it now
November 14th, 2010 2:02pm

Yes,as I said my network only had 120 clients. I`m thinking somting wrong with the OS or registery or ...
November 14th, 2010 2:07pm

I understand that you have 120 client computers. But how do you know they are not active? Santhosh Sivarajan | MCTS, MCSE (W2K3/W2K/NT4), MCSA (W2K3/W2K/MSG), CCNA, Network+ Houston, TX Blogs - http://blogs.sivarajan.com/ Articles - http://www.sivarajan.com/publications.html Twitter: @santhosh_sivara - http://twitter.com/santhosh_sivara This posting is provided AS IS with no warranties, and confers no rights.
Free Windows Admin Tool Kit Click here and download it now
November 14th, 2010 8:23pm

because,I have 163 object in computer container.
November 15th, 2010 3:42am

Hello, which functional level do you use in the domain?Best regards Meinolf Weber Disclaimer: This posting is provided "AS IS" with no warranties or guarantees , and confers no rights.
Free Windows Admin Tool Kit Click here and download it now
November 15th, 2010 5:10am

Windows server 2003
November 15th, 2010 10:09am

Mahyar, The dsquery computer –inactive 4 command will return all inactive (stale) computer objects. If you don’t have any stale computers it won’t display any information. I believe all 163 computer accounts are active. Santhosh Sivarajan | MCTS, MCSE (W2K3/W2K/NT4), MCSA (W2K3/W2K/MSG), CCNA, Network+ Houston, TX Blogs - http://blogs.sivarajan.com/ Articles - http://www.sivarajan.com/publications.html Twitter: @santhosh_sivara - http://twitter.com/santhosh_sivara This posting is provided AS IS with no warranties, and confers no rights.
Free Windows Admin Tool Kit Click here and download it now
November 15th, 2010 10:23am

I`m sure,I only have 120 computer in this network and there is no laptop or anything else.
November 15th, 2010 10:42am

Run this @echo off SETLOCAL EnableDelayedExpansion FOR /F "skip=1 tokens=1-4 delims= " %%a IN ('DSQuery * domainroot -Filter "(&(objectclass=computer))" -Attr Name LastLogonTimeStamp -limit 200') DO ( FOR /F "tokens=3-4 delims=-( " %%w IN ('%systemroot%\system32\w32tm /ntte %%b') DO SET tmpLLTS=%%w FOR /F "tokens=3-4 delims=-( " %%x IN ('%systemroot%\system32\w32tm /ntte %%c') DO SET tmpPLT=%%x FOR /F "tokens=4-4 delims=-( " %%y IN ('%systemroot%\system32\w32tm /ntte %%b') DO SET tmpLLLTS=%%y FOR /F "tokens=4-4 delims=-( " %%z IN ('%systemroot%\system32\w32tm /ntte %%c') DO SET tmpPLLT=%%z FOR /F "tokens=5-5 delims=-( " %%t IN ('%systemroot%\system32\w32tm /ntte %%b') DO SET tmpPLLLT=%%t ECHO %%a !tmpLLTS! !tmpPLT! !tmpLLLTS! !tmpPLLT! !tmpPLLLT! ) (credit to BinaryGuy http://social.technet.microsoft.com/Forums/en/ITCG/thread/19d35656-2be4-4665-822e-34c111e07da2 ) That will give you the object name, and the lastLoginTimeStamp value. From there we should be able to see if there really are old objects, or they are indeed active.
Free Windows Admin Tool Kit Click here and download it now
November 15th, 2010 5:15pm

Hi Mahyar, Thanks for posting here. You may like double confirm if there are over 4 weeks inactive computers exist in your environment by using other utilities . In addition with the script that SJB99 provided , I‘d like you also take look AcctInfo.dll , a utility form Account Lockout and Management Tools and will help you to verify the last active time stamp of a domain object , and OldCmp utility , it will also help you to disable or delete the objects that inactive over a specific time. For more information please refer to the links below: Account Lockout and Management Tools http://www.microsoft.com/downloads/en/details.aspx?FamilyId=7AF2E69C-91F3-4E63-8629-B999ADDE0B9E&displaylang=en For how to install and use AcctInfo.dll please refer to the article below: Account Lockout Tools http://technet.microsoft.com/en-us/library/cc738772(WS.10).aspx For downloading and learning how to use oldcmp please refer to the link below: OldCmp http://www.joeware.net/freetools/tools/oldcmp/index.htm Thanks. Tiger LiPlease remember to click Mark as Answer on the post that helps you, and to click Unmark as Answer if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
November 16th, 2010 1:41am

thank you all,thank you. thanks Tiger for these tools,it was really helpful. I`m gonna work with these information,I`ll tell the result later.
Free Windows Admin Tool Kit Click here and download it now
November 16th, 2010 3:58am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics