N-central Troubleshooting
How to find inactive computers on a windows domain
Last Modified
Mon Mar 13 19:07 GMT 2017
Description
The 'Agent Check-In Greater Than 30 Days' filter in N-able N-central in the All Devices View will show you all the N-able N-central agents that are no longer communicating with N-able N-central . It can be a challenge to determine whether the device has been decomissioned. This article contains a powershell script that will query the Active Directory for computers that have not logged into the domain in 30 days. This can then be used as a guide for deleteing the devices from N-able N-central .Environment
Windows Active DirectoryN-able N-central all versions
Solution
Save the following script in Notepad 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
###########################
# 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
###########################
Login to N-able N-central
Select SO > Configuration > Scheduled Tasks > Script/Software Repository
Select Add > Scripting
Fill out the fields as below
Select Add > Scripting
Fill out the fields as below
Name: Get Inactive Computers from AD
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
Command Line Parameters: GetInactiveComputers.ps1
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
Command Line Parameters: GetInactiveComputers.ps1
Execute this script on a domain controller from the All Devices View.
Put a check beside the Domain Controller in the All Devices View
Select Add Task > Run a Script
Enter GetInactiveComputers.ps1 in the Repository Item field.
Select the Notifications tab
Select Success, Failure AND Send task output file in Email
Add your account to the Selected Recipients list
Select Save
Select Add Task > Run a Script
Enter GetInactiveComputers.ps1 in the Repository Item field.
Select the Notifications tab
Select Success, Failure AND Send task output file in Email
Add your account to the Selected Recipients list
Select Save
N-able N-central will email you 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.
Delete the de-comissioned devices in N-able N-central .