Step 1) Go to your Design & Deploy page and click Add Host>Host, do all your site/client settings and make sure Allow account assignment without confirmation is checked. Then download the Assignment Tool, click Save.
Step 2) Click the Edit button next to your newly created client host, copy the Configuration ID and the API token. Save those for later, now click Download MSI. (note: if you keep you're using the same configuration (logo, colors) for all of your MSI's you won't have to repeat this step for other sites/clients.)
Step 3) Uploaded your TeamViewer_Host.msi and your TeamViewer_Assignment.exe somewhere which will be accessible from where you want to deploy.
(e.g. http://mywebsite.com/TV/TeamViewer_Host.msi, http://mywebiste.com/TV/TeamViewer_Assignment.exe)
Step 4) Save those urls, now we're ready to run the script, you will have to find a way to bypass executionpolicy on PowerShell (it's pretty easy..), when you run the script use it as such (make sure you run as Admin)
.\Download-TV.ps1 -host_msi_url "http://mywebsite.com/TV/TeamViewer_Host.msi" -configuration_id "$config_id" -assingment_tool_url "http://mywebiste.com/TV/TeamViewer_Assignment.exe" -api_token "$api_token"
param (
[Parameter(Mandatory=$true)][string]$host_msi_url,
[Parameter(Mandatory=$true)][string]$configuration_id,
[Parameter(Mandatory=$true)][string]$assingment_tool_url,
[Parameter(Mandatory=$true)][string]$api_token
)
$tv_msi_path = $env:TEMP + "\TeamViewer_Host-idc$configuration_id.msi"
$assign_path = $env:TEMP + "\tvassign.exe"
if (Test-Path("C:\Program Files\TeamViewer\")) {
#32
Start-Process -Wait -FilePath "C:\Program Files\TeamViewer\uninstall.exe" -ArgumentList "/S"
Remove-Item "C:\Program Files\TeamViewer\" -Force -Recurse
echo "Removing existing TeamViewer install (32)"
} elseif (Test-Path("C:\Program Files (x86)\TeamViewer\uninstall.exe")) {
#64
Start-Process -Wait -FilePath "C:\Program Files (x86)\TeamViewer\" -ArgumentList "/S"
Remove-Item "C:\Program Files (x86)\TeamViewer" -Force -Recurse
echo "Removing existing TeamViewer install (64)"
}
$client = New-Object System.Net.WebClient
$client.DownloadFile($host_msi_url, $tv_msi_path)
$client.DownloadFile($assingment_tool_url, $assign_path)
echo "installing TV"
Start-Process -Wait -FilePath $tv_msi_path -ArgumentList "/qn"
if (! (Test-Path("C:\Program Files (x86)"))) {
#32
Start-Process -Wait -FilePath $assign_path -ArgumentList "-apitoken $([char]34)$api_token$([char]34) -datafile $([char]34)C:\Program Files\TeamViewer\AssignmentData.json$([char]34)"
echo "Running configuration utility (32)"
} else {
#64
Start-Process -Wait -FilePath $assign_path -ArgumentList "-apitoken $([char]34)$api_token$([char]34) -datafile $([char]34)C:\Program Files (x86)\TeamViewer\AssignmentData.json$([char]34)"
echo "Running configuration utility (64)"
}