Jump to content
bigdessert

RMM+ ScreenConnect Plugin with Labtech Integration

Recommended Posts

Are you talking about the Screen Connect plugin that's installed on the LT server or the RMM+ extension on the Screen Connect server?

Share this post


Link to post
Share on other sites

What version of PowerShell is installed?  If you are running this on a Windows 7 machine that never had PowerShell upgraded, then it is going to be version 2.  The Invoke-RestMethod cmdlt was not introduced until version 3.  

Share this post


Link to post
Share on other sites

I'm running version 4.0

 

Just an FYI, I was able to successfully run an ipconfig command. I am getting this error when trying to run the wake command

Share this post


Link to post
Share on other sites
7 hours ago, wdyoung said:

I'm trying to use the Wake Command in a script and am getting the following error

Invoke-RestMethod : {"errorType":"ArgumentException","message":"Unable to 
convert arguments to corresponding parameter types","detail":null}
At line:1 char:1
+ & Invoke-RestMethod -Method Post -Uri 'https://MYSERVER:443/App_ ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:Htt 
   pWebRequest) [Invoke-RestMethod], WebException
    + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShe 
   ll.Commands.InvokeRestMethodComman

 

Below is the script I'm working with

image.thumb.png.744d107efd911cc4c159258969ee25dc.png

 

I also tried running the command w/ iMurphy's scripts and received the same error. 

 

What's with the double quote in front of the word Invoke?  I can't see how it would be acceptable. When calling PowerShell from the command line, you wrap the entire block in DOUBLE quotes. and every double quote character inside the block MUST have a backslash to escape it. Every double quote looks properly escaped except that one, and it doesn't appear to match to any other quote....

Share this post


Link to post
Share on other sites

Thanks Darren, 

I've moved up 3 characters :-) Here's my updated command

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

 

The shell results are now 

Invoke-RestMethod : {"errorType":"ArgumentException","message":"Unable to 
convert arguments to corresponding parameter types","detail":null}
At line:1 char:4
+ & {Invoke-RestMethod -Method Post -Uri 'https://MYSERVER:443/App ...
+    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:Htt 
   pWebRequest) [Invoke-RestMethod], WebException
    + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShe 
   ll.Commands.InvokeRestMethodCommand

Share this post


Link to post
Share on other sites

It's the little things.....

Line 1 - You retrieve the SC GUID into a variable: scguid
Line 3 - You attempt to pass the GUID on the command line using a variable: sc_guid

That's potentially one of the dangers of pulling code from multiple sources.

Share this post


Link to post
Share on other sites

Is this plugin still available in the market place? I found the RMM+ Password one but I'm not seeing RMM+. I do have it installed on my Production Environment from months ago but i just got CWC/SC setup in my dev environment and RMM+ isn't showing up in the available extensions.

CWC/SC version: 6.4.16361.6527

Share this post


Link to post
Share on other sites

Thought I would share this one in case anyone else has been trying to do the same type of powershell inception using RMM+ -- getting the syntax and escape characters right was causing me headaches, but I was able to successfully use RMM+ to remotely execute a powershell script over HTTPS.

powershell -command "& "Invoke-RestMethod -Method Post -Uri '@sc_CMD_url@' -Body '[\"@sc_accesskey@\", \"@sc_guid@\", \"powershell -Command (iex ((new-object net.webclient).DownloadString(''https://LTURL/labtech/transfer/scripts/scriptname.ps1'')))\", \"10\" ]' -ContentType 'application/json'";

 

Share this post


Link to post
Share on other sites

Good afternoon,

Our LT server is hosted. We're on LT12 120.269

I'm able to run the post commands via powershell without issue when the LTService and LTSvcmon are running on a target computer. I've successfully run the ExecuteCommand (net stop ltsvcmon & net stop ltservice)  , SendChatMessage and IsOnline.

Scripts do not complete when the LTService and LTSvcmon services are stopped. Screenconnect is running, I can connect to the machine or use the ScreenConnect console to send command and receive responses -- but the commands (SendChatMessage, ExecuteCommand and IsOnline) do not complete.  

My main goal is to monitor for offline agents and then to run a script to start the LTService and LTSvcmon. 

Thoughts?

Share this post


Link to post
Share on other sites

Is your SC and LT on the same server?  I have that type of setup and wrote a simple powershell script for that server to check for offline LT agents and then restart the ones that are offline thru the SC command "sc start ltservice".

Share this post


Link to post
Share on other sites

Hi axiomcrs, thanks for the quick response.

The SC and LT are on the same server hosted by LabTech. The server is pretty well locked down -- I don't have access to folders or command line. 

Is SC and LT hosted for you as well? 

It doesn't make sense the scripts do not work when the LT services are stopped. 

Share this post


Link to post
Share on other sites

My SC/LT server is on-premises.

Perhaps moving it to on-premises is an option.

You would have to run a script on the LT server to gather the offline agents and then pass that to a script for the SC server to run that SC command on each of the offline LT agents.  It is possible.

Perhaps you can join the slack group for LT.  It is very active and there are many expert contributors.

Share this post


Link to post
Share on other sites

Does anyone else see the plugin on the SC marketplace? I am looking to install it but, unless I'm blind, I'm not seeing it on any of the tabs.

Share this post


Link to post
Share on other sites

@bigdessert, would it be possible at some point to add in a function to change the session name?

 

Normally I just manually add the function into the Service.ashx, but it might be useful to have in the production version of it.  Would certainly make it easier for me since I always forget to re-add it.  

 

If this is something you decide to add, here is the code I had been adding into the service file if it makes it any easier for you:

 

	public object UpdateName(string key, Guid sessionID, string newname)
    {
        if(AccessKey == "")
        {
            return "Access Key Not Set";
        }
        if(key != AccessKey)
        {
            return "Wrong Key";
        }
        var s = SessionManagerPool.Demux.GetSession(sessionID);
        if (s == null) return "Session Not Found";
        string name = s.Name;
        SessionManagerPool.Demux.UpdateSession(s.Host, sessionID, newname, s.IsPublic, s.Code, s.CustomPropertyValues);
            return "Name " + newname + " set";
    }

 

Share this post


Link to post
Share on other sites

New version 1.0.10 should be approved this week. Adds 3 new functions CreateSessionGroup, UpdateSessionGroup and DeleteSessionGroup. Read OP for values needed.

Share this post


Link to post
Share on other sites

Playing around with this but can't for the life of me get a response from 'isonline' other things are working fine though? Am I missing something of is 'isonline' broken? I did run a quick search and confirmed the sessionid I am looking for is there.

 

image.png

image.png

Share this post


Link to post
Share on other sites

Everything looks right. I would take your command and copy into a notepad and make sure you aren't getting some funky spaces or something. If your access key is wrong it will say "wrong key" if the session ID isn't right it will say "session not found" so something else is going on here and I have a hunch there is some hidden spacing at the end or something.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...