Community FAQ
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
PTWIT
Engaged Sweeper II
Hi there

Here is a Powershell script to backup Lansweeper with SQL Compact and IIS Express. Just modify Set-Location field and run the script to backup Lansweeper.




## 1. Stop the Lansweeper Server service
Stop-Service lansweeperservice

## 2. Stop web server service. Your web server service is either World Wide Web Publishing Service (IIS) or IIS Express.
Stop-Service IISExpressSVC

## 3. Create a copy of your SQL Compact database file, which is: Program Files (x86)\Lansweeper\SQLData\lansweeperdb.sdf
Set-Location \\IAPPS\LanSweeper\Backup
$backupPath=New-Item -Type directory $(Get-Date -Format dd-MM-yyyy-hh-mm-ss)
Copy-Item "C:\Program Files (x86)\Lansweeper\SQLData" -Destination $backuppath -Recurse

## 4. Create a copy of all subfolders located in: Program Files (x86)\Lansweeper\Website
## *** Copy just the subfolders found under Website. Don't copy the entire Website folder, as it contains a configuration file that references your current database. ***
## *** Restoring this file could lead to issues when moving your installation from one server to another. ***
Copy-Item "C:\Program Files (x86)\Lansweeper\Website" -Destination $backuppath -Recurse

## Delete all files in the Website directory only (ignoring sub-dirs):
Remove-Item "$backupPath\Website\*.*" | Where { ! $_.PSIsContainer }

## 5. If it exists, create a copy of the following file as well: Program Files (x86)\Lansweeper\Key\Encryption.txt
Copy-Item "C:\Program Files (x86)\Lansweeper\Key" -Destination $backupPath -Recurse

## 6. Restart Lansweeper and web server services.
Start-Service lansweeperservice
Start-Service IISExpressSVC

0 REPLIES 0

Archive

This board contains archived posts from the retired Lansweeper Forum and Insiders Community.

New to Lansweeper?

Try Lansweeper For Free

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

Try Now