locked
Query from Active Directory RRS feed

  • Question

  • Hi,

     How can i know, which computers in my Active Directory is useless ? (By Query or other method) -MY Active Directory is SERVER 2003

     Thanks.


    Future is mine! ^_^


    Tuesday, December 22, 2015 7:52 AM

Answers

  • DQ Queries sometimes be useful :

    cmd > dsquery computer -inactive 10

    Tuesday, December 22, 2015 9:14 AM

All replies

  • Hi,

     How can i know, which computers in my Active Directory is useless ? (By Query or other method)

     Thanks.


    Future is mine! ^_^

    Hi, I think easiest way with powershell, filter computers, for example inactive 90days, or 60, it depends on your infrastructure.

    import-module activedirectory  
    $domain = "domain.yourdomain.com"  
    $DaysInactive = 90  
    $time = (Get-Date).Adddays(-($DaysInactive)) 
    Get-ADComputer -Filter {LastLogonTimeStamp -lt $time-Properties LastLogonTimeStamp | 
    select-object Name,@{Name="Stamp"; Expression={[DateTime]::FromFileTime($_.lastLogonTimestamp)}} | export-csv OLD_Computer.csv -notypeinformation

    • Proposed as answer by Soh.M Sunday, December 27, 2015 4:34 AM
    Tuesday, December 22, 2015 8:09 AM
  • Hi ,

    Sadegh Sadeghpour

    once you say useless i hope you meant to computers that they  didn't logon for a lot of time 

    you can query active directory in several methods :

    1 :

     Get-ADComputer -Filter * -Properties * | select samaccountname,lastlogondate,lastLogonTimestamp | Ex
    port-csv c:\Computerlastlogon.csv

    2)

    https://gallery.technet.microsoft.com/scriptcenter/Get-Inactive-Computer-in-54feafde


    My Website:www.Pelegit.co.il Mcitp /Mcsa 2012

    • Proposed as answer by Soh.M Sunday, December 27, 2015 4:34 AM
    Tuesday, December 22, 2015 8:13 AM
  • Thanks, But my Active Directory is server 2003

    Future is mine! ^_^

    Tuesday, December 22, 2015 9:04 AM
  • Thanks, But my Active Directory is server 2003

    Future is mine! ^_^

    1) I think u can use "DS QUERY " on cmd : dsquery computer -inactive 10

    It's sample about innactive PC's for 10weeks.

    2) So, second you need to install powershell and enable remote managment.

    http://blogs.technet.com/b/danstolts/archive/2011/03/07/how-to-install-powershell-on-windows-server-2003-and-enable-remote-powershell-management-all-servers-should-have-this-done.aspx



    • Edited by TechSpark0 Tuesday, December 22, 2015 9:13 AM
    Tuesday, December 22, 2015 9:07 AM
  • DQ Queries sometimes be useful :

    cmd > dsquery computer -inactive 10

    Tuesday, December 22, 2015 9:14 AM