What if?
Your switches still show devices that are disconnected. Even when the switch has been rescanned recently.
Switch port connection information on the switch's summary page shows the last associated asset scanned for this switch on that port. Assets are listed to the switch port when the asset is scanned and can be mapped to that switch port.
If devices are moved, devices can still be listed on the old switch if no other asset was scanned and found to be connected to that port.
You can clear old switch connections by clicking the Remove Disconnected Devices button in the left-hand pane of the switch asset Summary page (see screenshot below).
Cleaning all your switches in one go!
If you have many switches in your network, clicking the button for each switch individually is a cumbersome task.
You can run the database script below to clean up all these at once. This script will need to run only once to clean up old connections on all your switches.
To be safe, back up your database before running any scripts. Do not skip this step. Backup instructions can be found here: https://www.lansweeper.com/knowledgebase/backing-up-your-installation/
Stop the following services:
- The Lansweeper server service (on all your scanning servers).
- The web server service on your Lansweeper web server. Your web server service is either World Wide Web Publishing Service (IIS) or IIS Express.
Afterward, open the DatabaseMaintenance.exe tool found under Program Files (x86)\Lansweeper\Tools on your Lansweeper server or use SQL Server Management Studio if your Lansweeper database is hosted on SQL Server.
Copy/paste the script below in the second tab labeled Script Execution, and click Execute.
DELETE tblSNMPAssetMac
FROM tblSNMPAssetMac
INNER JOIN tblAssets On tblSNMPAssetMac.AssetID = tblAssets.AssetID
WHERE tblAssets.Lastseen > tblSNMPAssetMac.LastSeen
Restart your services:
- The Lansweeper server service (on all your scanning servers).
- The web server service on your Lansweeper web server. Your web server service is either World Wide Web Publishing Service (IIS) or IIS Express.