Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Issue] - Cannot find type [TcpListenerEx]: verify that the assembly containing this type is loaded. #28

Open
FireHelmet opened this issue Apr 11, 2022 · 12 comments

Comments

@FireHelmet
Copy link

Hello @DarkCoderSc ,

I'm trying to run PowerRemoteDesktop_Server module on Windows 10 (1909) and Windows Server 2016, both have powershell 5.1 but I encounter an issue when I run :

Invoke-RemoteDesktopServer -ListenAddress "0.0.0.0" -ListenPort 2801 -SecurePassword (ConvertTo-SecureString -String "P@ssw0rd!2022" -AsPlainText -Force)

Power Remote Desktop Server- Version 4.0.0
Jean-Pierre LESUEUR (@DarkCoderSc) ###
https://www.github.com/darkcodersc
https://www.phrozen.io

License: Apache License (Version 2.0, January 2004)
https://www.apache.org/licenses/

Loading remote desktop server components...
VERBOSE: Initialize new session manager...
VERBOSE: Custom X509 Certificate not specified.
VERBOSE: Generate and Install a new local X509 Certificate.
VERBOSE: Certificate was successfully installed on local machine. Opening...
VERBOSE: @Certificate:
VERBOSE: [Subject]
  CN=PowerRemoteDesktop.Server, O=Phrozen, L=Maisons Laffitte, S=Yvelines, C=FR, OU=Freeware

[Issuer]
  CN=PowerRemoteDesktop.Server, O=Phrozen, L=Maisons Laffitte, S=Yvelines, C=FR, OU=Freeware

[Serial Number]
  128F02D94D36849B471C1963CAC549D2

[Not Before]
  4/10/2022 1:54:43 PM

[Not After]
  4/11/2023 1:54:43 PM

[Thumbprint]
  2819E5C755CCFA6302743B994719D9AE24EF1DBE
VERBOSE: ---
VERBOSE: Session manager initialized.
Remote desktop was closed.
New-Object : Cannot find type [TcpListenerEx]: verify that the assembly containing this type is loaded.
At line:32 char:18
+         return @(& $origNewObject @psBoundParameters)
+                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidType: (:) [New-Object], PSArgumentException
    + FullyQualifiedErrorId : TypeNotFound,Microsoft.PowerShell.Commands.NewObjectCommand

Many thanks for this tool and for your support!

@DarkCoderSc
Copy link
Member

Hello,

Is this error occurs in both your Win10 and WinServer ?

Can you paste the exact version of your PowerShell.

How do you install your PowerRemoteDesktop on your machine .

If you can provide the exact steps (all steps) it will help me to reproduce this issue :)

Thank you in advance

Best Regards

@FireHelmet
Copy link
Author

FireHelmet commented Apr 11, 2022

@DarkCoderSc

Yes, it's the same issue, about PS version :

  • 5.1.18362.1801 (Windows 10 build 1909)
  • 5.1.14393.4583 (Windows 2016 Server)

PowerRemoteDesktop is installed from PowerShell Gallery by using:

Install-Module -Name PowerRemoteDesktop_Server

I haven't had an issue during the installation.

So basically, I did:

  1. Launched PS as an administrator
  2. Installation of PowerRemoteDesktop_Server: Install-Module -Name PowerRemoteDesktop_Server -Scope AllUsers -Force
  3. Run the server part: Invoke-RemoteDesktopServer -ListenAddress "0.0.0.0" -ListenPort 2801 -SecurePassword (ConvertTo-SecureString -String "P@ssw0rd!2022" -AsPlainText -Force)

Then I got the error mentionned.

Thank you !

@DarkCoderSc
Copy link
Member

I just tried in my side, I can't reproduce your issue.

I don't have the exact same version of PowerShell tho, mine is 5.1.19041.1620, the difference of version sounds too close to be the issue.

You can try to update your PowerShell 5.1 to a higher version and see if it solves the issue.

Let me know

Regards,

@FireHelmet
Copy link
Author

@DarkCoderSc

I tried with PS 7.2 and I was able to establish a connection 👍 . But, the screen size given by the window is too small and I didn't find how I can have a full screen from your readme. See the output from viewer below,

Invoke-RemoteDesktopViewer -ServerAddress EUW-IOT990 -ServerPort 2801 -SecurePassword (ConvertTo-SecureString -String "P@ssw0rd!2022" -AsPlainText -Force)

Power Remote Desktop - Version 4.0.0
Jean-Pierre LESUEUR (@DarkCoderSc) ###
https://www.github.com/darkcodersc
https://www.phrozen.io

License: Apache License (Version 2.0, January 2004)
https://www.apache.org/licenses/

VERBOSE: Server address: "EUW-IOT990:2801"
Start new remote desktop session...
VERBOSE: Request new session with remote server: "EUW-IOT990:2801"...
VERBOSE: Establish first contact with remote server...
VERBOSE: Connect: "EUW-IOT990:2801..."
VERBOSE: Connected.
VERBOSE: Establish an encrypted tunnel using: Tls12...
VERBOSE: Fingerprint already known and trusted: "DDFE8CD31927202D66169AEE23002CC5DA4ED712"
VERBOSE: Encrypted tunnel opened and ready for use.
VERBOSE: Authentify with remote server (Challenged-Based Authentication)...
VERBOSE: @Challenge:
VERBOSE: Candidate: "974D0BD242F59E1FF7C88306FB284B8FB4FF42A776B45906F2930167419D5B69089008569EEC4E11D415524B9134A92ACEE955EB2069D61724FF86BEC1F284CF"
VERBOSE: Solution: "D18DFD524E605D70837DD0BFC69D199537527EE7D25C5FCFA4E725BADF1CBEEE6B517C65916C2017FB887C0535470905C0113BF301961EB2D13B09CBC7787561"
VERBOSE: ---
VERBOSE: Solution accepted. Authentication success.
VERBOSE: Request session...
VERBOSE: @ServerInformation:
VERBOSE: @{WindowsVersion=Microsoft Windows NT 10.0.14393.0; ViewOnly=False; Screens=; Username=test; MachineName=EUW-IOT990; SessionId=8865876070057DC60726B60CA86AD788407DAA1EA6A5F949C663ABFA2A299B97E5ECF7027AAEEC8AAC2E5C2B5DF8D99C83C053293BDB548DB4E519A3117781A9; Version=4.0.0}
VERBOSE: ---
VERBOSE: Server informations acknowledged, prepare and send our expectation...
VERBOSE: @ViewerExpectation:
VERBOSE: @{ImageCompressionQuality=75; ScreenName=\\.\DISPLAY1; PacketSize=Size9216; LogonUI=False; BlockSize=Size64}
VERBOSE: ---
VERBOSE: Create new desktop streaming worker...
VERBOSE: Connect new worker: "Desktop"...
VERBOSE: Connect: "EUW-IOT990:2801..."
VERBOSE: Connected.
VERBOSE: Establish an encrypted tunnel using: Tls12...
VERBOSE: Fingerprint already known and trusted: "DDFE8CD31927202D66169AEE23002CC5DA4ED712"
VERBOSE: Encrypted tunnel opened and ready for use.
VERBOSE: Authentify with remote server (Challenged-Based Authentication)...
VERBOSE: @Challenge:
VERBOSE: Candidate: "A840B9C72325CA5F68F199411BC0234117BB5ACEA2EBA39AA4A74B0C92CC1F87B91E94998E9201998A08D2191BA66F5C3A5ABB8F82FFFCA13C7E862D28A1E31A"
VERBOSE: Solution: "7F925FA78A19DA288C44855260F0DE2F2A84522BF087614348852A29B9CCD9AB4118C09CE2974387C5B46E1B2B4DB6717A58ECEAAFE77AEA16DF3D7A09D2EC6C"
VERBOSE: ---
VERBOSE: Solution accepted. Authentication success.
VERBOSE: Attach worker to remote session "8865876070057DC60726B60CA86AD788407DAA1EA6A5F949C663ABFA2A299B97E5ECF7027AAEEC8AAC2E5C2B5DF8D99C83C053293BDB548DB4E519A3117781A9"
VERBOSE: Worker successfully attached to session, define which kind of worker we are...
VERBOSE: Worker ready.
VERBOSE: Create new event event (in/out) worker...
VERBOSE: Connect new worker: "Events"...
VERBOSE: Connect: "EUW-IOT990:2801..."
VERBOSE: Connected.
VERBOSE: Establish an encrypted tunnel using: Tls12...
VERBOSE: Fingerprint already known and trusted: "DDFE8CD31927202D66169AEE23002CC5DA4ED712"
VERBOSE: Encrypted tunnel opened and ready for use.
VERBOSE: Authentify with remote server (Challenged-Based Authentication)...
VERBOSE: @Challenge:
VERBOSE: Candidate: "704CBA77B0B868FEF50420D50886B3F999BB10D510847FFDA26017C228E529A0CA3DDFE195806661507A2E54BD636E9622B4777E866D203D709489DB23605454"
VERBOSE: Solution: "B779BD5A4F3DC584CC0818E54AAEC0641163A18E1C0C29033CCC7D00A054BE41B13DA22A40CB52BFB0DC443EC92287C96EC937DB6A6467E98B4E2A666C2A4311"
VERBOSE: ---
VERBOSE: Solution accepted. Authentication success.
VERBOSE: Attach worker to remote session "8865876070057DC60726B60CA86AD788407DAA1EA6A5F949C663ABFA2A299B97E5ECF7027AAEEC8AAC2E5C2B5DF8D99C83C053293BDB548DB4E519A3117781A9"
VERBOSE: Worker successfully attached to session, define which kind of worker we are...
VERBOSE: Worker ready.
Session successfully established, start streaming...
VERBOSE: Create WinForms Environment...
VERBOSE: Create runspace for desktop streaming...
VERBOSE: Create runspace for incoming events...
VERBOSE: Create runspace for outgoing events...
VERBOSE: Done. Showing Virtual Desktop Form.

image

Thanks again for your quick help!

@DarkCoderSc
Copy link
Member

I'm sure to understand.

The image you show is modified ?

I mean except the blurr in your icons, have you touch anything else ? (I see the Windows background showing funny + the clock square)

@FireHelmet
Copy link
Author

@DarkCoderSc

Yes, the blurr comes from my screenshot, I just hidden some private infos :).

As you can see I can't maximize the window, the button is unavailable.

@DarkCoderSc
Copy link
Member

You can't maximize the window nor resize the window, this is done automatically during handshake.

When remote screen resolution is higher than local resolution, window is automatically adjusted by 90% of your local resolution.

I will add an option to support dynamic resize (through window resize) in a later version.

@FireHelmet
Copy link
Author

@DarkCoderSc

I figure out my screen issue. This one has happened because I established the RDP session by using mRemoteNG and I executed the cmdlet "Invoke-RemoteDesktopServer". Then, I tried with the official client from Windows ("Remote Desktop Connection") in full screen mode and the issue is gone.

Then, I had a new issue, also solved. I established the connection (from my computer with your module as a viewer) when I had the RDP connection on my server in full screen mode (as I said above) and I was not able to perform action with my mouse and keyboard. Then I reduced the window size of my RDP connection and finally I was able to get a workable access. But if I drop the RDP connection, the viewer becomes unresponsive.

Also, I tested the server part but remotely from an invoke-command from my computer, like:

Invoke-Command -ComputerName EUW-IOT990 -ScriptBlock { Invoke-RemoteDesktopServer -ListenAddress "0.0.0.0" -ListenPort 2801 -SecurePassword (ConvertTo-SecureString -String "P@ssw0rd!2022" -AsPlainText -Force) }

The server has started correctly but with the viewer from my computer, I got a black screen:

image

I really want to use your tool in my environment hosted in Azure, especially during troubleshooting when RDP is unavailable.

@DarkCoderSc
Copy link
Member

The first issue your describe is known and present in my todo list. I don't have any good idea to handle this issue yet.

If something change the resolution of your screen while Power Remote Desktop Server is already loaded, Power Remote Desktop Server will not be aware of that change thus resulting in funny things.

This is caused by PowerShell itself. If you update your screen resolution, PowerShell will not be advised and update the information until your reload a new PowerShell Session. I will have to interrogate another service (ex through WMI)

Until I implement something about that, you should not caused a resolution update while using Power Remote Desktop Server. (In your case using another RDP client will implement its own resolution preference which will cause this issue)

Finally regarding your second issue, it is also known and not really an issue.

Unlike RDP, Power Remote Desktop doesn't create a new terminal session, it will attach to an existing terminal session (Ex: User physical session or RDP Session). Exactly like VNC would.

So when you terminate your RDP session, the desktop where Power Remote Desktop was executed is not available anymore.

One solution, attach Power Remote Desktop to a "Physical Session" ?

@FireHelmet
Copy link
Author

@DarkCoderSc

Okay ! so it's not possible to invoke your tool. It must be attached to an existing session. Should I use psexec to create a session remotely before attaching Power Remote Desktop ? Or do you have another method ?

Thank you for your fast support!

@DarkCoderSc
Copy link
Member

I will seriously take in consideration the problematic you describe , take some time to find the best working solution if a solution exists.

@FireHelmet
Copy link
Author

@DarkCoderSc

Thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants