cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
ErikT
Lansweeper Tech Support
Lansweeper Tech Support

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

old-devices-still-connected-to-the-switch.png

 

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.


Was this post helpful? Leave a Kudo!
Did you have a similar issue and a different solution? Share your work in the comments below and help your fellow IT Hero's!
More questions? Browse our  Quick Tech Solutions  or  Community Forum.


If you can't find what you're looking for, create a post in our Community Forum.



1 Comment
Obi_1_Cinobi
Lansweeper Tech Support
Lansweeper Tech Support

Hello there!

Some additional information was requested by our users.

But what to do if your switch is no longer scanned?

If the switch is no longer being scanned, you will have to use another database script to remove the disconnected devices. We recommend the following: 

  • Take a backup before executing database scripts: https://www.lansweeper.com/knowledgebase/backing-up-your-installation/
  • Run the database script below to purge network ports on the switch that is decommissioned:
    • Run the following tool on your Lansweeper server: Program Files (x86)\Lansweeper\Tools\DatabaseMaintenance.exe.
    • Execute the script below in the Script Execution tab of the DatabaseMaintenance.exe tool.
    • Copy and paste the code and hit the Execute SQL Code button. Make sure to replace the assetID in the script with the assetID of the switch you would like to purge. You can find the correct assetID to use in the script, by looking at the address bar of your browser when opening the asset web page of the affected switch.

AssetIDAssetID

    • Do note that the script below is only needed if the switch is no longer scanned, otherwise you can use the Remove Disconnected Devices button on the switch asset page (or the script that was provided in the initial forum post).

 

Delete from tblSNMPassetMac where assetID = 20

 

New to Lansweeper?

Try Lansweeper For Free

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

Try Now