MacOS command line not passing %COMPUTERNAME%

OESTech
OESTech Posts: 3
edited May 2023 in General questions

Hi,

I've managed to get the custom host installed on MacOS remotely using Jamf.  The second part is using command line to associate it with our group, enable remote access, and name the alias.  I'm using the example direct from the teamviewer web site on how to do this.  The command is:

sudo /Applications/TeamViewerHost.app/Contents/Helpers/TeamViewer_Assignment assign YES -api-token 12345678 -group "Some Group" -alias %COMPUTERNAME% -grant-easy-access 

Everything works except for the "-alias %COMPUTERNAME%" switch.  This computer gets added to my group with the name %COMPUTERNAME%.  Does anyone have a solution for this?

Capture.JPG

Best Answer

Answers

  • Scotty
    Scotty Posts: 493 Staff member 🤠

    Hi @OESTech 

    Thanks for posting.

    I found where you copied the error from our Command Line Parameters article
    This has been corrected and I am sorry for the confusion.

    This section of the script is not something set by TeamViewer.
    This is a variable and how it is written depends on what you are using to run it.
    %COMPUTERNAME% is an environment varible used in Windows command line.

    In OSX, you are probably looking for a '$' variable.
    Examples:
    $USER
     - will use the username of the person currently signed in
    $HOSTNAME - Uses the current device name

    sudo /Applications/TeamViewerHost.app/Contents/Helpers/TeamViewer_Assignment assign YES -api-token 12345678 -group "Some Group" -alias $HOSTNAME -grant-easy-access 

    I hope this resolves this for you.

    All the best,
    Scotty

    Senior Moderator
    Did my reply answer your question? Why not accept it as a solution to help others?