→ Celebrate SysAdmin Day 2024 with Lansweeper Enter our Giveaway here

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
thq1981
Engaged Sweeper II

This is a command I use to deploy LsAgent from internet setup link rather from a package share:

curl -o LsAgent-windows.exe "https://cdn.lansweeper.com/download/10.0.1/1/LsAgent-windows.exe"&&LsAgent-windows.exe --mode unattended --server "YOUR_LANSWEEPER_FQDN" --agentkey "YOUR_LANSWEEPER_AGENT_CLOUDRELAY_KEY"

I will try to find a powershell command for the same.

3 REPLIES 3
thq1981
Engaged Sweeper II

Dear CyberShot, thank you for your input, please note that you need to mention full path in the Start-Process command, otherwise you will get the below message:

thq1981_0-1677732469926.png

Here is a few changes in your command for better result, also I replaced the direct static link with the dynamic link for LsAgent which works fine under PowerShell:

Invoke-WebRequest -Uri "https://content.lansweeper.com/lsagent-windows/" -OutFile "C:\Windows\TEMP\LsAgent-windows.exe"; Start-Process -FilePath "C:\Windows\TEMP\LsAgent-windows.exe" -ArgumentList "--mode unattended --server YOUR_LANSWEEPER_FQDN --agentkey YOUR_LANSWEEPER_AGENT_CLOUDRELAY_KEY" -Wait

Although the downloaded file is working correctly.

 

Thanks Dude, I asked ChatGPT to write the script, I tested that it was downloading etc, but not that it ran as we deploy via a Lansweeper report and our MDT Build process.

CyberCitizen
Honored Sweeper

Not heavily tested as we don't use it this way, but this should work as a powershell script.

Invoke-WebRequest -Uri "https://cdn.lansweeper.com/download/10.0.1/1/LsAgent-windows.exe" -OutFile LsAgent-windows.exe; Start-Process -FilePath "LsAgent-windows.exe" -ArgumentList "--mode unattended --server YOUR_LANSWEEPER_FQDN --agentkey YOUR_LANSWEEPER_AGENT_CLOUDRELAY_KEY" -Wait