The last time I wrapped TV was TV12 and before I used PSADT. Using the toolkit, my first draft would be this:
Execute-MSI -Action Install -Path "TeamViewer_Host.msi" -Parameters "/qn" -AddParameters 'ASSIGNMENTOPTIONS="–alias %COMPUTERNAME% --grant-easy-access --reassign"' -SecureParameters 'CUSTOMCONFIGID=“xxxxxx” IMPORTREGFILE=“1” APITOKEN=“xxxxxx-xxxxxxxxxxxxxxxxxxx”' -PassThru
Look at your string, notice how you aren’t placing single/double quotes correctly.
In powershell, double-quotes indicate a string (" "), whereas single-quotes (’ ') indicate a literal string–with single quotes, powershell will not substitute or translate anything within them, regardless if there is syntax written.
More info on MS Docs: https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_quoting_rules?view=powershell-6
With the quotes as I have placed them here, the PSADT script will pass the literal strings in the parameters into a command–where they will then be translated because the outermost quotes themselves don’t pass through. This results in msiexec receiving the following string (more or less):
msiexec /i TeamViewer_host.msi /qn ASSIGNMENTOPTIONS="–alias %COMPUTERNAME% --grant-easy-access --reassign" CUSTOMCONFIGID=“xxxxxx” IMPORTREGFILE=“1” APITOKEN=“xxxxxx-xxxxxxxxxxxxxxxxxxx”
The bold part actually comes through as a codeblock for base64 decode (I think) because -SecureParameters will ‘encrypt’ parameters set there (best practice for any API keys, passwords, etc you pass using PSADT).
Please test the above command and reply back with results. I have something of a crusade against TV and will help you till we get it right.