Kaseya Community

Get Variable for Org ID

This question is answered

We have built in vars/views for group and machine agent names.

i.e.
#vMachine.Machine_GroupID#

#vMachine.groupName#

Is there a var/view for the Org name/id? If not, is there a way to retrieve the OrgName and/or OrgID via a kaseya procedure?

Verified Answer
  • No - this is a blatantly missing capability. I wrote an app to do this, and there's a SQL query you can run if on-prem. Basically, use the vMachine.Machine_GroupID var and split on dots and take the first field. Write to STDOUT and you can get the results via executeShellCommandToVar call.

    Kaseya provided us with the SQL Query for this, we asked to have their procedure made available on SAAS, and after more than a year of waiting for approval (remember, it's their procedure), we gave up and wrote the app. It's now part of our Multi-Tool package, which provides a standard way to run cmdlets that provide 60 functions for math, time math, string manipulation, and similar capabilities. It works on Service Desk and from Agent Procedures.

All Replies
  • No - this is a blatantly missing capability. I wrote an app to do this, and there's a SQL query you can run if on-prem. Basically, use the vMachine.Machine_GroupID var and split on dots and take the first field. Write to STDOUT and you can get the results via executeShellCommandToVar call.

    Kaseya provided us with the SQL Query for this, we asked to have their procedure made available on SAAS, and after more than a year of waiting for approval (remember, it's their procedure), we gave up and wrote the app. It's now part of our Multi-Tool package, which provides a standard way to run cmdlets that provide 60 functions for math, time math, string manipulation, and similar capabilities. It works on Service Desk and from Agent Procedures.

  • Thanks for the reply , letting me know that K hasn't provided a solution for this yet.

    In our case the Org ID would be after everything before the 3rd dot (.) in the group name.

    example

    #vMachine.groupName#  = client.east.companyname.main

    I googled up a powershell command that will drop the the 3rd dot and everything after.

    ("#vMachine.groupName#" -split "\.")[0..2] -join "."

    result: client.east.companyname

    The resulting output equals our OrgIDs, but it's all Kentucky windage.