→ Upcoming Keynote Event - Introducing Lansweeper's 2023 Spring Release: 'Duvel' - Learn More

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

Lansweeper data, reports and settings are stored in a database. Your database is hosted in either the Microsoft SQL LocalDB, Microsoft SQL Server or the deprecated Microsoft SQL Compact database server.

If your database is hosted in SQL Server, you can move it to a different machine or different SQL Server if at some point required.

If it's hosted in SQL Compact or SQL LocalDB, only moving the database and not the other Lansweeper components is not possible. SQL Compact and SQL LocalDB databases can only be accessed by services running locally on the server, so all Lansweeper components must be present on the same machine and moved simultaneously when these database servers are used. If you are unsure which database server you are using, you can verify using the ConfigEditor tool or in the Lansweeper web console.

This article only explains how to move the database, and only applies to databases hosted in SQL Server. If you are trying to move all Lansweeper components (scanning service, database and web console) to another machine, follow these instructions instead. More information on components and how they interact can be found in this knowledge base article.

Move a SQL Server database to different server or SQL Server instance

  1. Stop the Lansweeper Server service in Windows Services.procedure-stopping-the-lansweeper-service.jpg
  2. Stop your web server service in Windows Services. Keep in mind that this will log everyone out of the console. Your web server service is either IIS Express or World Wide Web Publishing Service (IIS).procedure-stopping-the-web-server-service.jpg
  3. Back up your database by right-clicking lansweeperdb in SQL Server Management Studio and selecting Tasks > Back Up... in the menu. If SQL Server Management Studio isn't installed on your Lansweeper server, we recommend downloading it online.Moving-your-database-to-a-different-server-2.jpgMoving-your-database-to-a-different-server-3.jpg
    • Database: lansweeperdb
    • Backup type: Full
    • Backup component: Database
    • Name: make sure this is something other than lansweeperdb, to avoid overwriting your existing database.
    • In the Options tab, you can tick Verify Backup When Finished to check the integrity of the backup file.
  4. Download the latest Lansweeper installer and run it on your new database server. For Lansweeper Classic installations, use the below command.
    Starting from Lansweeper 10.5, the /classic parameter is no longer required to install the classic version of Lansweeper.
  5. Configure the wizard exactly as shown below. This will install a default Lansweeper database in the SQL Server instance specified by you.Moving-your-database-to-a-different-server-4.jpg
    Don't try to manually create the database. Let the installer do this for you.
  6. Restore your database backup on your new server by right-clicking the lansweeperdb database in SQL Server Management Studio and selecting Tasks > Restore> Database... in the menu. Make sure you've selected the correct destination (lansweeperdb) and source for the restore operation and that "Overwrite the existing database" is checked in the Options tab. Select Ok to restore the database.Moving-your-database-to-a-different-server-5.jpgMoving-your-database-to-a-different-server-6.jpg
    Make sure the overwrite box is checked. Otherwise, the following error may be generated:
    The backup set holds a backup of a database other than the existing 'lansweeperdb' database.
  7. Execute the script below in SQL Server Management Studio to reset the lansweeperuser SQL login used by the Lansweeper service and web console to connect to the database. Replace 'lansweeperuserpassword' with the password (keep the single quotes) you want to use for the lansweeperuser login, leaving the single quotes in the script.



/* Makes sure there are no objects in the lansweeperuser schema, so the lansweeperuser SQL user can be reset */

USE lansweeperdb; 
FOR SELECT 'ALTER SCHEMA dbo TRANSFER lansweeperuser.' + name + ';'
    FROM sys.objects
    WHERE SCHEMA_NAME(SCHEMA_ID) = 'lansweeperuser';
        EXEC (@SQLStmt);

/* Resets the lansweeperuser SQL user */

USE lansweeperdb; 

DROP SCHEMA lansweeperuser; 

DROP USER lansweeperuser; 

EXECUTE sp_droplogin 


EXEC sp_addlogin 

USE lansweeperdb; 

EXEC sp_grantdbaccess 

EXEC sp_addrolemember 



Don't skip this step. Restoring a database backup almost always corrupts the SQL user used by the Lansweeper service and web console to connect to the database. If you don't reset the user, the service and web console will be unable to connect to the database.
  1. Run the ConfigEditor tool, found at Program Files (x86)\Lansweeper\Tools\ConfigEditor.exe on the servers hosting your Lansweeper Server service and web console.menu-configeditor.jpg
  2. Click through any warnings the tool may be giving you about your password being incorrect.
  3. Select the Data Source field, select Edit and submit the name of your new SQL Server instance.
  4. Select the Password field, select Edit and submit the same password you previously used in the database script.procedure-configeditor-service-password-change.jpg
  5. If the ConfigEditor tool has multiple tabs due to your server hosting multiple Lansweeper components, select the other tabs, click through any warnings and repeat the password and instance changing process.procedure-configeditor-website-password-change.jpg
  6. Select Save configs and restart service. You've now successfully migrated your SQL Server database.procedure-configeditor-save-and-restart.jpg

Was this post helpful? Select Yes or No below!
Did you have a similar issue and a different solution? Or did you not find the information you needed? Create a post in our Community Forum for your fellow IT Heroes!
More questions? Browse our Quick Tech Solutions.

Was this article helpful? Yes No
No ratings

New to Lansweeper?

Try Lansweeper For Free

Test Drive Lansweeper Yourself. Explore our interactive Demo or sign up for free 14-day trial.

Try Now
Knowledge Base Dashboard
Article Dashboard
Version history
Last update:
Updated by: