Lansweeper
Sweepy
Search our knowledgebase

How to move Lansweeper to a different server

Last updated on July 28 2016

To find out what kind of database you are using and where it is located, go to Configuration -> Database scripts in the web console.

SQL Server

  1. Stop the Lansweeper service on your current setup.
  2. Stop the service of whichever web server you are currently using: World Wide Web Publishing Service (IIS) or IIS Express.
  3. Take a full backup of your lansweeperdb database using SQL Server Management Studio.
  4. Back up the Program Files (x86)\Lansweeper\Key\Encryption.txt file on your Lansweeper server.
  5. If you added any custom images to Lansweeper or uploaded documents, you may want to copy these files as well. Custom images and docs can be found in Program Files/Lansweeper/Website/actions, Program Files/Lansweeper/Website/Docs and Program Files/Lansweeper/Website/userpictures.
  6. Do a full installation of Lansweeper on your new setup. Our latest installer can be found here.
  7. Stop the Lansweeper service on the new server.
  8. Stop the service of whichever web server you are using on your new server: World Wide Web Publishing Service (IIS) or IIS Express.
  9. Do a restore of the database backup and overwrite the lansweeperdb database on the new server.
  10. Execute the below script in SQL Server Management Studio.
    This will ensure that the SQL user for your Lansweeper database is configured correctly.
--Makes sure there are no objects in the lansweeperuser schema, so the lansweeperuser SQL user can be reset
USE lansweeperdb
GO
DECLARE c_ALTSCHEMA CURSOR FOR
SELECT 'ALTER SCHEMA dbo TRANSFER lansweeperuser.'+name +';'
FROM sys.objects
WHERE SCHEMA_NAME(SCHEMA_ID) = 'lansweeperuser'
DECLARE @SQLStmt NVARCHAR(200)
OPEN c_ALTSCHEMA
FETCH NEXT FROM c_ALTSCHEMA INTO @SQLStmt
WHILE @@FETCH_STATUS = 0
BEGIN
EXEC(@SQLStmt)
FETCH NEXT FROM c_ALTSCHEMA INTO @SQLStmt
END
CLOSE c_ALTSCHEMA
DEALLOCATE c_ALTSCHEMA
GO

--Resets the lansweeperuser SQL user
USE lansweeperdb
GO
DROP SCHEMA lansweeperuser
GO
DROP USER lansweeperuser
GO
EXECUTE sp_droplogin lansweeperuser
GO

USE MASTER
GO
EXEC sp_addlogin 'lansweeperuser', 'Mysecretpassword0*', 'lansweeperdb', [English]
GO

USE lansweeperdb
GO
EXEC sp_grantdbaccess 'lansweeperuser', 'lansweeperuser'
GO
EXEC sp_addrolemember [db_owner], 'lansweeperuser'
GO
  1. In your Lansweeper configuration files make sure that the Data Source, User ID and Password correspond with your SQL Server settings.
    The config files are: Program Files (x86)\Lansweeper\Service\Lansweeperservice.exe.config and Program Files (x86)\Lansweeper\Website\web.config
  2. Execute the below script in SQL Server Management Studio. Replace “newserver” with the NetBIOS name of your new scanning server and "oldserver" with the NetBIOS name of the old server.

use lansweeperdb
GO

update tsysasservers set servername='newserver' where servername ='oldserver'
GO
update tblassets set scanserver='newserver' where scanserver='oldserver'
GO

  1. Copy your Encryption.txt file and any custom images and docs from your old setup to your new one and restart the Lansweeper and web server services on your new server.
  2. In the web console, go to Configuration -> Assetpages (http://newserver/Configuration/AssetPages). Update the field Action Path with the name of your new server.

SQL Compact

  1. Stop the Lansweeper service on your current setup.
  2. Stop the service of whichever web server you are currently using: World Wide Web Publishing Service (IIS) or IIS Express.
  3. Back up the Program Files (x86)\Lansweeper\Key\Encryption.txt file on your Lansweeper server.
  4. Back up your SQL Compact database. (Copy the file \Lansweeper\SQLDATA\lansweeperdb.sdf)
  5. If you added any custom images to Lansweeper or uploaded documents, you may want to copy these files as well. Custom images and docs can be found in Program Files/Lansweeper/Website/actions, Program Files/Lansweeper/Website/Docs and Program Files/Lansweeper/Website/userpictures.
  6. Do a full installation of Lansweeper on your new setup. Our latest installer can be found here.
  7. Stop the Lansweeper service on the new server.
  8. Stop the service of whichever web server you are using on your new server: World Wide Web Publishing Service (IIS) or IIS Express.
  9. Restore the database backup onto the new server, overwriting the database created by the setup, and restart the web server service.
  10. Execute the below script in your Lansweeper web console under Configuration/Database Scripts.
    Replace “newserver” with the name of your new scanning server.

update tsysasservers set servername='newserver'
GO
update tblassets set scanserver='newserver'
GO

  1. Copy your Encryption.txt file and any custom images and docs from your old setup to your new one and restart the Lansweeper and web server services on your new server.
  2. In the web console, go to Configuration -> Assetpages (http://newserver/Configuration/AssetPages). Update the field Action Path with the name of your new server.