Locate inactive devices
Computers that have not connected to N-able N-central for an extended period of time may be decommissioned or have other issues that need addressing. To see a list of what devices have been offline for a while, use the filter Agent Check-In Greater Than 30 Days in the All Devices view. This displays all agents that are not in communication with N-able N-central.
From that list, you need to determine if the device has been decommissioned. Use a Powershell script, shown below, to query the Active Directory for the computers listed from the above filter.
Powershell script
Copy and paste the script below into a text editor and save it as GetInactiveComputers.ps1.
########################
# 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 = (Get-WmiObject Win32_ComputerSystem).Domain
$DaysInactive = 30
$time = (Get-Date).Adddays(-($DaysInactive))
# Output hostname
"Domain: $domain"
# 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
###########################
Upload the script
Upload the new script to the N-able N-central repository.
- Click Configuration > Scheduled Tasks > Script/Software Repository.
- Click Add > Scripting.
- Complete the following fields:
- Click OK.
Name: Get Inactive Computers from Active Directory
Description: Run this script on the Domain Controller to output a list of computers that have not logged into the domain in over 30 days.
File Name: GetInactiveComputers.ps1. Browse and upload the file.
Command Line Parameters: GetInactiveComputers.ps1
N-able N-central uploads the script file to its repository. You can now add a run script task with the script to identify computers that have not logged in for some time.
Run the script
Execute this script on a domain controller.
- Click Actions > Run a Script.
- In the Location drop-down menu, select From MSP N-central Script Repository.
- Locate the script file from the Repository Item drop-down menu.
- Click the Schedule tab and select when to run the script.
- Click the Notifications tab and click Success, Failure and Send task output file in Email.
- Select the recipients for the notification N-able N-central sends when the script completes.
- Click Save.
N-able N-central runs the script and emails the recipient a list of computers that have not logged into the Windows domain in over 30 days. Compare this list to the Agent Check-In Greater Than 30 Days filtered All Devices view.
This can then be used as a guide for deleting the devices from N-able N-central.