Hello,
I used this script within Intune in the end, and it worked perfectly. Hope it helps
!/bin/bash
# --- Configuration ---
AGENT_URL="https://content.lansweeper.com/lsagent-mac/" # Replace with the latest LsAgent URL
AGENT_DMG="/tmp/LsAgent-osx.dmg"
AGENT_MOUNTPOINT="/Volumes/LsAgent"
INSTALL_SCRIPT="/Volumes/LsAgent/LsAgent-osx.app/Contents/MacOS/installbuilder.sh"
SERVER_ADDRESS="" # Replace with your Lansweeper server address
SERVER_PORT="9524" # Replace with your Lansweeper server port
AGENT_KEY="" # Replace with your Lansweeper agent key
# --- Download and Mount ---
echo "Downloading LsAgent..."
curl -L "$AGENT_URL" -o "$AGENT_DMG"
echo "Mounting LsAgent DMG..."
hdiutil attach "$AGENT_DMG" -mountpoint "$AGENT_MOUNTPOINT" -nobrowse
# --- Install ---
echo "Running LsAgent installer..."
sudo bash "$INSTALL_SCRIPT" --server "$SERVER_ADDRESS" --port "$SERVER_PORT" --agentkey "$AGENT_KEY" --mode unattended
# --- Cleanup ---
echo "Unmounting LsAgent DMG..."
hdiutil detach "$AGENT_MOUNTPOINT"
rm -f "$AGENT_DMG"
echo "Installation complete."