Jump to content
mcmcghee

ScreenConnect - Direct Connection

Recommended Posts

I'm getting a similar error with the same configuration as above, windows 8.1. IE is default browser.

 

The issue for me is probably something to do with the fact that we have ScreenConnect's IIS component installed as a sub-site under our Labtech server in the mode where it shares the SSL certificate, so the path required currently is :

 

https://labtech.foobar.com/RemoteSupport/LaunchHostClient.ashx?ID=BgIAAACkAABSU0ExAAgAAAEAAQDpYbB3cqDG

 

This results in the following ASP error:

 

Sequence contains no matching element


Sequence contains no matching element 
 Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.InvalidOperationException: Sequence contains no matching element

Source Error: 


The source code that generated this unhandled exception can only be shown when compiled in debug mode. To enable this, please follow one of the below steps, then request the URL:

1. Add a "Debug=true" directive at the top of the file that generated the error. Example:

  <%@ Page Language="C#" Debug="true" %>

or:

2) Add the following section to the configuration file of your application:







Note that this second technique will cause all files within a given application to be compiled in debug mode. The first technique will cause only that particular file to be compiled in debug mode.

Important: Running applications in debug mode does incur a memory/performance overhead. You should make sure that an application has debugging disabled before deploying into production scenario.  

Stack Trace: 

[invalidOperationException: Sequence contains no matching element]
  System.Linq.Enumerable.First(IEnumerable`1 source, Func`2 predicate) +2615110
  LaunchHostClient.ProcessRequest(HttpContext context) +274
  System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +341
  System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +69

 

Hopefully that's enough info without enabling the debug code. Is this down to the IIS configuration?

Share this post


Link to post
Share on other sites

Hey All,

 

I am getting the URI error as well. Through some troubleshooting I think I know what is wrong, but not how to fix it in the powershell script. my screenconnect url is http://my.screenconnect.com:8080'>http://my.screenconnect.com:8080 So it is no on port 80.

 

When I tried accessing the LaunchHostClient.ashx to http://my.screenconnect.com it fails. When I add in the :8080 it opens.

 

Problem is I am not sure how to correct this in the script.

 

Does anyone else have any ideas? This could be why others are having problems as well.

Share this post


Link to post
Share on other sites

The powershell event logs may help...

 

Error Message = The remote server returned an error: (401) Unauthorized.

Fully Qualified Error ID = WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand

 

 

Context:

Severity = Warning

Host Name = ConsoleHost

Host Version = 4.0

Host ID = 7955514d-c441-472c-8633-b9165afc3de4

Host Application = C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe $F=$env:USERPROFILE+'\ScreenConnectCredentials.xml';$E=Test-Path $F;if($E -eq $false){get-credential|EXPORT-CLIXML $F};$c=IMPORT-CLIXML $F;$a=$c.GetNetworkCredential().password;$r=invoke-webrequest -uri https://www.inserturlhere.com/LaunchHostClient.ashx?ID= -Headers @{Authorization='Basic '+[system.Convert]::ToBase64String([system.Text.Encoding]::UTF8.GetBytes($c.username+':'+$a))};Invoke-Expression 'rundll32 dfshim.dll,ShOpenVerbApplication $r.content'

Engine Version = 4.0

Runspace ID = 72654d0c-7626-419a-8770-cfdfa852e795

Pipeline ID = 1

Command Name = Invoke-WebRequest

Command Type = Cmdlet

Script Name =

Command Path =

Sequence Number = 15

User = hugoZhackenbush

Shell ID = Microsoft.PowerShell

 

 

User Data:

Share this post


Link to post
Share on other sites

Sorry guys I've been swamped. I'll try to help the best that I can. For those that are having problems, please provide the following:

 

Screenconnect Version:

Windows Version:

Powershell Version:

 

Also, verify that %userprofile%\ScreenConnectCredentials.xml exists. It probably wouldn't hurt to delete that file and save your credentials again.

Two factor authentication must be off (I believe someone said this fixed it for them)

 

As far as ports, etc: Our setup is on a separate box than our LT server and using port 80.

 

If you are using a port other than 80 AND/OR have screenconnect on your LT server AND it works, can you please post so we can help troubleshoot those with problems?

Share this post


Link to post
Share on other sites

Screenconnect Version: 5.1.8341.5506

Windows Version: Windows version 6.3 (Build 9600) (8.1)

Powershell Version: File version 6.3.9600.17415 (version 4)

Removed and recreated ScreenConnectCredentials.xml

We use HTTPS for ScreenConnect and it is on a separate server from Labtech

Share this post


Link to post
Share on other sites
Screenconnect Version: 5.1.8341.5506

Windows Version: Windows version 6.3 (Build 9600) (8.1)

Powershell Version: File version 6.3.9600.17415 (version 4)

Removed and recreated ScreenConnectCredentials.xml

We use HTTPS for ScreenConnect and it is on a separate server from Labtech

 

Are you using a self signed SSL cert?

 

Regardless, try running this from powershell- replacing the url and GUID.

 

$F=$env:USERPROFILE+'\ScreenConnectCredentials.xml';$E=Test-Path $F;if($E -eq $false){get-credential|EXPORT-CLIXML $F};$c=IMPORT-CLIXML $F;$a=$c.GetNetworkCredential().password;[Net.ServicePointManager]::ServerCertificateValidationCallback={$true};$r=invoke-webrequest -uri  https://your.screenconnect.com/LaunchHostClient.ashx?ID=%eScreenConnect GUID% -Headers @{"Authorization"='Basic '+[system.Convert]::ToBase64String([system.Text.Encoding]::UTF8.GetBytes($c.username+':'+$a))};Invoke-Expression 'rundll32 dfshim.dll,ShOpenVerbApplication $r.content'

 

This should (hopefully) ignore any SSL errors...

 

If it works:

 

1. Let us know!

2. Its unfortunately too long to fit in the menu field. You could try saving it as a powershell script in your %userprofile% and have the menu command run it.

Share this post


Link to post
Share on other sites

Hello, I am having the following issue. I would like to know if anyone was able to fix this:

 

PLATFORM VERSION INFO

Windows : 6.1.7601.65536 (Win32NT)

Common Language Runtime : 4.0.30319.18444

System.Deployment.dll : 4.0.30319.34244 built by: FX452RTMGDR

clr.dll : 4.0.30319.18444 built by: FX451RTMGDR

dfdll.dll : 4.0.30319.34244 built by: FX452RTMGDR

 

ERROR SUMMARY

Below is a summary of the errors, details of these errors are listed later in the log.

* Activation of resulted in exception. Following failure messages were detected:

+ Invalid URI: The URI is empty.

 

COMPONENT STORE TRANSACTION FAILURE SUMMARY

No transaction error was detected.

 

WARNINGS

There were no warnings during this operation.

 

OPERATION PROGRESS STATUS

No phase information is available.

 

ERROR DETAILS

Following errors were detected during this operation.

* [2/6/2015 1:18:18 AM] System.UriFormatException

- Invalid URI: The URI is empty.

- Source: System

- Stack trace:

at System.Uri.CreateThis(String uri, Boolean dontEscape, UriKind uriKind)

at System.Deployment.Application.ApplicationActivator.ActivateDeploymentWorker(Object state)

 

COMPONENT STORE TRANSACTION DETAILS

No transaction information is available.

 

 

ScreenConnect Version: 5.1.8341.5506

Windows Version:

Major Minor Build Revision

----- ----- ----- --------

6 1 7601 65536

 

Powershell Version: 4.0

 

We use port 8041 for the connection and the server runs on port 80. This is a Linux box running Centos.

Share this post


Link to post
Share on other sites

forgot to post my code that I use in my menu button:

 

$F=$env:USERPROFILE+'\ScreenConnectCredentials.xml';$E=Test-Path $F;if($E -eq $false){get-credential|EXPORT-CLIXML $F};$c=IMPORT-CLIXML $F;$a=$c.GetNetworkCredential().password;$r=invoke-webrequest -uri http://connect.domain.com/LaunchHostClient.ashx?ID=%eScreenConnect GUID% -Headers @{"Authorization"='Basic '+[system.Convert]::ToBase64String([system.Text.Encoding]::UTF8.GetBytes($c.username+':'+$a))};Invoke-Expression 'rundll32 dfshim.dll,ShOpenVerbApplication $r.content'

Share this post


Link to post
Share on other sites
Screenconnect Version: 5.1.8341.5506

Windows Version: Windows version 6.3 (Build 9600) (8.1)

Powershell Version: File version 6.3.9600.17415 (version 4)

Removed and recreated ScreenConnectCredentials.xml

We use HTTPS for ScreenConnect and it is on a separate server from Labtech

 

Are you using a self signed SSL cert?

 

Regardless, try running this from powershell- replacing the url and GUID.

 

$F=$env:USERPROFILE+'\ScreenConnectCredentials.xml';$E=Test-Path $F;if($E -eq $false){get-credential|EXPORT-CLIXML $F};$c=IMPORT-CLIXML $F;$a=$c.GetNetworkCredential().password;[Net.ServicePointManager]::ServerCertificateValidationCallback={$true};$r=invoke-webrequest -uri  https://your.screenconnect.com/LaunchHostClient.ashx?ID=%eScreenConnect GUID% -Headers @{"Authorization"='Basic '+[system.Convert]::ToBase64String([system.Text.Encoding]::UTF8.GetBytes($c.username+':'+$a))};Invoke-Expression 'rundll32 dfshim.dll,ShOpenVerbApplication $r.content'

 

 

We are using a purchased SSL cert. Below is the error I get when I run what you provided.

 

invoke-webrequest : The underlying connection was closed: An unexpected error occurred on a send.

At line:1 char:252

+ $F=$env:USERPROFILE+'\ScreenConnectCredentials.xml';$E=Test-Path $F;if($E -eq $f ...

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [invoke-WebRequest], WebExc

eption

+ FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand

Share this post


Link to post
Share on other sites

I'm also experiencing the same issues as Hugoh.

 

Also, when I attempt to access http://your.screenconnect.com/LaunchHostClient.ashx I get the below runtime error:

 

Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed (for security reasons).

 

Details: To enable the details of this specific error message to be viewable, please create a tag within a "web.config" configuration file located in the root directory of the current web application. This tag should then have its "mode" attribute set to "Off".

 

 

 

 

Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's configuration tag to point to a custom error page URL.

 

 

 

 

Screenconnect Version: 5.1.8341.5506

Windows Version: Windows 7 Pro (framework 4.5)

Powershell Version: 4

 

Really hope to get this going, any help would be appreciated, thanks!

Share this post


Link to post
Share on other sites

WOW! Thank you for the additions, and thanks for the OP for the original scripts! This is simply the best addition to LabTech I've ever done. We have had so much Hell with the RDP capabilities sometimes working, sometimes not, that the techs were about to revolt!

 

I got this working, made some tweaks, tested, and then rolled out to all my endpoints. The techs think I'm the hero. You guys are AWESOME!

Share this post


Link to post
Share on other sites

Well I just found out that LabTech/ConnectWise just purchased ScreenConnect. Now from what i am hearing is that they are going to offer it for free with minimal features.

 

When you roll out your agent it will also install ScreenConnect. Now this is for the version 10 release. Not sure if labtech is getting revamped the look and feel also.

 

So not sure if they will let us use our current version of screenconnect.

Share this post


Link to post
Share on other sites

For anyone still using this, be aware that 5.3 breaks it, but it can be fixed by changing the two lines that reference "Elsinore.ScreenConnect" to just "ScreenConnect".

 

Edit - Nevermind, I am still having issues.

Share this post


Link to post
Share on other sites

In addition to the last post you need to edit the ashx file to change Bin/ScreenConnect.WindowsClient.application to just Bin/ScreenConnect.Client.application, works for me after this change on 5.3

Share this post


Link to post
Share on other sites

Anyone test on Windows 10?

I have had the deployment working for months (thx to all above) using a menu, but have been told that Win10 breaks it.

Maybe an issue with Powershell 5?

 

IMPORT-CLIXML : Key not valid for use in specified state.
At line:1 char:123
+ ...  $false){get-credential|EXPORT-CLIXML $F};$c=IMPORT-CLIXML $F;$a=$c.G ...
+                                                  ~~~~~~~~~~~~~~~~
   + CategoryInfo          : NotSpecified: ( [import-Clixml], CryptographicException
   + FullyQualifiedErrorId : System.Security.Cryptography.CryptographicException,Microsoft.PowerShell.Commands.ImportClixmlCommand

You cannot call a method on a null-valued expression.
At line:1 char:140
+ ... $F};$c=IMPORT-CLIXML $F;$a=$c.GetNetworkCredential().password;[Net.Se ...
+                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   + CategoryInfo          : InvalidOperation: ( [], RuntimeException
   + FullyQualifiedErrorId : InvokeMethodOnNull

invoke-webrequest : The remote server returned an error: (401) Unauthorized.
At line:1 char:252
+ ... ={$true};$r=invoke-webrequest -uri http:/// ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   + CategoryInfo          : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [invoke-WebRequest], WebException
   + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand

Share this post


Link to post
Share on other sites

Anyone had any luck getting this to work on LT10? From what I can tell it is not working because the EDF GUID filed has been removed in LT10 from the computer screen.

Share this post


Link to post
Share on other sites
Anyone had any luck getting this to work on LT10? From what I can tell it is not working because the EDF GUID filed has been removed in LT10 from the computer screen.

You need to use the script found here in order to generate the Screenconnect GUID edf.

 

OP posted it as a requirement.

 

I got this working with LT10 and SC 5.3.9 thanks OP! Here are some of the issues I ran into:

 

1. (Thanks to the couple posters above) The file C:\Program Files (x86)\ScreenConnect\LaunchHostClient.ashx needed to be changed to

<%@ WebHandler Language="C#" Class="LaunchHostClient" %>

   using System;
   using System.Web;
   using System.Collections.Generic;
   using System.Linq;
   using System.Configuration;
   using ScreenConnect;

   public class LaunchHostClient : IHttpHandler
   {
       public void ProcessRequest(HttpContext context)
       {
           Permissions.AssertPermission(PermissionInfo.JoinSessionPermission, false);

           var sessionID = context.Request.QueryString["ID"];
           var relayUri = ServerExtensions.GetRelayUri(ConfigurationManager.AppSettings, HttpContext.Current.Request.Url, true, true);

           using (var sessionManager = ServiceChannelPool.Instance.Borrow())
           {
               var sessionSummary = sessionManager.GetSessions("All Machines", new Dictionary(), null).First(ss => ss.SessionID.ToString() == sessionID);

               var clp = new ClientLaunchParameters();
               clp.Host = relayUri.Host;
               clp.Port = relayUri.Port;
               clp.SessionID = sessionSummary.SessionID;
               clp.ProcessType = ProcessType.Host;
               clp.EncryptionKey = ServerCryptoManager.Instance.PublicKey;
               clp.AccessToken = ServerCryptoManager.Instance.GetAccessToken(clp.SessionID, clp.ProcessType, context.User.Identity.Name, SessionPermissions.HostWithoutRemoteConsent | SessionPermissions.RunSharedTool | SessionPermissions.TransferFiles | SessionPermissions.ManageSharedToolbox, DateTime.MinValue);

               clp.SessionTitle = sessionSummary.Name;

               var url = new Uri(context.Request.Url, "Bin/ScreenConnect.Client.application" + ClientLaunchParameters.ToQueryString(clp));
               context.Response.Write(url.AbsoluteUri);
           }
       }

       public bool IsReusable { get { return false; } }
   }

 

2. I had to correct the URL inside of the powershell command to $r=invoke-webrequest -uri http://your.screenconnect.com:8040/LaunchHostClient.ashx?ID=%eScreenConnect GUID%

 

3. Had to "Load Properties and Views" since the ScreenConnect GUID edf was not getting populated even though it was there.

Share this post


Link to post
Share on other sites

Thanks. I really appreciate this. I am running into a new issues now however. The Screenconnect GET GUID script is failing on Step 5 with the following:

 

The script(5254) failed in the THEN section at step 5

 

Start Screenconnect Get GUID

IF Software Installed Parameter1: %screenconnect% Parameter2: Parameter3: Time Taken: 34051.9816858

L1 Shell Parameters Hidden Time Taken: 34052.086695

L2 Variable Set Parameter1: 0 Parameter2: HKEY_LOCAL_MACHINE\SYSTEM\Curr Parameter3: scstring Time Taken: 34056.1967083

L3 Script String Functions Parameter1: 22 Parameter2: "C:\Program Files (x86)\Screen Parameter3: = Time Taken: 34059.3017347

L4 Script String Functions Parameter1: 0 Parameter2: 432ca15d-c618-40b3-a4bc-87c8e1 Parameter3: 36 Time Taken: 34059.402742

L5 ExtraData Set Value Parameter1: 5bd6af1a-78bb-11e3-8993-00155d Parameter2: 4980 Parameter3: 432ca15d-c618-40b3-a4bc-87c8e1 Time Taken: 34059.5037332

 

 

I have created 2 EDF fields and can see them under the default tab

 

Screenconnect GUID

ScreeenConnect Linked

 

When I try to edit the script I cant even look at step 5 and get the following error:

 

error loading script: Syntax error: Missing operand after 'bd6af1a' operator

 

Any help is appreciated!

Share this post


Link to post
Share on other sites

You may just want to try to redo the script again.

I also try NOT to use spaces in my EDFs, spaces can be evil.

I would go with an Underscore instead of the space on your EDFs, adjust your scripts accordingly, and try again.

Share this post


Link to post
Share on other sites

For us It was workinng earlier, but we recently updated to ScreenConnect 5.3.9074.5646 and now we are getting following error:

 

Server Error in '/' Application.

 

Runtime Error

Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.

 

Details: To enable the details of this specific error message to be viewable on remote machines, please create a tag within a "web.config" configuration file located in the root directory of the current web application. This tag should then have its "mode" attribute set to "Off".

 

 

 

 

 

 

Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's configuration tag to point to a custom error page URL.

 

 

 

 

Share this post


Link to post
Share on other sites
For us It was workinng earlier, but we recently updated to ScreenConnect 5.3.9074.5646 and now we are getting following error:

 

Server Error in '/' Application.

 

As pointed out by a few posters you need to update your LaunchHostClient.ashx file.

 

Copy and paste what I have in the code area a few posts above yours.

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

×