Get List of Inactive Computers

Product Name: Get List of Inactive Computers
Description : RUN THIS ONLY ON ACTIVE DIRECTORY MACHINES
This procedure will get a list of inactive machines on the active directory.
Instructions :
Download attached zip
Import via Agent Procedure Module
Run ONLY against an active directory
Comments
-
This procedure seems to want to pull and write a file called Gather-InactiveComputers.ps1. However, it does not appear to be part of the download. Where can we get this file?
0 -
Hey Larry,
I also saw that so I made the script myself.
Here is what you need in the script since I can't upload a file here.
============================
$DaysInactive = 90
$time = (Get-Date).Adddays(-($DaysInactive))
(Get-ADComputer -Filter {LastLogonTimeStamp -lt $time} -ResultPageSize 2000 -resultSetSize $null -Properties Name, OperatingSystem, SamAccountName, DistinguishedName).Name
===========================
Save it as Gather-InactiveComputers.ps1 in the appropriate location on your VSA, link it to the AP and Bob's your uncle!
0 -
Oh, since its powershell commands, you can tinker around with it as you want. Include date and time stamps and what not. I just needed a flat list of computer names. You could also append further powershell commands and then disable those computers in AD so that if in future, some employee finds an old laptop and wants to use it, all you do is enable the computer again. If no one complains after like 6 months of you disabling the computers found by this script, go ahead and delete those objects to keep your AD clean.
0