Access denied when attempting to join host to account with script

I'm having issues with a script that installs a custom TeamViewer MSI, then joins the host to the corporate account.

The install part goes fine, I then have a pause for 20 seconds as it seems to take this long for Teamviewer to connect to the internet and create the "assignmentdata.json" file.

After this I call the Teamviewer_assignment.exe with the switches required, but i get access denied on the "assignmentdata.json".

This is using the local administrator account.Capture.PNG

Comments

  • Nfoster
    Nfoster Posts: 53 ✭✭

    Nicktuf, can you share your script? I have had this issue as well and between you and me mayble we can both come up with a soluition. I have made some wrapped MSIs around the assignment tool and modified the tables within to include the API token commands. IT works fine as as deployable MSI but I find that the timing can be an issue.

  • nicktuf
    nicktuf Posts: 8
    msiexec.exe /i "\\ws12-arc01\public\Deploy\TeamViewer\TeamViewerMSI\TeamViewer_Host-idcmcyxapk.msi" /passive
    mkdir C:\Setup
    copy "\\ws12-arc01\public\Deploy\TeamViewer\TeamViewer_Host_Assignment\Win\TeamViewer_Assignment.exe" C:\Setup
    TIMEOUT /T 20 /NOBREAK
    C:\Setup\TeamViewer_Assignment.exe -apitoken xxx-xxxxxx -datafile "C:\Program Files (x86)\TeamViewer\AssignmentData.json" -devicealias "${COMPUTERNAME}-NEW"
    pause

    Here is the script, I originally ran the TeamViewier_assignment.exe right from the network drive but copied it locally in an attempt to resolve the access denied error, but both failed.

    The pause at the end is just to let me see the error before the window closes.

  • nicktuf
    nicktuf Posts: 8

    Here is the script:

    msiexec.exe /i "\\ws12-arc01\public\Deploy\TeamViewer\TeamViewerMSI\TeamViewer_Host-idcmcyxapk.msi" /passive
    mkdir C:\Setup
    copy "\\ws12-arc01\public\Deploy\TeamViewer\TeamViewer_Host_Assignment\Win\TeamViewer_Assignment.exe" C:\Setup
    TIMEOUT /T 20 /NOBREAK
    C:\Setup\TeamViewer_Assignment.exe -apitoken 1234-abcd -datafile "C:\Program Files (x86)\TeamViewer\AssignmentData.json" -devicealias "${COMPUTERNAME}-NEW"
    pause

    I initialy had the TeamViewer_Assignment.exe run right from the network drive, but changed it to run locally in an attempt to bypass the access denied error, but it is still the same.

  • W_deFazio
    W_deFazio Posts: 22 Staff member 🤠

    Hello nicktuf,

    Thank you for your post.

    Looks like you are using a bat script to install and assign TeamViewer for you. What are you using to run the bat script? A deployment software or you are running manually on the machine? Did you check if you are running the script with admin credentials?

    Thank you for using TeamViewer.

    W_deFazio

  • nicktuf
    nicktuf Posts: 8

    I'm just manually running the bat file for now, once its working i'll add to our MDT deployment task.

    I've tried running as admins and non-admins, doesn't seem to make a difference. When I view the properties of that json file, even admin doesnt' have permissions unless I change it.

  • W_deFazio
    W_deFazio Posts: 22 Staff member 🤠

    Hello nicktuf,

    If you are manually executing the bat script on the machine, then you need to make sure you are right clicking and running as administrator. 

    Are the MSI and Assignment tool files locally on the machine, or you pushing from a share drive?

    Try this bat script below, just change the "XXXXXX" with the path to your share drive where the files are located, the IDC code for the host and the token for the Assignment Tool.

    The Code:

    start /wait msiexec.exe /i \\XXXX\XXXXX\XXXX\TeamViewer_Host-idcXXXX.msi /qn

    cd
    IF EXIST "%ProgramFiles(x86)%" (GOTO :INSTALL64) ELSE (GOTO :INSTALL32)

    :INSTALL64
    start /wait \\XXXX\XXXX\XXXX\XXXX\TeamViewer_Assignment.exe -apitoken XXXXXXXXXXXXXXXXXXXXXXXXXXX -datafile "C:\Program Files (x86)\TeamViewer\AssignmentData.json"
    exit

    :INSTALL32
    start \\XXXX\XXXX\XXXX\XXXX\TeamViewer_Assignment.exe -apitoken XXXXXXXXXXXXXXXXXXXXXXXXXXX -datafile "C:\Program Files\TeamViewer\AssignmentData.json"
    exit

    Best Regards,

    W_deFazio

    Senior Support Engineer

  • Techvert
    Techvert Posts: 2

    Hello,

    I have the same problem, and this comes from the write rights set to "Read" for the file AssignmentData.json.

    As soon as we put the rights "modification", the script works.

    There would not be a problem installing the customized msi?

  • Techvert
    Techvert Posts: 2

    For the moment, the solution is to put a SCP connector...

    Warning:

    "Easy access is only possible through the assignment tool. If you use a SCP you would need to use a predefined password (to be exported to a TeamViewer_Settings.reg file)"

  • Any news it's fixed?

  • Netanel
    Netanel Posts: 8 ✭✭
    I tried and it did not work. This installed but did not belong to the computer group, and the settings were not accepted such as Graphic Design.
  • Scotty
    Scotty Posts: 493 Staff member 🤠

    Hi Netanel

    Just note that this thread is for an older version.

    The instructions for the new version are here

    Mass Deployment Improved

    -Scotty

    Senior Moderator
    Did my reply answer your question? Why not accept it as a solution to help others?
  • Netanel
    Netanel Posts: 8 ✭✭

    Dear Scotty,
    The guide does not list all the "ASSIGNMENTOPTIONS" options. It is very important to list all the options so people can use them.

    I mean there will be more examples of using "ASSIGNMENTOPTIONS" so that people can understand the meaning of everything.

  • Scotty
    Scotty Posts: 493 Staff member 🤠

    Hi Netanel,

    It does list all the options though?

    Second heading from the bottom it gives a full list.
    What have we missed?

    -Scotty

    Senior Moderator
    Did my reply answer your question? Why not accept it as a solution to help others?
  • Netanel
    Netanel Posts: 8 ✭✭

    It took me a long time to build a script that would make computers enter a specific group with fast access(easy access) and would appear on behalf of the computer name instead of the TEAM VIEWER number.

    I think that giving more examples of use will make it easier for users and open up possibilities for maximizing the use of TEAM VIEWER.