Scripting TeamViewer VPN

teamviewervpn

Our organisation uses TeamViewer (v10). I haven't found any way to automate or batch process tasks across multiple machines (eg copy same file to many, and ideally execute). Currently I have to do it one-by-one.

I've recently discovered that TeamViewer supports a "VPN" connection mode. This sets up a direct IP connection between the two machines (host and client). However it's not true VPN in that it doesn't allow access to the entire remote network.

Each time a VPN session is created it uses DHCP IP addresses, handed out by a TeamViewer server (7.0.0.1). Each client adapter is set to dynamic. Furthermore, when I override the settings and set a static IP address, it is not shown in the dialog box. The same 7.x.x.x address is shown, even though the local network adapter is set to 192.x.x.x.

TeamViewer VPN dialog

This all works for a graphical interactive session. I would like to wrap this up in a script for deployment tasks.

The VPN can be initiated from the command line:

TeamViewer.exe -i <id> --Password <password> -m vpn

https://community.teamviewer.com/t5/Knowledge-Base/Are-there-parameters-to-start-TeamViewer/ta-p/4135

This allows me to create a VPN session to the remote machine. The same dialog box is opened, but the command immediately returns with no text output. I can find no way to either retrieve the IP details automatically, nor to set them statically.

Has anyone succeeded in scripting TeamViewer VPN?

Best Answer

Surely you've already found a way to do this... but if not, you can use this UI automation package called TestStack White. I've used it to automate file transfer between computers through teamviewer.

https://teststackwhite.readthedocs.io/en/latest/

Use this in conjunction with UIspy (or inspect.exe if you have that instead. both accomplish the same goal)

Keep in mind this only works for straight-up file transfer (at least, I haven't tried to go any further with it.)