cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
JTempleton
Engaged Sweeper III
Is it possible to setup a custom action to launch and connect TeamViewer? I know the command line options, but how can I get the registry options into a custom action?
1 ACCEPTED SOLUTION
Hendrik_VE
Champion Sweeper III
Hi all,

I managed to create a custom TeamViewer action using this small workaround (currently only for 64 bit TeamViewer clients, but can easily be expanded to support 32 bit TV or older TV versions too, using the registry keys mentioned earlier in this topic):

1. Set up registry scanning for the registry value 'ClientID' from SOFTWARE\WOW6432Node\TeamViewer

2. Create a custom report that exports the hostname and TeamViewer ClientID to a CSV file called 'TeamViewer_DeviceID.csv':
Select Top 1000000 tblAssets.AssetID,
tblAssets.AssetName,
tblRegistry.Value
From tblAssets
Inner Join tblAssetCustom On tblAssets.AssetID = tblAssetCustom.AssetID
Inner Join tblRegistry On tblAssets.AssetID = tblRegistry.AssetID
Where tblAssetCustom.State = 1 And tblRegistry.Valuename = 'ClientID'


3. Add a custom action called 'TeamViewer' which runs the following action:
powershell -noprofile -executionpolicy bypass -command {actionpath}tv.ps1 {computer}

4. In the Actions folder of your Lansweeper server, add the powershell script 'tv.ps1' which contains the following commands:
$server = $args[0]
$ARG = import-csv "\\<LansweeperServer>\export\TeamViewer_DeviceID.csv" -Delimiter ';' |where-object assetname -like $server | select value -ExpandProperty value
start-process -filepath "C:\Program Files (x86)\TeamViewer\TeamViewer.exe" -argumentlist "-i $ARG"


5. See the magic happen when clicking on the TeamViewer action.

View solution in original post

26 REPLIES 26
marck1024
Engaged Sweeper III
I ended up creating an SQL trigger. This is probably even more unsupported.

CREATE TRIGGER MK_IU_tblRegistry
ON [dbo].[tblRegistry]
AFTER INSERT, UPDATE
AS
BEGIN
SET NOCOUNT ON

UPDATE A SET
A.Custom1 = B.Value
FROM tblAssetCustom A
INNER JOIN inserted B
ON A.AssetID = B.AssetID
WHERE B.Regkey LIKE '%TeamViewer%'
AND B.Valuename = 'ClientID'

END
marck1024
Engaged Sweeper III
esr,

Is there somewhere within Lansweeper that you set up the SQL script? Or are you running it outside the application in the SQL task scheduler?
marck1024
Engaged Sweeper III
Thanks, esr! Very handy.

Now if only we could pass the value of the custom field into a custom action, connecting to the client could be a one-click action.
esr
Champion Sweeper
I've added custom registry scans for the client id, and then use a script to populate one of the custom fields so the client id is easily found on any asset page. It's not interactive or anything, but at least the ID is easily found so you don't need to search or ask the user...

The registry keys we scan-

For each path below, the RegValue is: ClientID
RegPath(s):
HKLM\SOFTWARE\TeamViewer
HKLM\SOFTWARE\Wow6432Node\TeamViewer
HKLM\SOFTWARE\Wow6432Node\TeamViewer\Version6
HKLM\SOFTWARE\Wow6432Node\TeamViewer\Version7
HKLM\SOFTWARE\Wow6432Node\TeamViewer\Version8
HKLM\SOFTWARE\Wow6432Node\TeamViewer\Version9


Note that HKLM\SOFTWARE\Wow6432Node\TeamViewer works for versions 10, 11 & 12

Then just a quick SQL UPDATE to the custom field of your choice:

UPDATE dbo.tblAssetCustom
SET dbo.tblAssetCustom.Custom1 = dbo.tblRegistry.value
FROM dbo.tblAssetCustom INNER JOIN dbo.tblRegistry
ON dbo.tblAssetCustom.AssetID = dbo.tblRegistry.AssetID
WHERE tblRegistry.Regkey LIKE '%teamviewer%'


NOTE THAT Lansweeper Tech Support does not really support or provide assistance for playing around with your database. Always backup and if possible test in a dev environment.
KayGt3
Engaged Sweeper
@esr: Can you please describe step by step this procedure?
I'm so interested.

Thanks

esr wrote:
I've added custom registry scans for the client id, and then use a script to populate one of the custom fields so the client id is easily found on any asset page. It's not interactive or anything, but at least the ID is easily found so you don't need to search or ask the user...

The registry keys we scan-

For each path below, the RegValue is: ClientID
RegPath(s):
HKLM\SOFTWARE\TeamViewer
HKLM\SOFTWARE\Wow6432Node\TeamViewer
HKLM\SOFTWARE\Wow6432Node\TeamViewer\Version6
HKLM\SOFTWARE\Wow6432Node\TeamViewer\Version7
HKLM\SOFTWARE\Wow6432Node\TeamViewer\Version8
HKLM\SOFTWARE\Wow6432Node\TeamViewer\Version9


Note that HKLM\SOFTWARE\Wow6432Node\TeamViewer works for versions 10, 11 & 12

Then just a quick SQL UPDATE to the custom field of your choice:

UPDATE dbo.tblAssetCustom
SET dbo.tblAssetCustom.Custom1 = dbo.tblRegistry.value
FROM dbo.tblAssetCustom INNER JOIN dbo.tblRegistry
ON dbo.tblAssetCustom.AssetID = dbo.tblRegistry.AssetID
WHERE tblRegistry.Regkey LIKE '%teamviewer%'


NOTE THAT Lansweeper Tech Support does not really support or provide assistance for playing around with your database. Always backup and if possible test in a dev environment.


marck1024
Engaged Sweeper III
I don't think this will work. TeamViewer requires the client ID. t

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

The client ID is stored in the registry. I thought I might be able to add the registry location(s) to the scanning settings and then create a custom action. But that approach won't work with the variable list so limited.

Please count me as a +1 for the enhancement of expanding the custom actions to be able to use more variables. The ideal would be the ability to use any field from the database related to the asset.
Susan_A
Lansweeper Alumni
You can add custom actions under Configuration\Asset Pages. Available parameters are listed when you hit the Add Asset Action button, but I've listed them below as well. I'm not sure which parameters TeamViewer requires, but they would have to be stored in one of the fields below in order to reference them with a custom action.

{actionpath}
{smartname} -> This is the asset's IP address, asset name or FQDN, depending on the asset type.
{assetname}
{dnsname}
{computer} -> This is the computer name.
{domain}
{tag} -> This is the asset's serial.
{username}
{userdomain}
{ipaddress}
{fqdn}
{scanserver}
{assetid}

New to Lansweeper?

Try Lansweeper For Free

Experience Lansweeper with your own data.
Sign up now for a 14-day free trial.

Try Now