Jump to content
bigdessert

RMM+ ScreenConnect Plugin with Labtech Integration

Recommended Posts

Please try to donate if you can. A lot of time went into this plugin - DONATE HERE

HTTP GET-POST Plugin moved to its own topic

So we have officially released our ScreenConnect plugin on the online extension market in ScreenConnect.

Get it by going to Admin->Exentsions->Browse online extensions.

To Setup:

 

go to extension settings and create an access key. This key acts as a password so others cannot use the extension without it. Make this a nice 30+ character key.

YJ4umpw.png

3luJLu3.png

 

To Use:

The ScreenConnect plugin takes POST commands. So you need to make a web request and send POST data to it.

 

To do this in Labtech we have two ways it can be accomplished.

1. You can use powershell.

2. You can download my HTTP Get/Post Plugin Located here.

 

Examples of use:

Things you need to get from the LabTech database are the ScreenConnect GUID and you need to build the URL that you are hitting.

 

Here is how you would get the GUID of a machine in a script.

J9CHNr0.png

 

Here is how you would build the URL for the POST (note the 8e78224d-79db-4dbb-b62a-833276b46c6e is the guid of the extension. This should always be this. The ExecuteCommand is a function of the ScreenConnect plugin and needs to be changed to the command you want to run.)

iA1eXkW.png

 

Functions:

 

ExecuteCommand

(Will return the output of the command. If you have a long running command you will get no output)

PowerShell

(note that @accesskey@ should be set to the access key you setup in the ScreenConnect Plugin) The ipconfig is the command to run, the 10 is the timeout.(Note the default timeout in ScreenConnect is 10 seconds so by default 10 is the largest you can set this, but for quick commands you can alter it to 1 second or 2 seconds)

See here to increase ScreenConnect timeout https://help.screenconnect.com/Running_a_command_from_the_host_page#Increasing_number_of_characters_returned_and_timeout_value

YuQtnb9.png

 

HTTP GET/POST Plugin

ZIi8A2N.png

 

WakeGuest

(this will attempt a wake on LAN via the ScreenConnect wake on LAN method)

URL

SELECT CONCAT(URL,':',Port,'/App_Extensions/8e78224d-79db-4dbb-b62a-833276b46c6e/Service.ashx/WakeGuest') FROM plugin_screenconnect_config
 

PowerShell

powershell -command "& "Invoke-RestMethod -Method Post -Uri '@sc_url@' -Body '[\"@accesskey@\", \"@sc_guid@\"]' -ContentType 'application/json'";
 

HTTP GET/POST (Data Section)

["@accesskey@", "@sc_guid@"]
 

 

EndSession

(this will end a session)

URL

SELECT CONCAT(URL,':',Port,'/App_Extensions/8e78224d-79db-4dbb-b62a-833276b46c6e/Service.ashx/EndSession') FROM plugin_screenconnect_config
 

PowerShell

powershell -command "& "Invoke-RestMethod -Method Post -Uri '@sc_url@' -Body '[\"@accesskey@\", \"@sc_guid@\"]' -ContentType 'application/json'";
 

HTTP GET/POST (Data Section)

["@accesskey@", "@sc_guid@"]
 

 

SendChatMessage

(Note this is a one way chat thought might be useful for alerts)(chatname is the name that shows up in the chat window)

URL

SELECT CONCAT(URL,':',Port,'/App_Extensions/8e78224d-79db-4dbb-b62a-833276b46c6e/Service.ashx/SendChatMessage') FROM plugin_screenconnect_config
 

PowerShell

powershell -command "& "Invoke-RestMethod -Method Post -Uri '@sc_url@' -Body '[\"@accesskey@\", \"@sc_guid@\", \"chatname\", \"my message I am sending in chat\"]' -ContentType 'application/json'";
 

HTTP GET/POST (Data Section)

["@accesskey@", "@sc_guid@", "chatname", "my message I am sending in chat"]
 

 

IsOnline

(this will return a negative number if offline representing how many seconds it has been offline. Will return a positive number if online representing how many seconds online)

URL

SELECT CONCAT(URL,':',Port,'/App_Extensions/8e78224d-79db-4dbb-b62a-833276b46c6e/Service.ashx/IsOnline') FROM plugin_screenconnect_config
 

PowerShell

powershell -command "& "Invoke-RestMethod -Method Post -Uri '@sc_url@' -Body '[\"@accesskey@\", \"@sc_guid@\"]' -ContentType 'application/json'";
 

HTTP GET/POST (Data Section)

["@accesskey@", "@sc_guid@"]
 

 

UpdateCustomProperty

(this will update a custom property value 1-8)

the number 1 below is integer so no quotes and it represents the custom property you want to change.

URL

SELECT CONCAT(URL,':',Port,'/App_Extensions/8e78224d-79db-4dbb-b62a-833276b46c6e/Service.ashx/UpdateCustomProperty') FROM plugin_screenconnect_config
 

PowerShell

powershell -command "& "Invoke-RestMethod -Method Post -Uri '@sc_url@' -Body '[\"@accesskey@\", \"@sc_guid@\",1,\"propertyvaluetext\"]' -ContentType 'application/json'";
 

HTTP GET/POST (Data Section)

["@accesskey@", "@sc_guid@",1,"propertyvaluetext"]
 

 

HostsConnected

(this will return "No hosts connected" or ["host1","host2"] if hosts are connected)

the number 1 below is integer so no quotes and it represents the custom property you want to change.

URL

SELECT CONCAT(URL,':',Port,'/App_Extensions/8e78224d-79db-4dbb-b62a-833276b46c6e/Service.ashx/HostsConnected') FROM plugin_screenconnect_config
 

PowerShell

powershell -command "& "Invoke-RestMethod -Method Post -Uri '@sc_url@' -Body '[\"@accesskey@\", \"@sc_guid@\"]' -ContentType 'application/json'";
 

HTTP GET/POST (Data Section)

["@accesskey@", "@sc_guid@"]
 

 

AgentsOnline

(this will return GUIDS of online systems pipe separated e.g. "lgkj1k3-alkdj2-1lkjd|lkadjfd-2adlkj2-alkdjf")

URL

SELECT CONCAT(URL,':',Port,'/App_Extensions/8e78224d-79db-4dbb-b62a-833276b46c6e/Service.ashx/AgentsOnline') FROM plugin_screenconnect_config
 

PowerShell

powershell -command "& "Invoke-RestMethod -Method Post -Uri '@sc_url@' -Body '[\"@accesskey@\"]' -ContentType 'application/json'";
 

HTTP GET/POST (Data Section)

["@accesskey@"]
 

 

AgentsOffline

(this will return GUIDS of online systems pipe separated e.g. "lgkj1k3-alkdj2-1lkjd|lkadjfd-2adlkj2-alkdjf")

URL

SELECT CONCAT(URL,':',Port,'/App_Extensions/8e78224d-79db-4dbb-b62a-833276b46c6e/Service.ashx/AgentsOffline') FROM plugin_screenconnect_config
 

PowerShell

powershell -command "& "Invoke-RestMethod -Method Post -Uri '@sc_url@' -Body '[\"@accesskey@\"]' -ContentType 'application/json'";
 

HTTP GET/POST (Data Section)

["@accesskey@"]
 

UpdateName

(this will update the session name of the GUID specified)

URL

SELECT CONCAT(URL,':',Port,'/App_Extensions/8e78224d-79db-4dbb-b62a-833276b46c6e/Service.ashx/UpdateName') FROM plugin_screenconnect_config
 

PowerShell

powershell -command "& "Invoke-RestMethod -Method Post -Uri '@sc_url@' -Body '[\"@accesskey@\", \"@sc_guid@\", \"NewSessionName\"]' -ContentType 'application/json'";
 

HTTP GET/POST (Data Section)

["@accesskey@", "@sc_guid@", "NewSessionName"]
 

CreateSessionGroup

(This will create a session group. Only required item is GroupName. All other variables leave empty string if you don't want them to be added.)

URL

SELECT CONCAT(URL,':',Port,'/App_Extensions/8e78224d-79db-4dbb-b62a-833276b46c6e/Service.ashx/CreateSessionGroup') FROM plugin_screenconnect_config
 

PowerShell

powershell -command "& "Invoke-RestMethod -Method Post -Uri '@sc_url@' -Body '[\"@accesskey@\", \"tGroupName\", \"FilterExpression\", \"SubFilterExpression\", \"GroupAfterName\"]' -ContentType 'application/json'";
 

HTTP GET/POST (Data Section)

["@accesskey@", "GroupName", "FilterExpression", "SubFilterExpression", "GroupAfterName"]

 

UpdateSessionGroup

(this will update the session group items. The only required item is the CurrentGroupName. All other variables leave empty string if you don't want them to change.)

URL

SELECT CONCAT(URL,':',Port,'/App_Extensions/8e78224d-79db-4dbb-b62a-833276b46c6e/Service.ashx/UpdateSessionGroup') FROM plugin_screenconnect_config
 

PowerShell

powershell -command "& "Invoke-RestMethod -Method Post -Uri '@sc_url@' -Body '[\"@accesskey@\", \"CurrentGroupName\", \"NewGroupNameName\", \"FilterExpression\", \"SubFilterExpression\", \"GroupAfterName\"]' -ContentType 'application/json'";
 

HTTP GET/POST (Data Section)

["@accesskey@", "CurrentGroupName", "NewGroupNameName", "FilterExpression", "SubFilterExpression", "GroupAfterName"]

 

DeleteSessionGroup

(this will delete a session group based on name)

URL

SELECT CONCAT(URL,':',Port,'/App_Extensions/8e78224d-79db-4dbb-b62a-833276b46c6e/Service.ashx/DeleteSessionGroup') FROM plugin_screenconnect_config
 

PowerShell

powershell -command "& "Invoke-RestMethod -Method Post -Uri '@sc_url@' -Body '[\"@accesskey@\", \"CurrentGroupName\"]' -ContentType 'application/json'";
 

HTTP GET/POST (Data Section)

["@accesskey@", "CurrentGroupName"]

 

GetSessionIdByName

(This will return a session ID by searching machines with session name. This will return multiple if you have more than 1 session with the same session name)

URL

SELECT CONCAT(URL,':',Port,'/App_Extensions/8e78224d-79db-4dbb-b62a-833276b46c6e/Service.ashx/GetSessionIdByName') FROM plugin_screenconnect_config
 

PowerShell

powershell -command "& "Invoke-RestMethod -Method Post -Uri '@sc_url@' -Body '[\"@accesskey@\", \"Sessionname\"]' -ContentType 'application/json'";
 

HTTP GET/POST (Data Section)

["@accesskey@", "Sessionname"]

 

GetSessionIdByHostname

(This will return a session ID by searching machines with hostname. This will return multiple if you have more than 1 session with the same hostname)

URL

SELECT CONCAT(URL,':',Port,'/App_Extensions/8e78224d-79db-4dbb-b62a-833276b46c6e/Service.ashx/GetSessionIdByHostname') FROM plugin_screenconnect_config
 

PowerShell

powershell -command "& "Invoke-RestMethod -Method Post -Uri '@sc_url@' -Body '[\"@accesskey@\", \"Hostname\"]' -ContentType 'application/json'";
 

HTTP GET/POST (Data Section)

["@accesskey@", "Hostname"]

Please try to donate if you can. A lot of time went into this plugin - DONATE HERE

 

Changelog

Version 1.0.5 Added new AgentsOnline and AgentsOffline functions

Version 1.0.4 Added new HostsConnected function

Version 1.0.5 Added AgentsOnline and AgentsOffline functions

Version 1.0.6 Updated ExecuteCommand to return timeout if command doesn't complete instead of hanging.

Version 1.0.7 Added new EndSession function

Version 1.0.8 Updated ScreenConnect plugin to not wait the full timeout if data comes back sooner. This will prevent the need for setting smaller timeouts. Also when setting a timeout it automatically pre-pends the timeout value to the screenconnect command.

Version 1.0.9 Added new UpdateName function

Version 1.0.11 Added new functions CreateSessionGroup, UpdateSessonGroup and DeleteSessionGroup

Version 1.0.12 Added new functions GetSessionIdByName and GetSessionIdByHostname

 

Edited by bigdessert
  • Thanks 1

Share this post


Link to post
Share on other sites

Ben was having some issues with a command. Just an FYI if you want to use double quotes in the command you need to escape with a backslash so

\"

If you want to use a backslash you need to escape with another backslash so

\\

Share this post


Link to post
Share on other sites

Would it be difficult to add a function to modify CustomPropertyN ? Granted it's a bit out of scope of what this plugin does, but I can see it being helpful to managing ScreenConnect Session groups based on criteria in LabTech such as an Extra Data Field.

Share this post


Link to post
Share on other sites

First Off DataComm, you are the bomb for making a great plugin for SC!

 

Now for my Bomb!

 

Anyone who wants to have this whole process tied up in a nice neat little LabTech plugin say " Yeah! "

 

Your wish is my pleasure, I been working on improving our abilities to recover from sorted agent failures without the need to call and have someone manually reboot a system or restart services to get LT agents back online and functional. Today we completed a new feature that has really put this plugin in high gear. When a LT agents takes a dive nothing short of killing LT services and restarting the agent services will fix it. We can accomplish this using tools LabTech has already given us. The Screen Connect management interface allows me to use datacomm's special plugins that can issue commands down to the local agent via the Screen Connect protocols bypassing all the stuck Labtech commands and the dead agent.

 

So today we have incorporated this into the plugin allowing any Tech the ability to get LTagent rolling again in just seconds. See it happen live and in real time. How awesome is that! No special firewall settings, no RPC issues to deal with and no pre-configured domain admin accounts needed in LT passwords manager.

 

 

 

I will be packaging this up today and making it available free to anyone who wants it. You will need to install the SC plugin as described above and in our plugin set your pass code you set in SC plugin and away you go!

ScreenConnectRestarts.PNG.c4d71f2f3cf805910a678bd25041a278.PNG

Share this post


Link to post
Share on other sites
Would it be difficult to add a function to modify CustomPropertyN ? Granted it's a bit out of scope of what this plugin does, but I can see it being helpful to managing ScreenConnect Session groups based on criteria in LabTech such as an Extra Data Field.

 

I added this as a new function to the plugin. Please see original post for syntax. Update 1.0.3 published so check for plugin updates in SC.

Share this post


Link to post
Share on other sites
Would it be difficult to add a function to modify CustomPropertyN ? Granted it's a bit out of scope of what this plugin does, but I can see it being helpful to managing ScreenConnect Session groups based on criteria in LabTech such as an Extra Data Field.

 

I added this as a new function to the plugin. Please see original post for syntax. Update 1.0.3 published so check for plugin updates in SC.

 

Thank you! :)

I'm happy to report that this works very well. I'm now able to easily classify agents for use by our teams. I set up session groups for each team and restricted to AD group membership.

Share this post


Link to post
Share on other sites
First Off DataComm, you are the bomb for making a great plugin for SC!

 

Now for my Bomb!

 

Anyone who wants to have this whole process tied up in a nice neat little LabTech plugin say " Yeah! "

 

Your wish is my pleasure, I been working on improving our abilities to recover from sorted agent failures without the need to call and have someone manually reboot a system or restart services to get LT agents back online and functional. Today we completed a new feature that has really put this plugin in high gear. When a LT agents takes a dive nothing short of killing LT services and restarting the agent services will fix it. We can accomplish this using tools LabTech has already given us. The Screen Connect management interface allows me to use datacomm's special plugins that can issue commands down to the local agent via the Screen Connect protocols bypassing all the stuck Labtech commands and the dead agent.

 

So today we have incorporated this into the plugin allowing any Tech the ability to get LTagent rolling again in just seconds. See it happen live and in real time. How awesome is that! No special firewall settings, no RPC issues to deal with and no pre-configured domain admin accounts needed in LT passwords manager.

 

[attachment=0]ScreenConnectRestarts.PNG[/attachment]

 

I will be packaging this up today and making it available free to anyone who wants it. You will need to install the SC plugin as described above and in our plugin set your pass code you set in SC plugin and away you go!

 

Just an FYI for those using Cubert's integration, I had an issue with the password I used in both the LT plugin and the SC extension. Not sure on which end the fault lies, but if you are using a string random password generator, I had to only use standard characters and not symbols, etc.

 

-Tim

Share this post


Link to post
Share on other sites

Yes that would be accurate, version 1 of our stuff may have issues saving to SQL any special chars like quotes, semicolons and apostrophes... We did not "normalize" that field first. Thats our bad, try to get it updated here...

Share this post


Link to post
Share on other sites

Its just a SQL query so immediately after install of plugin.

 

Keep in mind we only show systems that show "executing" commands at the time you open the plugin. If systems do not have currently running commands then they will not show up in the list.

Share this post


Link to post
Share on other sites

Thank you! I see that it only shows systems that show "executing" commands at the time you open the plugin. :-) I was thinking it was going to see machines that are not checking in to the LT server even though the LT agent is installed and the machine is online.

Share this post


Link to post
Share on other sites

@Cubert - as we have a lot of Macs, any chance you could add logic that would detect Win / Lin / Mac and run the right command to kill/restart based on the OS type?

Share this post


Link to post
Share on other sites

We would need to look at the MAcs and Linux differently but yes. We would need to look at doing an ssh session with the Mac or Linux pulling permissions from LabTech to login and recycle the services.

 

Our same logic we use for the finding of a valid RPC system for windows could be used to get an good agent to do cmds on. LabTech scripting can provide the shell access so I do not see any reason that couldn't be done fairly easily.

 

Lets see what the next versions will bring.

Share this post


Link to post
Share on other sites

I was looking at just leveraging ScreenConnect to push the commands on Mac.

 

It would also be nice (until Mac/Linux support comes) to perhaps have a way to filter on OS... ie, drop down to select the display of just Windows machines.

Share this post


Link to post
Share on other sites

I'm very new to LabTech and would very much like to make use of this. I have added the extension to ScreenConnect. I am unable to setup the HTTP - GET - POST plugin but was unable to. Because of that, I have tried to get this working using your examples with PowerShell. However, I think I'm missing something. I don't understand how to assemble everything you have put here into a workable script. I have tried creating a script using the screenshots above, but the PowerShell script fails. I would really appreciate some assistance so that I can make use of this. I regularly have systems where some servers show as offline, but they aren't. The services have just stopped.

Share this post


Link to post
Share on other sites

Everything looks right. Are you switching the computerid to the RMM server or another working machine before running the powershell or HTTP-GET-POST plugin? It must be run from another machine or it will fail when systems are offline.

 

Can you drop to a command line on say your LT server and run the powershell with static variables?

Share this post


Link to post
Share on other sites

I have the system open in LabTech and I click on Begin, Scripts and then the script I created, so I know it is running against the agent. I can't run the HTTP-GET-POST plugin because it isn't letting me add it. I have the hosted version, so I can't do much of anything on the LT Server.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×