I'm writing a powershell install wrapper for TeamViewer 12 to push over SCCM. Host is installing fine and pulling the correct configuration/policy. However, the assignment tool is failing.
The documentation--sparse as it is--is very vague with exit codes. Essentially it says 1 means 'an error occurred'. Thanks for that, it's really helpful *sarcasm*. The documentation says nothing of an exit code of 2, which is what I'm getting from my script. Here's a code snippet:
If (Test-Path ${InstallDir}\AssignmentData.json)
{
Copy-Item -Path "{$Target}\TeamViewer_Assignment.exe" -Destination "${InstallDir}\TeamViewer_Assignment.exe" -Force
$AssignArgs = "-datafile AssignmentData.json -apitoken ${Token} -devicealias ${env:COMPUTERNAME} -allowEasyAcces=true -verbose"
$Assign = Start-Process ${InstallDir}\TeamViewer_Assignment.exe -Argumentlist $AssignArgs -WindowStyle Hidden -PassThru
Wait-Process -InputObject $Assign
}
If ($Assign.ExitCode -ne 0)
{
If ($Assign.ExitCode -eq $NULL)
{
Write-Warning "Assignment tool did not start successfully!"
}
Else
{
Write-Warning "Assignment tool terminated with status code $($Assign.ExitCode)."
}
}
ElseIf ($Assign.ExitCode -eq 0)
{
New-Item -ItemType File -Path "${InstallDir}\12_Assign.dep"
If (Test-Path ${InstallDir}\12_Assign.dep)
{
Write-Host "${TV} was assigned to company account associated with ${ConfID}." -ForegroundColor Cyan
}
}
I'm not familiar with best practices for scripting TeamViewer's processes, but this methodology works for the MSI installer (full fat and host) when retrieving exit codes is critical to automating the deployment. Does the assignment tool handle arguments differently? What does exit code 2 signify? I can't get the thing to spit out a log.