cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Question

How do I remove old links for switch ports?

Answer

You can clear old switch connections by clicking the Remove Disconnected Devices button in the left-hand pane of switch asset pages. This button will clear all switch port connections that are older than the last successful scan time of the switch in question. In the Asset column of the Network Interfaces section on switch asset pages, Lansweeper always displays the last asset scanned as connected to that port (or a MAC address if the asset is not in your database).

If you have many switches in your network, this might be a cumbersome task, so what you could also do is run a database script to clean up all your switches at once. We have provided a script below. This script will delete any MAC address in tblSNMPAssetMAC if the Lastseen date for the MAC is earlier than the Lastseen date of the switch. The script will delete this information for all switches, so it must only be run once. To run the script, follow the steps below:

  • To be safe, we recommend performing a database backup before running any scripts. 
  • 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 Service.
  • Afterwards, open the DatabaseMaintenance.exe tool, which can be found under Program Files (x86)\Lansweeper\Tools on your Lansweeper server. Alternatively, you can 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.
  • Restart your services.
DELETE tblSNMPAssetMac 
FROM tblSNMPAssetMac 
INNER JOIN tblAssets On tblSNMPAssetMac.AssetID = tblAssets.AssetID 
WHERE tblAssets.Lastseen > tblSNMPAssetMac.LastSeen
Was this article helpful? Yes No
No ratings

New to Lansweeper?

Try Lansweeper For Free

Experience Lansweeper with your own data.
Sign up now for a 14-day free trial.

Try Now
Version history
Last update:
3 weeks ago
Updated by: