Weekly Tip 9

Save stale computer objects in AD as a variable:

import-module activedirectory
$date = (get-date).adddays(-120)
$comps = get-adcomputer -SearchBase “” -properties * -Filter ‘lastlogondate -lt $date

You can grab specific information, such as object name, by changing the last line to:
$comps = (get-adcomputer -SearchBase “” -properties * -Filter ‘lastlogondate -lt $date).Name

Share:

Facebook
Twitter
LinkedIn
Picture of Matt Tinney

Matt Tinney

Professional IT executive & business leader having decades of experience with Microsoft technologies delivering modern-day cloud & security solutions.

Contact Us

Please enable JavaScript in your browser to complete this form.
Name
=
On Key

More Posts

Be assured of everything

Get WME Services

Stay ahead of the competition with our Professional IT offerings.

Please enable JavaScript in your browser to complete this form.
=