Lansweeper Agent (LsAgent-osx.dmg)

SKizale
New Contributor III

Hello,

Does anyone have a working method to install LsAgent-osx.dmg on computers with Jamf Pro and configure it with an agentkey? With no luck, I have tried making packages, scripts, and numerous other things, including Installomator. The only time the install works and the Mac communicates with our lsagentrelay is when I manually install the DMG, and even then, when I manually run LSAgent in the Application folder, I see an error that says "Configuration could not be updated: Access to the path '/Applications/LansweeperAgent/lsagentconfiguration.xml' is denied." Despite that error, it successfully communicates with Lansweeper. 

Any help would be appreciated, as I've tried everything I've found online so far. 

Thanks,

Steve

1 ACCEPTED SOLUTION

mojo21221
Contributor II

Im sure this could be cleaned up a little, but it works for us as is.. I have scrubbed out our data and replaced with **** so all you have to do is replace those stars with the data from your LS server, port and agent key. Run the script on said machine no need to upload or deal with packages dmgs etc..

 

#!/bin/zsh

# disk image
 
fileURL="https://content.lansweeper.com/lsagent-mac/"

# Specify name of downloaded disk image

LsAgent_dmg="/tmp/LsAgent-osx.dmg"

# Download the latest LSAgent software disk image

	/usr/bin/curl -L --output "$LsAgent_dmg" "$fileURL"

    # Specify a /tmp/LsAgent mountpoint for the disk image
 
    TMPMOUNT=`/usr/bin/mktemp -d /tmp/LsAgent`

    # Mount the latest LsAgent disk image to /tmp/LsAgent mountpoint
 
    hdiutil attach "$LsAgent_dmg" -mountpoint "$TMPMOUNT" -nobrowse -noverify -noautoopen
    


	# Install LsAgent from the installer package stored inside the disk image

	"/tmp/LsAgent/LsAgent-osx.app/Contents/MacOS/installbuilder.sh" --server ****** --port **** --agentkey ************ --prefix /usr/local/LsAgent --mode unattended
	
    sleep 30
	
    # Clean-up
 
    # Unmount the LsAgent disk image from /tmp/LsAgent
 
    /usr/bin/hdiutil detach "$TMPMOUNT"
 
    # Remove the /tmp/LsAgent mountpoint
 
    /bin/rm -rf "$TMPMOUNT"

    # Remove the downloaded disk image

    /bin/rm -rf "$LsAgent_dmg"
    
    exit 0

 

View solution in original post

3 REPLIES 3

mojo21221
Contributor II

Im sure this could be cleaned up a little, but it works for us as is.. I have scrubbed out our data and replaced with **** so all you have to do is replace those stars with the data from your LS server, port and agent key. Run the script on said machine no need to upload or deal with packages dmgs etc..

 

#!/bin/zsh

# disk image
 
fileURL="https://content.lansweeper.com/lsagent-mac/"

# Specify name of downloaded disk image

LsAgent_dmg="/tmp/LsAgent-osx.dmg"

# Download the latest LSAgent software disk image

	/usr/bin/curl -L --output "$LsAgent_dmg" "$fileURL"

    # Specify a /tmp/LsAgent mountpoint for the disk image
 
    TMPMOUNT=`/usr/bin/mktemp -d /tmp/LsAgent`

    # Mount the latest LsAgent disk image to /tmp/LsAgent mountpoint
 
    hdiutil attach "$LsAgent_dmg" -mountpoint "$TMPMOUNT" -nobrowse -noverify -noautoopen
    


	# Install LsAgent from the installer package stored inside the disk image

	"/tmp/LsAgent/LsAgent-osx.app/Contents/MacOS/installbuilder.sh" --server ****** --port **** --agentkey ************ --prefix /usr/local/LsAgent --mode unattended
	
    sleep 30
	
    # Clean-up
 
    # Unmount the LsAgent disk image from /tmp/LsAgent
 
    /usr/bin/hdiutil detach "$TMPMOUNT"
 
    # Remove the /tmp/LsAgent mountpoint
 
    /bin/rm -rf "$TMPMOUNT"

    # Remove the downloaded disk image

    /bin/rm -rf "$LsAgent_dmg"
    
    exit 0

 

SKizale
New Contributor III

This worked perfectly! The only modifications I made were removing --server and --port (just using a relay server for our Macs), and I added another "-" in front of agentkey. I'm guessing one of the dashes was accidentally deleted when you removed your port number. Thanks a bunch for taking the time to share this with me, @mojo21221. I really appreciate it!

Steve

For sure, happy to help! Now if LS would only update their tool to allow for the Login item to be locked down in Ventura... You were correct. One of the dashes was accidentally removed. I updated the original response to reflect the additional "-".