Kaseya Community

Accessing SQL Data View

This question is answered

Hi,

 

Is it possible to access SQL view data from an agent procedure for a machine other than the one you are currently running it on?

i.e Running a script on ServerA that prompts the user for computer name to run against, user inputs ComputerA, the script then checks the Kaseya DB for the MAC Address of  ComputerA the script then proceeds to perform the next sections of the procedure (i.e Wake On Lan).

I know WOL is built into Kaseya but have found it flakey at times and have a more reliable method but require the mac address of the target machine in order to run it.

 

Thanks for any help in advance.

 

Andy

Verified Answer
All Replies
  • Copied from kaseya help:

    Note: SQL View Data - This older method of returning a database view value is only necessary if you are trying to return a value from a different machine than the machine running the agent procedure.

    Use the GetVariable command with the SQL View Data option to create a new procedure variable and set it to the value of a dbo.SqlView.Column value. Use the format SqlViewName/ColumnName/mach.groupID or SqlViewName/ColumnName. If the optional machine ID is omitted, then the value for the agent executing the procedure is retrieved. If ColumnName contains a space, surround it with square brackets. Example: vSystemInfo/[Product Name]. See System > Database Views for a list of the SQL views and columns that are available.

  • Procedure Slow PC - Email computer Audit.xml

    Maybe you can help me too.

    Im trying to get SQL data from the agent im running the procedure on but its not working. My script keeps failing. What am i doing wrong? Shouldn't be too difficult.

  • Procedure Slow PC - Email computer Audit.xml

    Try this, I think it is what you are looking for.

     

    Andy

  • Bit confused by what you're trying to get here etabush - your procedure appears to try to get the groupname as variable addremove and then populate the procedure log with it?

  • I think he is just using this script as proof of concept for pulling data from the Kaseya DB

  • Exactly. I was just testing with the one piece of SQL data.

    My end goal would be to have it email the technician all different PC specs relevant when investigating a slow PC.  

  • In the script that you posted all you did was change the sql view to #vAddRemoveList.applicationName#

    I had this before and that's why my variable was still called "addremove"

    Script is still failing though

  • Why not just get them to use quickview - it's way quicker then finding and running a report

  • I can do that but I'm building a master script to use on slow computers and i want the tech to just run it and wait for the emails telling them what is done. The less manual steps the better...

    I figured it out!! You dont need to use the get variable step. If you just call the variable #vMachine.groupName# or any other it will work.