Posh-SSH icon indicating copy to clipboard operation
Posh-SSH copied to clipboard

Missing Commands Non-Internet Connected Machine

Open dokki767 opened this issue 5 years ago • 4 comments

I recently came across this SSH module and am noticing some inconsistencies in the available cmdlets depending on how you download/install the module. I originally downloaded the master branch (directly from Github) for use on a non-internet connected server but immediately noticed that some of the basic commands like New-SSHSession were not available. On an internet connected machine, I used the 'install-module posh-ssh' command and see a much more complete command set. I saw in your video you recommend installing via the install-module, but when downloading directly from github for use on non-internet connected machines are there any special steps that need to be taken to complete that installation? Are you aware of any limitations of the module that make it non-portable? Meaning if I install the module locally and just copy over the module directory to another host will it work or is it like the MS AD module that it needs to go through its full install process to work to install certain libraries and set registry keys?

dokki767 avatar Mar 24 '20 12:03 dokki767

it should have all commands the release is the same folder that the install-module cmdlets downloads from the gallery. One thing to keep in mind is that IE, Chrome and FireFox mark the zip as dangerous and you have to right click, properties and mark unblock. only reason for those cmdlets to not load is that the DLL is not being loaded. if you fo import-module posh-ssh.ps1d -verbose on the folder of the module does it not show those loading? any errors loading the DLL? make sure you are loading the PS1D and not the PS1M with the import-module cmdlet

darkoperator avatar Mar 24 '20 12:03 darkoperator

Thanks for the quick response. Looks like i'm getting an error on the dll load.

import-module : Could not load file or assembly 'file://\contoso.com\share\Scripts\Powershell\Mo dules\Posh-SSH-master\Release\Assembly\Renci.SshNet.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515) At line:1 char:1

  • import-module "\contoso.com\share\Scripts\Powershell\ ...
  •   + CategoryInfo          : InvalidOperation: (:) [Import-Module], FileLoadException
      + FullyQualifiedErrorId : FormatXmlUpdateException,Microsoft.PowerShell.Commands.ImportModuleCommand
    
    

However....it looks like I only get that when trying to import the module from a UNC path, if I use a local path it loads without issue. First I've seen behavior like this but regardless, I can work around this limitation. Let me know if there are other tests you'd like me to perform. Unsure if this is a module bug or perhaps something else like an OS limitation/protection. I confirmed the files are not showing as "Blocked" due to their Internet download origination.

dokki767 avatar Mar 24 '20 13:03 dokki767

Set the framework code access policy https://powertoe.wordpress.com/2010/08/10/corporate-powershell-module-repository-part-1-design-and-infrastructure/

Sent from my iPhone

On Mar 24, 2020, at 9:29 AM, dokki767 [email protected] wrote:

 Thanks for the quick response. Looks like i'm getting an error on the dll load.

import-module : Could not load file or assembly 'file://\contoso.com\share\Scripts\Powershell\Mo dules\Posh-SSH-master\Release\Assembly\Renci.SshNet.dll' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515) At line:1 char:1

import-module "\contoso.com\share\Scripts\Powershell\ ...

  • CategoryInfo : InvalidOperation: (:) [Import-Module], FileLoadException
  • FullyQualifiedErrorId : FormatXmlUpdateException,Microsoft.PowerShell.Commands.ImportModuleCommand

However....it looks like I only get that when trying to import the module from a UNC path, if I use a local path it loads without issue. First I've seen behavior like this but regardless, I can work around this limitation. Let me know if there are other tests you'd like me to perform. Unsure if this is a module bug or perhaps something else like an OS limitation/protection. I confirmed the files are not showing as "Blocked" due to their Internet download origination.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.

darkoperator avatar Mar 24 '20 14:03 darkoperator

Thanks. Discussing with some colleagues we're just going to move forward with having all the dependencies and script files downloaded locally and executed from there.

dokki767 avatar Mar 25 '20 20:03 dokki767