Nov 04, 2016
Teaching a System Center Configuration Manager class a couple of weeks ago I was asked if there was a PowerShell command to find dead or stale computers in Active Directory.
Often computers are removed from a domain and rejoined after a new build with a new name, new operating system etc., and cleaning the account out of AD is missed. In general a computer resets is computer account password every 30 days, so if this has not been done for a period of time such as 90 to 120 days we can use the steps below in PowerShell to find the dead/stale computers.
- Ensure the Active Directory module for PowerShell is installed, if not, in the PowerShell command shell run Import-Module ActiveDirectory
- Create Variable below
- Run the command below
This will create an output with the below information
- DistinguishedName
- DNSHostName
- Enabled
- Name
- ObjectClass
- ObjectGUID
- PasswordLastSet
- SamAccountName
- SID
Which can then be used to delete or remove the offending machines.
For more information, check out our PowerShell training courses.
How do your Excel skills stack up?
Test NowNext up:
- 3 TED Talks on the importance of failure
- Designing your organisation’s training programs
- Why do I need to run a Preflight in InDesign?
- The power of creation at your fingertips
- What is the price of connectivity?
- Geek Time is back baby!
- Document management in Exchange Server 2016
- SharePoint 2016 Newsfeeds
- HR automation: Supercharge your performance reviews
- Updates to Angular 2 that make coding easier – Router Component
Previously
- Am I using PowerPoint effectively?
- Dreamweaver CC – Pop up thumbnails of image and colour filenames
- Troubleshooting startup issues in Windows 10
- Create a chart with a secondary axis in Excel 2016
- PowerShell Basics series – PowerShell Blog Index
- Finally, technology proves the benefits of face-to-face interaction
- Master Document in Word – Part 1
- OneDrive to rule them all
- Seven steps to modifying employee behaviour
- Define and solve a problem by using Excel Solver