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
Hendrik.VE wrote:
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.


MVP Award here, can't see why LS couldn't just add the custom scanning fields as an action, but fantastic work dude.
marck1024
Engaged Sweeper III
Hendrik.VE wrote:
I managed to create a custom TeamViewer action using this small workaround...

Very cool solution!

marck1024
Engaged Sweeper III
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.
esr
Champion Sweeper
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?
KayGt3
Engaged Sweeper
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!

esr wrote:
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
Champion Sweeper
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
Engaged Sweeper
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! 🙂

esr wrote:

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


KayGt3
Engaged Sweeper
Thanks!

I'll let you know.

esr wrote:
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.


marck1024
Engaged Sweeper III
Awesome! Thanks.
esr
Champion Sweeper
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-

UPDATE dbo.tblAssetCustom
SET dbo.tblAssetCustom.Custom1 = NULL