For Windows 2003/2008
(Must be 2003 Native domain or newer)
In a Command Prompt window type:
For Windows 2008 R2+
In a PowerShell window type:
NOTE: This post needs some work to get it exactly the way I would use it, but the necessary commands in here should be roughly correct.
For more detail or a better example (of which this is basically a cut and paste at the moment), see reference site below.
References:
http://blog.mattvogt.net/powershell-last-logon-timestamp-for-single-ho
(Must be 2003 Native domain or newer)
In a Command Prompt window type:
dsquery computer -inactive <num>Where <num> is the minimum number of weeks the device has been inactive for. Advice seems to be to use at least 2, as anything less than that is not fully reliable.
For Windows 2008 R2+
In a PowerShell window type:
$time=Read-host "Enter a date in format mm/dd/yyyy"then
Get-ADComputer -Filter * | Get-ADObject -Properties lastlogontimestamp | where {(([DateTime]::FromFileTime($_.lastlogontimestamp) - ([system.datetime]$time)).totaldays) -lt 0 } |
NOTE: This post needs some work to get it exactly the way I would use it, but the necessary commands in here should be roughly correct.
For more detail or a better example (of which this is basically a cut and paste at the moment), see reference site below.
References:
http://blog.mattvogt.net/powershell-last-logon-timestamp-for-single-ho