I love these vars, I just wish they were easier to get to. Every time I need one of these vars it's long trip into kaseya help, cutting and pasting. I finally broke down and put most of the vars into a sheet. Why didn't I think of making this matrix years ago?
Wait! You didn't create these years ago?? You created them today and didn't post in Excel ? ? ? How will I ever filter these? :D
Seriously - THANKS! this will help a lot of folks out there. They aren't the easiest things to find when you need them!
PS - the ONE variable I always look for and realize doesn't exist is the ORG name.
Amazing! myArch-man Great work man. I also should have thought to do this a long time ago. Every time I need one of these it takes ages going through disparate help documents with no joined up documentation, and it's always when I need them quickly I need to spend ages going through those *** help files!
I always just google: kaseya database view > all those var you can use :)
#adminDefaults.adminEmail# is another I use often. Returns the current VSA users email, I use it in some scripts that will email the tech with the results of the task :)
gbarnas - I was also surprised the org name isn't available. We came up with a horrible agent procedure to get it, works on Windows only but could be extended easily enough. The gist of it is to extract it from #vAgentName.groupName# which lists the org name 'first'.
for /F "tokens=1 delims=." %i in ("#vAgentName.groupName#") do echo %i>>#vAgentConfiguration.AgentTempDir#\organisation.txt
It does.. just need to strip it out from the variable for groupname
e.g. #vMachine.groupName# gives you Organization, then machine group the machine is assigned to
So anything up to the 1st '.' is the Org
Actually .. I take that back .. groupname is in the opposite order with ORG on the End .. so not quite as simple
OK .. so bit obscure by #vPatchStatusByAgent/GroupName# will give you ORG.Group ( it the reverse to all the other views)
So now as per my 1st post everything up to the 1st '.' is the ORG
Create a SQLQuery using the following
select left(#vPatchStatusByAgent/GroupName#,charindex('.',#vPatchStatusByAgent/GroupName#)) charindex(groupname,'.'))
And save the result to a variable
It will return JUST the Org name
Paul Haaker - #vAgentName.groupName# also has the name in reverse format.
How do we execute custom SQL queries within agent procedures? I thought this was kind of deprecated?
For On-Prem only , you create an XML file that defines the SQL query , save it to your VSA in the XML folder , then it will appear as an available option using the SQLRead step
So the XML file would look like this :
<?xml version="1.0" encoding="utf-8" ?>
<queryDef label="Get_OrgName" sql="select left(#vPatchStatusByAgent/GroupName#,charindex('.',#vPatchStatusByAgent/GroupName#)) charindex(groupname,'.'))" />
Save it to your VSA with an .xml file extension to :
Then use the SQLRead Step in your Agent procedure and the query will show as "Get_OrgName" .. ie the Label it was given in the XML file
Not to take anything away from Paul's solution, but since it requires a SQL query, it won't work in SAAS. (technically, it could, but I'm still waiting for Kaseya to approve the SQL query THEY GAVE TO ME to be approved in SAAS - 9 months and counting without approval! :(
We have an app to get this done so it works in SAAS, but the real issue is that something THIS FUNDAMENTAL shouldn't have to be obtained with workarounds of any kind.