Lansweeper logo
Home Download Features Demo Buy now Help Support forum
 
    Most requested support articles:
  Lansweeper troubleshooting guide.
  The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)
  WMI Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
  How to configure the windows firewall using group policies.
  Support:  
 support@lansweeper.com  
Skype: Lansweeper  
  Mo-Fri 9h-17h CET  
Welcome Guest Search | Active Topics | Log In | Register

Untag as favorite
Is it possible to reference custom fields in custom actions?
mghabel
#1 Posted : Friday, August 12, 2011 1:39:24 AM

Rank: Premium user

Groups: Member, Premium Users
Posts: 25
Hi
I would like to create a custom action for teamviewer. I would like to populate one of the custom fields with teamviewer's ID. Then create a custom action to launch teamviewer and pass the computer ID to it.
Thanks
Max
Lansweeper
#2 Posted : Monday, August 15, 2011 8:47:38 PM

Rank: Administration

Groups: Administration, Premium Users
Posts: 10,378
It's not possible to use one of the custom fields in the actions.
aleneosp
#3 Posted : Thursday, January 26, 2012 7:27:04 PM
Rank: Freeware user

Groups: Member
Posts: 1
Location: Sao Paulo - Brazil
Hello,

I wrote a simple vbs script to get the field from sql database and then pass it to a custom action to work with teamviewer

needed: teamviewer.vbs , teamviewer.exe

Save teamviewer.exe in the action folder as configured in {actionpath}

Save teamviewer.vbs in the same folder.

teamviewer.vbs

Code:

call Init

Public Sub Init

Dim rstAuthors, teamviewerid, shell

if isobject(cn) = false then
Set cn = CreateObject("ADODB.Connection")
Set rs = CreateObject("ADODB.Recordset")
cn.ConnectionString = "Provider=SQLOLEDB.1;Data " & _
"Source=sourcedatabase; Initial Catalog=lansweeperdb;user id = " & _
"'sa';password='yourpassword'"
cn.Open
strAuthorsQry = "Select tblCompCustom.Custom1 From tblComputers Inner Join tblCompCustom On tblComputers.Computername = tblCompCustom.Computername Where (tblcomputers.domain = '" & wscript.arguments(0) & "' AND tblcomputers.computer = '" & wscript.arguments(1) & "')"

set rstAuthors = cn.execute(strAuthorsQry)

rstAuthors.MoveFirst

teamviewerid = rstauthors("Custom1")

Set shell = CreateObject("WScript.Shell")
shell.Run "\\pathtoactionsfolder\teamviewer.exe -i " & teamviewerid & "", 1, false
Set shell = Nothing

end if

End Sub



then create a computer custom action

{actionpath}teamviewer.vbs {domain} {computer}

In this case I used domain and computer but you can use another parameter of your choice.

This worked for me, if you have any question please post and I will help as possible.

Remember to change the details of the connection/query with your environment parameters.

Alexandre.
Users browsing this topic
Guest
Untag as favorite
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Contact: E-mail Lansweeper - Skype : Lansweeper
Copyright 2004 - 2011 © Hemoco bvba