N-central Help

Locate inactive computers

Computers that have not connected to SolarWinds 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 SolarWinds 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 SolarWinds N-central repository.

  1. Click Configuration > Scheduled Tasks > Script/Software Repository.
  2. Click Add > Scripting.
  3. Complete the following fields:
  4. 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

    Command Line Parameters: GetInactiveComputers.ps1

  5. Click OK.

SolarWinds 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.

  1. Click ActionsRun a Script.
  2. In the Location drop-down menu, select From MSP N-central Script Repository.
  3. Locate the script file from the Repository Item drop-down menu.
  4. Click the Schedule tab and select when to run the script.
  5. Click the Notifications tab and click Success, Failure and Send task output file in Email.
  6. Select the recipients for the notification SolarWinds N-central sends when the script completes.
  7. Click Save.

SolarWinds 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 SolarWinds N-central.