Notification

Icon
Error

TeamViewer Custom Action

Posted: Thursday, January 14, 2016 5:15:43 PM(UTC)
JTempleton

JTempleton

Member Original PosterPosts: 40
0
Like
This issue has been solved! Click here to view the solution
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?
Susan.A
#1Susan.A Member Administration Posts: 1,535  
posted: 1/19/2016 11:27:43 AM(UTC)
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}
marck1024
#2marck1024 Member Posts: 31  
posted: 6/5/2017 10:20:58 PM(UTC)
I don't think this will work. TeamViewer requires the client ID. t

https://community.teamvi...art-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.
esr
#3esr Member Alpha Tester Posts: 69  
posted: 6/8/2017 12:50:28 PM(UTC)
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-
Quote:

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:

Quote:
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
#4marck1024 Member Posts: 31  
posted: 6/8/2017 2:32:51 PM(UTC)
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.
marck1024
#5marck1024 Member Posts: 31  
posted: 6/12/2017 3:22:48 PM(UTC)
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?
esr
#6esr Member Alpha Tester Posts: 69  
posted: 6/12/2017 4:33:44 PM(UTC)
I haven't got around to setting a scheduled task for it yet. It can be run via the Lansweeper website, under Configuration>Database Scripts, or you can run it under SSMS directly.

Worth noting that you can mass clear a custom field with the following- be sure to set the custom field name accordingly-

Quote:
UPDATE dbo.tblAssetCustom
SET dbo.tblAssetCustom.Custom1 = NULL
marck1024
#7marck1024 Member Posts: 31  
posted: 6/12/2017 6:04:43 PM(UTC)
Awesome! Thanks.
KayGt3
#8KayGt3 Member Posts: 5  
posted: 7/7/2017 12:13:39 PM(UTC)
@esr: Can you please describe step by step this procedure?
I'm so interested.

Thanks

Originally Posted by: esr Go to Quoted Post
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-
Quote:

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:

Quote:
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.


esr
#9esr Member Alpha Tester Posts: 69  
posted: 7/7/2017 12:38:11 PM(UTC)
What you quoted is the whole deal :)

The custom scan gets the Client ID into the Lansweeper database. You'll be able to create reports with it or to see the ID, if found, on an asset page, under Config>Scanned Info>Registry Keys.

The UPDATE is just a tiny bit of code you can run to copy the Client ID over to the Custom Field of your choice so it's on the assets summary page and easy to see.

If your version of Lansweeper is old enough you can go to Configuration>Database Scripts and run the update there. New versions will have a DatabaseMaintenance.exe tool in the Lansweeper\Tools folder, or you can use SSMS regardless of Lansweeper version.

I strongly encourage backing up your database before any changes are made. I also encourage having a DEV environment where you can play & learn without impacting your PROD version. Lansweeper Support typically does not offer support for playing with your database.
KayGt3
#10KayGt3 Member Posts: 5  
posted: 7/7/2017 12:47:20 PM(UTC)
Thanks!

I'll let you know.

Originally Posted by: esr Go to Quoted Post
What you quoted is the whole deal :)

The custom scan gets the Client ID into the Lansweeper database. You'll be able to create reports with it or to see the ID, if found, on an asset page, under Config>Scanned Info>Registry Keys.

The UPDATE is just a tiny bit of code you can run to copy the Client ID over to the Custom Field of your choice so it's on the assets summary page and easy to see.

If your version of Lansweeper is old enough you can go to Configuration>Database Scripts and run the update there. New versions will have a DatabaseMaintenance.exe tool in the Lansweeper\Tools folder, or you can use SSMS regardless of Lansweeper version.

I strongly encourage backing up your database before any changes are made. I also encourage having a DEV environment where you can play & learn without impacting your PROD version. Lansweeper Support typically does not offer support for playing with your database.


KayGt3
#11KayGt3 Member Posts: 5  
posted: 10/23/2017 6:42:41 PM(UTC)
I just try the SQL update but the LS Maintenence Tool get me this error: "The table name is not valid. [ Token line number (if known) = 2,Token line offset (if known) = 12,Table name = tblAssetCustom ]"

Can you help me?

Thanks! :)

Originally Posted by: esr Go to Quoted Post

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%'


esr
#12esr Member Alpha Tester Posts: 69  
posted: 10/26/2017 2:55:03 PM(UTC)
Hi Kay
tblAssetCustom is one of the primary tables used by Lansweeper, not sure why it would tell you that table name is invalid.

I typically interact via SSMS, but in an effort to replicate your symptom I jumped onto my DEV server and used the database maintenance tool to run the update- worked fine- see screenshot attached.

I'm presuming you've set the custom scan required?
esr attached the following image(s):
Screenshot - 10_26_2017 , 9_48_25 AM.png
KayGt3
#13KayGt3 Member Posts: 5  
posted: 11/1/2017 11:52:45 AM(UTC)
I've set the custom scan and i see the Team Viewer ID if i get a report.
I'm running the last version (v. 6.0.100.75)

I tried a fresh installation and then i give you a feedback.

Thanks!

Originally Posted by: esr Go to Quoted Post
Hi Kay
tblAssetCustom is one of the primary tables used by Lansweeper, not sure why it would tell you that table name is invalid.

I typically interact via SSMS, but in an effort to replicate your symptom I jumped onto my DEV server and used the database maintenance tool to run the update- worked fine- see screenshot attached.

I'm presuming you've set the custom scan required?


marck1024
#14marck1024 Member Posts: 31  
posted: 7/10/2018 8:17:10 PM(UTC)
Still interested in the action variables being expanded such that the TeamViewer ID would be available for use in a custom action. It would be huge to be able to launch a TeamViewer session from the asset page.
marck1024
#15marck1024 Member Posts: 31  
posted: 12/4/2018 12:19:04 AM(UTC)
I ended up creating an SQL trigger. This is probably even more unsupported.

Code:
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
Hendrik.VE
#16Hendrik.VE Member Posts: 24  
posted: 12/10/2018 1:16:48 PM(UTC)
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':
Code:
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:
Code:
$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.
marck1024
#17marck1024 Member Posts: 31  
posted: 12/10/2018 6:34:23 PM(UTC)
Originally Posted by: Hendrik.VE Go to Quoted Post
I managed to create a custom TeamViewer action using this small workaround...

Very cool solution!

CyberCitizen
#18CyberCitizen Member Posts: 210  
posted: 1/8/2019 2:43:08 AM(UTC)
Originally Posted by: Hendrik.VE Go to Quoted Post
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':
Code:
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:
Code:
$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.


MVP Award here, can't see why LS couldn't just add the custom scanning fields as an action, but fantastic work dude.
Cripple.Zero
#19Cripple.Zero Member Posts: 17  
posted: 2/20/2019 5:01:01 PM(UTC)
Originally Posted by: Hendrik.VE Go to Quoted Post
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':
Code:
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:
Code:
$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.


I presume this wouldn't work for client PCs that only run the TeamViewer QS standalone, correct, but only if it is the local installed (freeware or licensed) client?
marck1024
#20marck1024 Member Posts: 31  
posted: 2/21/2019 5:44:53 PM(UTC)
Still hoping Lansweeper will gain the ability to reference custom fields in actions.
Hendrik.VE
#21Hendrik.VE Member Posts: 24  
posted: 2/24/2019 7:58:26 PM(UTC)
Originally Posted by: Cripple.Zero Go to Quoted Post

I presume this wouldn't work for client PCs that only run the TeamViewer QS standalone, correct, but only if it is the local installed (freeware or licensed) client?


I haven't tried it myself, but I don't think it will work as TeamViewer QS probably doesn't write anything in the DB.
You will have to enter the TV ID manually.
JVANKO
#22JVANKO Member Posts: 1  
posted: 5/23/2019 7:48:05 PM(UTC)
Originally Posted by: Hendrik.VE Go to Quoted Post
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':
Code:
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:
Code:
$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.


I followed the instructions but all that happens for me is that TV will flash and open but it will not change the ClientID in TV. I am running TV14 Commercial (some users use the host module). Has something changed since ver. 12 when this was last posted?
CyberCitizen
#23CyberCitizen Member Posts: 210  
posted: 5/24/2019 1:39:48 AM(UTC)
I am also using v14 but it is working for me.
miccas0
#24miccas0 Member Posts: 1  
posted: 5/30/2019 10:18:23 PM(UTC)
Originally Posted by: Hendrik.VE Go to Quoted Post
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':
Code:
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:
Code:
$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.


I have followed your steps but I get this error message:

"Error parsing commandline:the required argument for option '--id' is missing"

Active Discussions

Lansweeper BHO with apostrophe
by  Randomusername   Go to last post Go to first unread
Last post: Today at 5:24:34 PM(UTC)
Lansweeper Report Hard Disk Copiers
by  Cerona  
Go to last post Go to first unread
Last post: Today at 3:11:41 PM(UTC)
Lansweeper Parallel Palo Alto firewalls scanning issue
by  Erold Ruzi   Go to last post Go to first unread
Last post: Today at 12:43:32 PM(UTC)
Lansweeper Remove all users from old domain
by  cmuter  
Go to last post Go to first unread
Last post: 9/20/2019 8:03:58 PM(UTC)
Lansweeper Static IP Address
by  cycleheat   Go to last post Go to first unread
Last post: 9/20/2019 4:07:16 PM(UTC)
Lansweeper Bitlocker Encryption Recovery Key no information found
by  Stephane  
Go to last post Go to first unread
Last post: 9/20/2019 2:26:19 PM(UTC)
Lansweeper InTune Scanning Issues
by  Esben.D   Go to last post Go to first unread
Last post: 9/20/2019 12:34:59 PM(UTC)
Lansweeper Office 365 scanning issues
by  Esben.D  
Go to last post Go to first unread
Last post: 9/20/2019 12:23:30 PM(UTC)