Presentation of API Lansweeper

Web-API Patch Reporting Lansweeper

A few days ago I had to write a microservice for a project that provides data from Lansweeper as JSON format. The code is clear that there is only one function. However, the API could also be of interest to others, since this data can easily be further processed via the API (e.g. with PowerShell, Python, JavaScript etc.). A database access or authentication is spared. The microservice only delivers data, so writing data in Lansweeper is not possible (and also not provided).

The API is open source and can be obtained from GitHub.

The API Lansweeper is currently used by me for

  • Patch management dashboard
  • PowerShell script to compare Active Directory, WSUS and Lansweeper

Example script

This sample script provides information on all computers including installed software, OS, user and CPU

$response = Invoke-WebRequest -Uri "http://localhost:85/api/Values"  # Hier URL zu API-Lansweeper hinterlegen
$data = ConvertFrom-Json $([String]::new($response.Content))
$data | Out-GridView

Lansweeper Web API Example


  1. The installation of API Lansweeper is quite simple. You only need a Windows server (Recommended 2016/2019). Install the IIS role including all application development features (ASP.Net/.Net 4.5 etc.) on this. Download and install Web Deploy 3.6 from Microsoft.

  2. Open your IIS and make sure your default website is called "Default Web Site". If this is not the case, please rename it. It doesn't matter which port you use.

  3. On my GitHub repository you will find a folder with releases. Download the current API-LS-WebDeploy.7z package here and unpack it on your server on which you want to install the API. There is a CMD file in the extracted folder. Open an administrative CMD and use "cd" to navigate to the path in which you unzipped the zip file. Then run the .cmd file with the /Y parameter to install the API.

  4. After installation, change to the web root directory of the page (C:/inetpub/wwwroot). There you will find the application you just installed and a web.config file. In this file, replace the "ConnectionString" key with the connection data to the lansweeper database (this must run on at least one SQLExpress). Save the change.

  5. If you now navigate to the website with your browser and write /api/values ​​behind it, you should receive data in JSON format. Example

In practice it could look like this:

Lansweeper Web API Example Edition

Please support this project

I always try to create useful content and try to publish my applications for free as Open Source Code. If you use this in production, please be so kind and support my work through a donation by Patreon or github. The donation helps me to cover my server / hardware and electricity costs. thank you!

Previous Post Next Post

Add a comment