logo

The ConnectWise Control forum has moved to ConnectWise University! This forum has been locked and is in read-only mode. Click here for instructions on how to access the new forum.

Welcome Guest! You can not login or register.

Notification

Icon
Error

Options
Go to last post Go to first unread
pingo  
#1 Posted : Wednesday, September 17, 2014 10:44:30 AM(UTC)
pingo


Rank: Newbie

Joined: 9/12/2014(UTC)
Posts: 5
Slovenia

Thanks: 1 times
Hello.

We are evaluating screenconnect and being able to autoconnect to a session from the command line on both Guest and Host side is the most desired feature for us.

It looks like screenconnect should be able to support this and many other features, but it definitely lacks documentation and so I am asking for help here.

I am experimenting with what has been written in this and that thread and I would like to do something similar. I tried various combinations of options but cannot get the client to connect.

Let's say we have...
Web interface at: http://screenconnect.example.com
web.config:
Code:

<add key="AsymmetricKey" value="[REDACTED]" />
<add key="WebServerListenUri" value="http://+:80/" />
<add key="RelayListenUri" value="relay://+:443/" />


UserPostedImage
From the above I have deduced that session Id is: ca05ca61-ce38-45c2-9235-c66481a35582
And Session name: TestGuestSession

What should the command line look like to connect the Guest to the above session?

I tried assembling the following command:

Code:
Elsinore.Screenconnect.WindowsClient.exe "y=Guest&h=http://screenconnect.example.com&p=80&s=ca05ca61-ce38-45c2-9235-c66481a35582&k=BwIAAACkAABSU0EyAAgAAAEAAQC5XINu521McWkbtwvlKIzITL2UGwWhM2HMYpKBrqmSDBdtg1RjqrzctccNdS0OIq2hGw+reB0vdpvgPPYAoRnMtHOUV9dqRxim7VIk0yRiK+3Y3XlGEkUa8+/pIXMTW+Z5/aMrsBBh+SwaZ5yPBLpwb506ZO6N44GWQJn9TY8WqOInSDpQVPaGNvn6DypC9Qj9fXTo1zOPQ0EK/hm4eo8ksUaRCFmL2i6M7IrfBbrF+GwbDSlBUggt7Vx++XGyHG2R8bgKbMKhLrLu/7ybP0wuFrMgU8Rd6TwnppVACSaEIo4bjdpNqmIDCajIYYkqCOC6ARyIzMJWaVTp7Z7tmsy58XgVnO994PSftIJVcK7MlKXkCS0WlUJpOxTQ79se356n2uJo0dftN3Esr+1oG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d4LPs5E1lvlaUn3AAg7wcIkbhcGSAblOdL9U/pY/fLbjuP+FtQkXrTS4p10=&i=TestGuestSession"


The process itself starts but it does not connect to the session. I also tried with Elsinore.Screenconnect.ClientService.exe, same deal.

Any hints on what I might be doing wrong? How to debug?

Edited by moderator Wednesday, November 30, 2016 8:37:09 PM(UTC)  | Reason: Not specified

wadi1982  
#2 Posted : Wednesday, September 17, 2014 10:58:21 AM(UTC)
wadi1982


Rank: Advanced Member

Medals: Level 1: Random Act of Kindness! Received One Thanks!

Joined: 9/3/2014(UTC)
Posts: 31
Germany

Was thanked: 1 time(s) in 1 post(s)
At the first look i see no error.

Do you have these files in the same folder ?

- Client.en-US.resources
- Client.resources
- Elsinore.ScreenConnect.Client.dll
- Elsinore.ScreenConnect.ClientService.exe
- Elsinore.ScreenConnect.Core.dll
- Elsinore.ScreenConnect.Windows.dll
- Elsinore.ScreenConnect.WindowsClient.exe

Which version of SC do you use ?
pingo  
#3 Posted : Wednesday, September 17, 2014 11:12:49 AM(UTC)
pingo


Rank: Newbie

Joined: 9/12/2014(UTC)
Posts: 5
Slovenia

Thanks: 1 times
Thanks for the quick reply.

Basically I copied whole C:\Program Files\ScreenConnect\Bin folder from the server to the Guest machine and also copied Client.resx and Client.en-US.resx. Then I tried running WindowsClient and ClientService from the command line.

The version would be 5.0.7541.5364
wadi1982  
#4 Posted : Wednesday, September 17, 2014 12:03:41 PM(UTC)
wadi1982


Rank: Advanced Member

Medals: Level 1: Random Act of Kindness! Received One Thanks!

Joined: 9/3/2014(UTC)
Posts: 31
Germany

Was thanked: 1 time(s) in 1 post(s)
I think the resourcefiles are wrong.
I try to explain in my bad english ;-)

I use the .resources file, not the .resx.
The content is different.

You can get the needed files with a trick.

Perhaps a screenconnect representativ can tell us a better way if it exists ;-)

Notice, you must be quick ;-)
Try to join a session as guest over the website.
After the click on "Join" there is a window for few seconds.
In the left bottom corner there is a link "System Profiles".
Click it. In the list that is shown choose "Windows....Default".
Then "Windows Selector" and then "Download app".
Install the downloaded EXE.
Now in you PC under Program file x86\screenconnect Client xxxxxx\ you find all files.

Hope you understand my english ;-)
thanks 1 user thanked wadi1982 for this useful post.
pingo on 9/17/2014(UTC)
Scott  
#5 Posted : Wednesday, September 17, 2014 12:43:59 PM(UTC)
Scott


Rank: Administration

Medals: Level 4: Wise Old Owl! Received 100 Thanks!

Joined: 3/28/2014(UTC)
Posts: 2,862
United States

Thanks: 3 times
Was thanked: 351 time(s) in 303 post(s)
Try passing the parameters to either Elsinore.ScreenConnect.Client.application or Elsinore.ScreenConnect.Client.exe, it looks like you're passing the information to the Access client, not to the Support bootstrapper.
ScreenConnect Team
pingo  
#6 Posted : Wednesday, September 17, 2014 1:03:35 PM(UTC)
pingo


Rank: Newbie

Joined: 9/12/2014(UTC)
Posts: 5
Slovenia

Thanks: 1 times
wadi1982 thank you very much for the last post. Your instructions were very clear. I never noticed the small "System Profiles" hyperlink. Now I got it to connect. I compared the command line parameters that ClientSetup.exe was using to launch the client with what I was using.

I was able to spot three differences:
1. The "k" parameter that is used is something different than what is written web.config under <add key="AsymmetricKey"> setting.
3. The host parameter doesn`t have "http://" specified
3. The "p" parameter is set to 443 instead 80

Not sure which of these was the main culprit but now it works.


And now the second part of the puzzle, how do I assemble the command line parameters for autoconnecting the client in Host mode?

I have noticed two differences:
- y=Host
- an additional parameter: "n" with some changing value, is this the session access token? If yes, is there any way to determine this token? Either manually or programatically?
wadi1982  
#7 Posted : Wednesday, September 17, 2014 1:16:07 PM(UTC)
wadi1982


Rank: Advanced Member

Medals: Level 1: Random Act of Kindness! Received One Thanks!

Joined: 9/3/2014(UTC)
Posts: 31
Germany

Was thanked: 1 time(s) in 1 post(s)
With the windowsclient.exe it works well.
I think the only problem is the wrong resource-file.

Passing the params directly to the .application is also makeable and a good way if you want to make sure that the Guest have the newest Client in use.
But it was not so easy (if you don't want to start a browser) to find that out ;-)

If I have more time I write a documentation how to start it several ways.

The best way I found for me to start the .application was to write a own extension with code like this

Code:
public object CreateSession(string Sessionname, string Accesscode)
	{
       
        var retSessionID = SessionManagerPool.Demux.CreateSession(null, SessionType.Support, Sessionname, null, false, Accesscode, null).SessionID;
		var relayUri = ServerExtensions.GetRelayUri(ConfigurationManager.AppSettings, HttpContext.Current.Request.Url, true, true);
        var handlerUrl = new Uri(HttpContext.Current.Request.Url, HttpRuntime.AppDomainAppVirtualPath) + WebConfigurationManager.GetHandlerPath(typeof(ClickOnceDirectHandler)).ReplaceFirst("*", WebResources.GetString("FileDownload.BaseName"));
        
        return handlerUrl + ClientLaunchParameters.ToQueryString(new ClientLaunchParameters
        {
            Host = relayUri.Host,
            Port = relayUri.Port,
            EncryptionKey = ServerCryptoManager.Instance.PublicKey,
            SessionType = SessionType.Support,
            SessionID = retSessionID,
            ProcessType = ProcessType.Guest,
            SessionTitle = SitzungsName
                               
        });
	}


If you call

http://URLTOYOURSERVER/app_extension/extension_id/Service.ashx/CreateSession/MyName/MyCode

You create a new session and got back a complete .application String.

This String you can use in commandline like

Presentationhost.exe -launchApplication "THE_STRING_YOU_GOT_ABOVE"

The " you need !!
The Application starts direcly without starting a browser.

Hope you understand my english ;-)
wadi1982  
#8 Posted : Wednesday, September 17, 2014 1:20:28 PM(UTC)
wadi1982


Rank: Advanced Member

Medals: Level 1: Random Act of Kindness! Received One Thanks!

Joined: 9/3/2014(UTC)
Posts: 31
Germany

Was thanked: 1 time(s) in 1 post(s)
Originally Posted by: pingo Go to Quoted Post
wadi1982 thank you very much for the last post. Your instructions were very clear. I never noticed the small "System Profiles" hyperlink. Now I got it to connect. I compared the command line parameters that ClientSetup.exe was using to launch the client with what I was using.

I was able to spot three differences:
1. The "k" parameter that is used is something different than what is written web.config under <add key="AsymmetricKey"> setting.
3. The host parameter doesn`t have "http://" specified
3. The "p" parameter is set to 443 instead 80

Not sure which of these was the main culprit but now it works.


And now the second part of the puzzle, how do I assemble the command line parameters for autoconnecting the client in Host mode?

I have noticed two differences:
- y=Host
- an additional parameter: "n" with some changing value, is this the session access token? If yes, is there any way to determine this token? Either manually or programatically?


To your questions.

1. If I understand it correct you only need the public part of the key.
In my answer above its the "ServerCryptoManager.Instance.PublicKey," line.
If this is important, I dont know

2. I dont know if this is needed

3. This is the port of the relayserver. I think its better to use 443

The "Host-Way" is the next part I'm working on to integrate it in our software.
pingo  
#9 Posted : Wednesday, September 17, 2014 1:39:09 PM(UTC)
pingo


Rank: Newbie

Joined: 9/12/2014(UTC)
Posts: 5
Slovenia

Thanks: 1 times
Thanks, the code you posted is very helpful for reference.

I also agree that information is (too) hard to find as it currently is.

I hope the staff will get back to us with steps/ideas on launching host mode from command line (getting the token).

Edited by user Wednesday, September 17, 2014 1:41:38 PM(UTC)  | Reason: Not specified

wadi1982  
#10 Posted : Wednesday, September 17, 2014 1:41:31 PM(UTC)
wadi1982


Rank: Advanced Member

Medals: Level 1: Random Act of Kindness! Received One Thanks!

Joined: 9/3/2014(UTC)
Posts: 31
Germany

Was thanked: 1 time(s) in 1 post(s)
Now you make me curious.
I look directly at me.
This can'T be so difficult *g*
wadi1982  
#11 Posted : Wednesday, September 17, 2014 2:36:55 PM(UTC)
wadi1982


Rank: Advanced Member

Medals: Level 1: Random Act of Kindness! Received One Thanks!

Joined: 9/3/2014(UTC)
Posts: 31
Germany

Was thanked: 1 time(s) in 1 post(s)
So, what should I say. A little bit searching in the code snippets in this forum and it works.

Fighting agains the sh*** case sensitive programming in aspx I need more time then I want ;-)

With this code you can geht the complete connectionstring with AccessToken

Code:
 public object GetHostString(Guid inSessionID)
    {      
		var relayUri = ServerExtensions.GetRelayUri(ConfigurationManager.AppSettings, HttpContext.Current.Request.Url, true, true);
        var handlerUrl = new Uri(HttpContext.Current.Request.Url, HttpRuntime.AppDomainAppVirtualPath) + WebConfigurationManager.GetHandlerPath(typeof(ClickOnceDirectHandler)).ReplaceFirst("*", WebResources.GetString("FileDownload.BaseName"));

        
        return handlerUrl + ClientLaunchParameters.ToQueryString(new ClientLaunchParameters
        {
            Host = relayUri.Host,
            Port = relayUri.Port,
            EncryptionKey = ServerCryptoManager.Instance.PublicKey,
            SessionType = SessionType.Support,
            SessionID = inSessionID,
            ProcessType = ProcessType.Host,
            AccessToken = ServerCryptoManager.Instance.GetAccessToken(inSessionID, ProcessType.Host, HttpContext.Current.User.Identity.Name, SessionPermissions.HostWithoutRemoteConsent | SessionPermissions.RunSharedTool | SessionPermissions.TransferFiles | SessionPermissions.ManageSharedToolbox, DateTime.MinValue)                                           
        });
	}


The params you can pass also to the windowsclient.exe.
Hope this help you
jmitservices  
#12 Posted : Friday, December 4, 2015 2:49:14 AM(UTC)
jmitservices


Rank: Member

Medals: Level 1: Random Act of Kindness! Received One Thanks!

Joined: 3/22/2015(UTC)
Posts: 35
Man
United Kingdom

Thanks: 1 times
Was thanked: 1 time(s) in 1 post(s)
Just been playing with your code and running the "ScreenConnect.Client.application" throws up an error

ERROR SUMMARY
Below is a summary of the errors, details of these errors are listed later in the log.
* Activation of C:\Users\Jase\Downloads\ScreenConnect.Client.application resulted in exception. Following failure messages were detected:
+ Deployment and application do not have matching security zones.


Do I need to replace the .application from the json result to match the clients OS, i.e. .exe .sh etc... ?

Or should the ScreenConnect.Client.application download the correct file for their OS?
Alexander  
#13 Posted : Friday, December 4, 2015 7:45:44 PM(UTC)
Alexander


Rank: Administration

Medals: Level 3: Shirt off your back! Received 25 Thanks!

Joined: 7/23/2013(UTC)
Posts: 715
Man
Location: Raleigh, NC

Was thanked: 66 time(s) in 63 post(s)
Well, you'd have to replace .application with something else for a non-Windows OS, but since you're able to run it in the first place, that's presumably not the issue here. Still, given that you presumably want to run it from the command line, .exe might be a better fit.
ScreenConnect Team
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.