1

I'm planning a domain migration and I would to understand which computer objects are up and running. Already tried the command “dsquery computer domainroot -stalepwd” but I still have some doubts with the output. Does anyone have any other suggestion?

Thanks in advance!

JFA

1 Answer 1

0

Assuming PowerShell scripts are acceptable, here's one courtesy of Matt Vogt.

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

# Gets time stamps for all computers in the domain that have NOT logged in since after specified date 
# Mod by Tilo 2013-08-27 
import-module activedirectory  
$domain = "domain.mydom.com"  
$DaysInactive = 90  
$time = (Get-Date).Adddays(-($DaysInactive)) 

# Get all AD computers with lastLogonTimestamp less than our time 
Get-ADComputer -Filter {LastLogonTimeStamp -lt $time} -Properties LastLogonTimeStamp | 

# Output hostname and lastLogonTimestamp into CSV 
select-object Name,@{Name="Stamp"; Expression={[DateTime]::FromFileTime($_.lastLogonTimestamp)}} | export-csv OLD_Computer.csv -notypeinformation

Change the $domain value to your domain, and $DaysInactive to any length of time you'd like.

3
  • PowerShell scripts are acceptable but my point is; can i assume that if computer/servers didn't logged in for more 30 days they are not up and running?
    – jffalmeida
    Jul 26, 2016 at 6:29
  • I think the lastLogonTimestamp that the script is analyzing just tells you the last time someone logged into the system. It doesn't tell you whether or not the system is on or off. And it wouldn't be able to tell you if the system is running a script via scheduled task or serving up a web page or anything like that.
    – sippybear
    Jul 26, 2016 at 19:00
  • but @sippybear does this mean there is no option if a computer object is up and running?
    – jffalmeida
    Jul 27, 2016 at 20:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .