Interact with the TeamViewer API using PowerShell.
cd ~\Downloads
git clone https://github.com/devynspencer/powershell-teamviewer
$UserModulesPath = ($env:PSModulePath -split ";")[0]
Copy-Item -Recurse "~\Downloads\powershell-teamviewer\TeamViewer" "$UserModulesPath\TeamViewer"
Import-Module -Force -Verbose TeamViewer
This project uses the Microsoft.PowerShell.SecretStore module to simplify management of API tokens and other secrets. This requires the installation of a few dependencies:
Install-Module -Name "Microsoft.PowerShell.SecretManagement", "Microsoft.PowerShell.SecretStore"
Setup a new secret store to hold TeamViewer passwords, API tokens, and other secrets:
Register-SecretVault -ModuleName Microsoft.PowerShell.SecretStore -Name TeamViewer -Verbose
Set-SecretStoreConfiguration -Authentication Password -Scope CurrentUser -Interaction None -Confirm:$false
Generate a new API script token from your TeamViewer profile, then add it to the secret store:
Unlock-SecretStore # Will prompt for password set in previous step
$ApiToken = "ABCDEFG1234567890HIJKLMNOPQ" # Replace with a real token, obviously
Set-Secret -Vault TeamViewer -Name TEAMVIEWER_API_TOKEN -Secret $ApiToken
Get TeamViewer devices, and filter based on specific criteria:
Get-TeamViewerDevice -GroupName "Developer Workstations"
# Alternatively
Get-TeamViewerGroupMember -Identity "Developer Workstations"
Rename a device:
Set-TeamViewerDevice -Id 1095514322 -Name "PRDWRK01"
Update group memberships:
Add-TeamViewerGroupMember -Identity "Developer Workstations" -Members "PRDWRK01"
# Alternatively
Set-TeamViewerDevice -Id 1095514322 -Group 1234567
See the built-in help for information on each function:
help Get-TeamViewerDevice -Detailed