Posh-SSH
Posh-SSH copied to clipboard
Unable to load Renci.SshNet
Hi,
after latest Windows update and restart, Posh-SSH Open-SSHSession stopped working:
assembly 'Renci.SshNet, Version=2016.1.0.0, Culture=neutral, PublicKeyToken=1cee9f8bde3db106' or one of its dependencies. The system cannot find the file specified.
Windows Server 2019 Datacenter 10.0.17763 Build 17763 Posh-SSH 2.2 .NET Framework 4.8 PS: 5.1.18362.145
Only time I have seen that error is from people that did not installed the module from the gallery and the browser marked the zip and dangerous since it contained a DLL and PS1 files. Was this install from the PowerShell Gallery?
On Aug 29, 2019, at 5:54 PM, xxsybreedxx [email protected] wrote:
Hi,
after latest Windows update and restart, Posh-SSH Open-SSHSession stopped working:
assembly 'Renci.SshNet, Version=2016.1.0.0, Culture=neutral, PublicKeyToken=1cee9f8bde3db106' or one of its dependencies. The system cannot find the file specified.
Windows Server 2019 Datacenter 10.0.17763 Build 17763 Posh-SSH 2.2 .NET Framework 4.8
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/darkoperator/Posh-SSH/issues/284?email_source=notifications&email_token=AAD7IHXDSLEMI4G5XCD4SCLQHBATFA5CNFSM4ISHF3AKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4HIJ7NPQ, or mute the thread https://github.com/notifications/unsubscribe-auth/AAD7IHSINBSOMSG4J7MH753QHBATFANCNFSM4ISHF3AA.
Yeah, https://www.powershellgallery.com/packages/Posh-SSH/2.2
Just did on a fresh Win 10 install, updated it, changed the policy to remove signed and installed it from the gallery and no issues
So it could be something else in your setup that is causing it. This machine is not ARM or has Credential Guard or it is Windows S? Trying to think why it would block the DLL is it was installed via install-module from the gallery.
On Aug 30, 2019, at 2:54 AM, xxsybreedxx [email protected] wrote:
Yeah, https://www.powershellgallery.com/packages/Posh-SSH/2.2 https://www.powershellgallery.com/packages/Posh-SSH/2.2 — You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/darkoperator/Posh-SSH/issues/284?email_source=notifications&email_token=AAD7IHSWW2SN76RPULVJ3TTQHC7ZPA5CNFSM4ISHF3AKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD5QXY7Q#issuecomment-526482558, or mute the thread https://github.com/notifications/unsubscribe-auth/AAD7IHWWUMBBYEZ6IKEFJHLQHC7ZPANCNFSM4ISHF3AA.
We are running AWS Windows Server 2019 instance without credential guards and s mode. It was working before update https://support.microsoft.com/en-us/help/4512534/windows-10-update-kb4512534.
2 installs of Windows Server 2019 and fully updated and I can not replicate the issue :(
PS C:\Users\Administrator> Set-ExecutionPolicy RemoteSigned -Force
PS C:\Users\Administrator> Install-Module posh-ssh -force -verbose
NuGet provider is required to continue
PowerShellGet requires NuGet provider version '2.8.5.201' or newer to interact with NuGet-based repositories. The NuGet
provider must be available in 'C:\Program Files\PackageManagement\ProviderAssemblies' or
'C:\Users\Administrator\AppData\Local\PackageManagement\ProviderAssemblies'. You can also install the NuGet provider by
running 'Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force'. Do you want PowerShellGet to install
and import the NuGet provider now?
[Y] Yes [N] No [S] Suspend [?] Help (default is "Y"): Y
VERBOSE: Installing NuGet provider.
VERBOSE: Using the provider 'Bootstrap' for searching packages.
VERBOSE: Finding the package 'Bootstrap::FindPackage' 'NuGet','','2.8.5.201','''.
VERBOSE: Installing the package 'https://onegetcdn.azureedge.net/providers/nuget-2.8.5.208.package.swidtag'.
VERBOSE: Installed the package 'nuget' to 'C:\Program
Files\PackageManagement\ProviderAssemblies\nuget\2.8.5.208\Microsoft.PackageManagement.NuGetProvider.dll'.
VERBOSE: Importing the package provider NuGet
VERBOSE: The provider 'NuGet' has already been imported. Trying to import it again.
VERBOSE: Loading an assembly 'C:\Program
Files\PackageManagement\ProviderAssemblies\nuget\2.8.5.208\Microsoft.PackageManagement.NuGetProvider.dll'.
VERBOSE: Imported provider 'C:\Program
Files\PackageManagement\ProviderAssemblies\nuget\2.8.5.208\Microsoft.PackageManagement.NuGetProvider.dll' .
VERBOSE: The provider 'NuGet' has already been imported. Trying to import it again.
VERBOSE: Importing package provider 'NuGet'.
VERBOSE: Using the provider 'PowerShellGet' for searching packages.
VERBOSE: The -Repository parameter was not specified. PowerShellGet will use all of the registered repositories.
VERBOSE: Getting the provider object for the PackageManagement Provider 'NuGet'.
VERBOSE: The specified Location is 'https://www.powershellgallery.com/api/v2' and PackageManagementProvider is 'NuGet'.
VERBOSE: Searching repository 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='posh-ssh'' for ''.
VERBOSE: Total package yield:'1' for the specified package 'posh-ssh'.
VERBOSE: Performing the operation "Install-Module" on target "Version '2.2' of module 'Posh-SSH'".
VERBOSE: The installation scope is specified to be 'AllUsers'.
VERBOSE: The specified module will be installed in 'C:\Program Files\WindowsPowerShell\Modules'.
VERBOSE: The specified Location is 'NuGet' and PackageManagementProvider is 'NuGet'.
VERBOSE: Downloading module 'Posh-SSH' with version '2.2' from the repository
'https://www.powershellgallery.com/api/v2'.
VERBOSE: Searching repository 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='Posh-SSH'' for ''.
VERBOSE: InstallPackage' - name='Posh-SSH',
version='2.2',destination='C:\Users\Administrator\AppData\Local\Temp\1903644099'
VERBOSE: DownloadPackage' - name='Posh-SSH',
version='2.2',destination='C:\Users\Administrator\AppData\Local\Temp\1903644099\Posh-SSH\Posh-SSH.nupkg',
uri='https://www.powershellgallery.com/api/v2/package/Posh-SSH/2.2.0'
VERBOSE: Downloading 'https://www.powershellgallery.com/api/v2/package/Posh-SSH/2.2.0'.
VERBOSE: Completed downloading 'https://www.powershellgallery.com/api/v2/package/Posh-SSH/2.2.0'.
VERBOSE: Completed downloading 'Posh-SSH'.
VERBOSE: Hash for package 'Posh-SSH' does not match hash provided from the server.
VERBOSE: InstallPackageLocal' - name='Posh-SSH',
version='2.2',destination='C:\Users\Administrator\AppData\Local\Temp\1903644099'
VERBOSE: Catalog file 'Posh-SSH.cat' is not found in the contents of the module 'Posh-SSH' being installed.
VERBOSE: Module 'Posh-SSH' was installed successfully to path 'C:\Program
Files\WindowsPowerShell\Modules\Posh-SSH\2.2'.
PS C:\Users\Administrator> import-module posh-ssh
PS C:\Users\Administrator> New-SSHSession 192.168.1.1
cmdlet New-SSHSession at command pipeline position 1
Supply values for the following parameters:
(Type !? for Help.)
Credential
Server SSH Fingerprint
Do you want to trust the fingerprint cd:1c:73:89:dd:21:2d:92:69:e5:ae:99:fb:20:eb:ff
[] Y [] N [?] Help (default is "N"): Y
My only recomendation would be to uninstall and install again.
I've tried to uninstall module, different versions but still facing same issue
Hm, the issue appears only when I'm trying to connect using credentials.
$secureStr = ConvertTo-SecureString "********" -AsPlainText -Force $cred = New-Object System.Management.Automation.PSCredential("my_user", $secureStr) New-SSHSession -ComputerName "remote_addr" -Credential $cred -KeyFile "C:\Users\Administrator\.ssh\id_rsa" -Verbose
New-SSHSession 192.168.1.1 - this works fine for me
ssh my_user@remote_addr - works fine with same credentials
HI
I have the same problem, and a strange thing is that my script was running for over a month until 4 days ago. Now it stopped with the error (logfile is attached)
New-SFTPSession : Could not load file or assembly 'Renci.SshNet, Version=2016.1.0.0, Culture=neutral, PublicKeyToken=1cee9f8bde3db106' or one of its dependencies. The system cannot find the file specified.
I have also tried removing and reinstalling the module.
I am running MS Windows Server 2019 Standard, Build 10.0.17763.
@DankyDuck82 Yeah, the same problem the script was working before and stopped a few days ago, I think after the windows server update
Just tested it on a Windows 10 Pro Build 17763, where is works without any issues. Also working on a Windows Server 2012 R2 Standard Build 9600
(ran out of computers to try it on :) )
@xxsybreedxx you are correct. Just tested it on 3 more servers running Windows Server 2019 Standard, Build 10.0.17763. They all have the same error.
@Darkoperator do you know if there will a solution anytime soon? Or are you not able to recreated the problem with the same OS ?
That is my main issue I have not been able to replicate the issue in the 2 VMs I have 2019 it works without problem. Can you show the full trace of the error? Enable a transcript, run the commands by hand and provide the output here in the ticket of via email so I can have a better grasp of the error
On Sep 9, 2019, at 8:21 AM, DankyDuck82 [email protected] wrote:
@darkoperator https://github.com/darkoperator do you know if there will a solution anytime soon? Or are you not able to recreated the problem with the same OS ?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/darkoperator/Posh-SSH/issues/284?email_source=notifications&email_token=AAD7IHQJ2E35CPAFMUMUYH3QIY5TFA5CNFSM4ISHF3AKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD6HLNKA#issuecomment-529446568, or mute the thread https://github.com/notifications/unsubscribe-auth/AAD7IHRMXG5YZHG2M5VGZETQIY5TFANCNFSM4ISHF3AA.
We have recently experienced the same issue, copy of transcript below:
Windows PowerShell transcript start Start time: 20190910161425 Username: **** RunAs User: **** Machine: ******* (Microsoft Windows NT 6.3.9600.0) Host Application: C:\Windows\system32\WindowsPowerShell\v1.0\PowerShell_ISE.exe Process ID: 13252 PSVersion: 5.1.14409.1005 PSEdition: Desktop PSCompatibleVersions: 1.0, 2.0, 3.0, 4.0, 5.0, 5.1.14409.1005 BuildVersion: 10.0.14409.1005 CLRVersion: 4.0.30319.42000 WSManStackVersion: 3.0 PSRemotingProtocolVersion: 2.3 SerializationVersion: 1.1.0.1
Transcript started, output file is c:\temp\transcript\PowerShell_transcript.*******.IesNFzJq.20190910161425.txt PS C:\TPPowershell> new-sshsession *******
TerminatingError(New-SSHSession): "Could not load file or assembly 'Renci.SshNet, Version=2016.1.0.0, Culture=neutral, PublicKeyToken=1cee9f8bde3db106' or one of its dependencies. The system cannot find the file specified." new-sshsession : Could not load file or assembly 'Renci.SshNet, Version=2016.1.0.0, Culture=neutral, PublicKeyToken=1cee9f8bde3db106' or one of its dependencies. The system cannot find the file specified. At line:1 char:1
- new-sshsession *******
-
+ CategoryInfo : NotSpecified: (:) [New-SSHSession], FileNotFoundException + FullyQualifiedErrorId : System.IO.FileNotFoundException,SSH.NewSshSession
new-sshsession : Could not load file or assembly 'Renci.SshNet, Version=2016.1.0.0, Culture=neutral, PublicKeyToken=1cee9f8bde3db106' or one of its dependencies. The system cannot find the file specified. At line:1 char:1
- new-sshsession *******
-
+ CategoryInfo : NotSpecified: (:) [New-SSHSession], FileNotFoundException + FullyQualifiedErrorId : System.IO.FileNotFoundException,SSH.NewSshSession
PS C:\TPPowershell> Stop-Transcript
Windows PowerShell transcript end End time: 20190910161442
Finally got to the bottom of our problem, which appears to be down to a recent upgrade of MySQL .NET Connector v8.0.17 Uninstalled v8.0.17 and installed v8.0.16 which fixed our issue
MSI Installer: https://mirrors.dotsrc.org/mysql/Downloads/Connector-Net/mysql-connector-net-8.0.16.msi
Issue: https://community.powerbi.com/t5/Desktop/Unable-to-Connect-to-MySQL-database/td-p/746202/page/3
@markcopp Never had mysql or connector installed on our machine
I recently ran into the same issue after installing KB4512534 (August 17th, 2019) on a Windows Server 2019 machine. After uninstalling it, the Posh-SSH PowerShell module did work again without previously described error.
Following file is new since KB4512534 -> Renci.sshnet.dll
You can check this for yourself by visitinig https://support.microsoft.com/en-us/help/4512534, scrolling down to the bottom of the page and taking a look into:
For a list of the files that are provided in this update, download the file information for cumulative update 4512534
This file didn't get shipped with KB4511553 (August 13th, 2019) or previous cumulative updates. It's very likely that the issue remains existent with KB4512578 (September 10th, 2019) and future updates.
My assumption is: the newly added Renci.sshnet.dll library shipped by Microsoft is getting prioritised over the one that comes with Posh-SSH which causes a version mismatch conflict and leads to this terminating error when executing New-SSHSession.
If you were able to follow me along you hopefully find a way to circumvent this conflict in future releases. Either by renaming your version of Renci.sshnet.dll for example or making sure Windows doesn't prefer the DLL within it's system folder over the one residing within the .\Assembly folder.
Sadly that may not be enough. The DLL is being explicitly loaded by the module
# Assemblies that must be loaded prior to importing this module
RequiredAssemblies = @('Assembly\Renci.SshNet.dll')
So the conflict is at cmdlet execution. Which means that there will be a namespace conflict and you will be using old functionality from the module. Will email some people at MS to see if I can find out why that module was included. I would need to change namespaces and recompile under another name the library as an alternate option.
I think I can imagine why they added this file -> https://techcommunity.microsoft.com/t5/Storage-at-Microsoft/Storage-Migration-Service-August-Update/ba-p/814035
Samba on Linux You can now migrate from Samba running on Linux to Windows Server
Once you select a Samba Linux migration and enter in your SSH credentials or certificates then run inventory, you'll see all the SMB shares and storage as you would normally
They've implemented a new feature to their Windows Admin Center webconsole which seems to be using a variant of the SSH.NET library.
if you do an import-module before running the command even with the KB present are you having the issue. On my VM when I load the module first I do not see it. Wonder if module autoloading may be affected.
After closing all instances of PowerShell and starting a new PS console instance, Import-Module 'Posh-SSH' followed by New-SSHSession results into the same error unfortunately.
If you are using a freshly updated WinServer 2019 virtual machine, there could also be some Group Policy on my side being the culprit in theory or any optional Windows feature which isn't installed by default. Won't be easy to figure this one out if it was true.
Once the kids are in bed I will test again and use fusion log viewer and procmon to see what path is it trying to load from
Sent from my iPhone
On Sep 10, 2019, at 5:19 PM, void [email protected] wrote:
After closing all instances of PowerShell and starting a new PS console instance, Import-Module 'Posh-SSH' followed by New-SSHSession results into the same error unfortunately. If you are using a freshly updated WinServer 2019 virtual machine, there could also be some Group Policy being the culprit in theory. Won't be easy to figure this one out if it was true.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.
This worked for me... (Run this is PowerShell, it adds the Renci.SshNet.dll of Posh-SSH to the GAC.)
[System.Reflection.Assembly]::Load("System.EnterpriseServices, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")
$publish = New-Object System.EnterpriseServices.Internal.Publish
$publish.GacInstall("C:\Program Files\WindowsPowerShell\Modules\Posh-SSH\2.2\Assembly\Renci.SshNet.dll");
@darkoperator
Click to expand verbose output
PS> $VerbosePreference = "Continue"
PS> Import-Module Posh-SSH -Verbose
VERBOSE: Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\Posh-SSH\2.2\Posh-SSH.psd1'.
VERBOSE: Loading 'Assembly' from path 'C:\Windows\Microsoft.Net\assembly\GAC_64\Renci.SshNet\v4.0_10.0.0.0__31bf3856ad364e35\Renci.SshNet.dll'.
VERBOSE: Loading 'Assembly' from path 'C:\Windows\Microsoft.Net\assembly\GAC_64\Renci.SshNet\v4.0_10.0.0.0__31bf3856ad364e35\Renci.SshNet.dll'.
VERBOSE: Loading 'FormatsToProcess' from path 'C:\Program Files\WindowsPowerShell\Modules\Posh-SSH\2.2\Format\SSHSession.Format.ps1xml'.
VERBOSE: Loading 'FormatsToProcess' from path 'C:\Program Files\WindowsPowerShell\Modules\Posh-SSH\2.2\Format\SFTPSession.Format.ps1xml'.
VERBOSE: Loading 'FormatsToProcess' from path 'C:\Program Files\WindowsPowerShell\Modules\Posh-SSH\2.2\Format\Renci.SshNet.SshCommand.Format.ps1xml'.
VERBOSE: Loading 'FormatsToProcess' from path 'C:\Program Files\WindowsPowerShell\Modules\Posh-SSH\2.2\Format\Renci.SshNet.Sftp.SftpFile.Format.ps1xml'.
VERBOSE: Populating RepositorySourceLocation property for module Posh-SSH.
VERBOSE: Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\Posh-SSH\2.2\PoshSSH.dll'.
VERBOSE: Importing cmdlet 'Get-SCPFile'.
VERBOSE: Importing cmdlet 'Get-SCPFolder'.
VERBOSE: Importing cmdlet 'Get-SCPItem'.
VERBOSE: Importing cmdlet 'Get-SFTPFile'.
VERBOSE: Importing cmdlet 'Get-SFTPItem'.
VERBOSE: Importing cmdlet 'Set-SCPItem'.
VERBOSE: Importing cmdlet 'Set-SFTPFile'.
VERBOSE: Importing cmdlet 'Set-SFTPFolder'.
VERBOSE: Importing cmdlet 'Set-SFTPItem'.
VERBOSE: Importing cmdlet 'New-SFTPSession'.
VERBOSE: Importing cmdlet 'New-SSHSession'.
VERBOSE: Importing cmdlet 'Set-SCPFile'.
VERBOSE: Importing cmdlet 'Set-SCPFolder'.
VERBOSE: Loading module from path 'C:\Program Files\WindowsPowerShell\Modules\Posh-SSH\2.2\Posh-SSH.psm1'.
VERBOSE: Exporting function 'Get-SSHSession'.
VERBOSE: Exporting function 'Remove-SSHSession'.
VERBOSE: Exporting function 'Invoke-SSHCommand'.
VERBOSE: Exporting function 'Get-PoshSSHModVersion'.
VERBOSE: Exporting function 'Invoke-SSHCommandStream'.
VERBOSE: Exporting function 'New-SSHShellStream'.
VERBOSE: Exporting function 'Invoke-SSHStreamExpectAction'.
VERBOSE: Exporting function 'Invoke-SSHStreamExpectSecureAction'.
VERBOSE: Exporting function 'Invoke-SSHStreamShellCommand'.
VERBOSE: Exporting function 'Get-SFTPSession'.
VERBOSE: Exporting function 'Remove-SFTPSession'.
VERBOSE: Exporting function 'Get-SFTPChildItem'.
VERBOSE: Exporting function 'Test-SFTPPath'.
VERBOSE: Exporting function 'Remove-SFTPItem'.
VERBOSE: Exporting function 'Move-SFTPItem'.
VERBOSE: Exporting function 'Set-SFTPLocation'.
VERBOSE: Exporting function 'Get-SFTPLocation'.
VERBOSE: Exporting function 'Rename-SFTPFile'.
VERBOSE: Exporting function 'Get-SFTPPathAttribute'.
VERBOSE: Exporting function 'Set-SFTPPathAttribute'.
VERBOSE: Exporting function 'New-SFTPSymlink'.
VERBOSE: Exporting function 'Get-SFTPContent'.
VERBOSE: Exporting function 'Set-SFTPContent'.
VERBOSE: Exporting function 'New-SFTPFileStream'.
VERBOSE: Exporting function 'New-SFTPItem'.
VERBOSE: Exporting function 'New-SSHLocalPortForward'.
VERBOSE: Exporting function 'New-SSHRemotePortForward'.
VERBOSE: Exporting function 'New-SSHDynamicPortForward'.
VERBOSE: Exporting function 'Get-SSHPortForward'.
VERBOSE: Exporting function 'Stop-SSHPortForward'.
VERBOSE: Exporting function 'Start-SSHPortForward'.
VERBOSE: Exporting function 'Get-SSHTrustedHost'.
VERBOSE: Exporting function 'New-SSHTrustedHost'.
VERBOSE: Exporting function 'Remove-SSHTrustedHost'.
VERBOSE: Importing function 'Get-PoshSSHModVersion'.
VERBOSE: Importing function 'Get-SFTPChildItem'.
VERBOSE: Importing function 'Get-SFTPContent'.
VERBOSE: Importing function 'Get-SFTPLocation'.
VERBOSE: Importing function 'Get-SFTPPathAttribute'.
VERBOSE: Importing function 'Get-SFTPSession'.
VERBOSE: Importing function 'Get-SSHPortForward'.
VERBOSE: Importing function 'Get-SSHSession'.
VERBOSE: Importing function 'Get-SSHTrustedHost'.
VERBOSE: Importing function 'Invoke-SSHCommand'.
VERBOSE: Importing function 'Invoke-SSHCommandStream'.
VERBOSE: Importing function 'Invoke-SSHStreamExpectAction'.
VERBOSE: Importing function 'Invoke-SSHStreamExpectSecureAction'.
VERBOSE: Importing function 'Invoke-SSHStreamShellCommand'.
VERBOSE: Importing function 'Move-SFTPItem'.
VERBOSE: Importing function 'New-SFTPFileStream'.
VERBOSE: Importing function 'New-SFTPItem'.
VERBOSE: Importing function 'New-SFTPSymlink'.
VERBOSE: Importing function 'New-SSHDynamicPortForward'.
VERBOSE: Importing function 'New-SSHLocalPortForward'.
VERBOSE: Importing function 'New-SSHRemotePortForward'.
VERBOSE: Importing function 'New-SSHShellStream'.
VERBOSE: Importing function 'New-SSHTrustedHost'.
VERBOSE: Importing function 'Remove-SFTPItem'.
VERBOSE: Importing function 'Remove-SFTPSession'.
VERBOSE: Importing function 'Remove-SSHSession'.
VERBOSE: Importing function 'Remove-SSHTrustedHost'.
VERBOSE: Importing function 'Rename-SFTPFile'.
VERBOSE: Importing function 'Set-SFTPContent'.
VERBOSE: Importing function 'Set-SFTPLocation'.
VERBOSE: Importing function 'Set-SFTPPathAttribute'.
VERBOSE: Importing function 'Start-SSHPortForward'.
VERBOSE: Importing function 'Stop-SSHPortForward'.
VERBOSE: Importing function 'Test-SFTPPath'.
VERBOSE: Exporting function 'Get-PoshSSHModVersion'.
VERBOSE: Exporting function 'Get-SFTPChildItem'.
VERBOSE: Exporting function 'Get-SFTPContent'.
VERBOSE: Exporting function 'Get-SFTPLocation'.
VERBOSE: Exporting function 'Get-SFTPPathAttribute'.
VERBOSE: Exporting function 'Get-SFTPSession'.
VERBOSE: Exporting function 'Get-SSHPortForward'.
VERBOSE: Exporting function 'Get-SSHSession'.
VERBOSE: Exporting function 'Get-SSHTrustedHost'.
VERBOSE: Exporting function 'Invoke-SSHCommand'.
VERBOSE: Exporting function 'Invoke-SSHCommandStream'.
VERBOSE: Exporting function 'Invoke-SSHStreamExpectAction'.
VERBOSE: Exporting function 'Invoke-SSHStreamExpectSecureAction'.
VERBOSE: Exporting function 'Invoke-SSHStreamShellCommand'.
VERBOSE: Exporting function 'Move-SFTPItem'.
VERBOSE: Exporting function 'New-SFTPFileStream'.
VERBOSE: Exporting function 'New-SFTPItem'.
VERBOSE: Exporting function 'New-SFTPSymlink'.
VERBOSE: Exporting function 'New-SSHDynamicPortForward'.
VERBOSE: Exporting function 'New-SSHLocalPortForward'.
VERBOSE: Exporting function 'New-SSHRemotePortForward'.
VERBOSE: Exporting function 'New-SSHShellStream'.
VERBOSE: Exporting function 'New-SSHTrustedHost'.
VERBOSE: Exporting function 'Remove-SFTPItem'.
VERBOSE: Exporting function 'Remove-SFTPSession'.
VERBOSE: Exporting function 'Remove-SSHSession'.
VERBOSE: Exporting function 'Remove-SSHTrustedHost'.
VERBOSE: Exporting function 'Rename-SFTPFile'.
VERBOSE: Exporting function 'Set-SFTPContent'.
VERBOSE: Exporting function 'Set-SFTPLocation'.
VERBOSE: Exporting function 'Set-SFTPPathAttribute'.
VERBOSE: Exporting function 'Start-SSHPortForward'.
VERBOSE: Exporting function 'Stop-SSHPortForward'.
VERBOSE: Exporting function 'Test-SFTPPath'.
VERBOSE: Exporting cmdlet 'Get-SCPFile'.
VERBOSE: Exporting cmdlet 'Get-SCPFolder'.
VERBOSE: Exporting cmdlet 'Get-SCPItem'.
VERBOSE: Exporting cmdlet 'Get-SFTPFile'.
VERBOSE: Exporting cmdlet 'Get-SFTPItem'.
VERBOSE: Exporting cmdlet 'Set-SCPItem'.
VERBOSE: Exporting cmdlet 'Set-SFTPFile'.
VERBOSE: Exporting cmdlet 'Set-SFTPFolder'.
VERBOSE: Exporting cmdlet 'Set-SFTPItem'.
VERBOSE: Exporting cmdlet 'New-SFTPSession'.
VERBOSE: Exporting cmdlet 'New-SSHSession'.
VERBOSE: Exporting cmdlet 'Set-SCPFile'.
VERBOSE: Exporting cmdlet 'Set-SCPFolder'.
VERBOSE: Importing cmdlet 'Get-SCPFile'.
VERBOSE: Importing cmdlet 'Get-SCPFolder'.
VERBOSE: Importing cmdlet 'Get-SCPItem'.
VERBOSE: Importing cmdlet 'Get-SFTPFile'.
VERBOSE: Importing cmdlet 'Get-SFTPItem'.
VERBOSE: Importing cmdlet 'New-SFTPSession'.
VERBOSE: Importing cmdlet 'New-SSHSession'.
VERBOSE: Importing cmdlet 'Set-SCPFile'.
VERBOSE: Importing cmdlet 'Set-SCPFolder'.
VERBOSE: Importing cmdlet 'Set-SCPItem'.
VERBOSE: Importing cmdlet 'Set-SFTPFile'.
VERBOSE: Importing cmdlet 'Set-SFTPFolder'.
VERBOSE: Importing cmdlet 'Set-SFTPItem'.
VERBOSE: Importing function 'Get-PoshSSHModVersion'.
VERBOSE: Importing function 'Get-SFTPChildItem'.
VERBOSE: Importing function 'Get-SFTPContent'.
VERBOSE: Importing function 'Get-SFTPLocation'.
VERBOSE: Importing function 'Get-SFTPPathAttribute'.
VERBOSE: Importing function 'Get-SFTPSession'.
VERBOSE: Importing function 'Get-SSHPortForward'.
VERBOSE: Importing function 'Get-SSHSession'.
VERBOSE: Importing function 'Get-SSHTrustedHost'.
VERBOSE: Importing function 'Invoke-SSHCommand'.
VERBOSE: Importing function 'Invoke-SSHCommandStream'.
VERBOSE: Importing function 'Invoke-SSHStreamExpectAction'.
VERBOSE: Importing function 'Invoke-SSHStreamExpectSecureAction'.
VERBOSE: Importing function 'Invoke-SSHStreamShellCommand'.
VERBOSE: Importing function 'Move-SFTPItem'.
VERBOSE: Importing function 'New-SFTPFileStream'.
VERBOSE: Importing function 'New-SFTPItem'.
VERBOSE: Importing function 'New-SFTPSymlink'.
VERBOSE: Importing function 'New-SSHDynamicPortForward'.
VERBOSE: Importing function 'New-SSHLocalPortForward'.
VERBOSE: Importing function 'New-SSHRemotePortForward'.
VERBOSE: Importing function 'New-SSHShellStream'.
VERBOSE: Importing function 'New-SSHTrustedHost'.
VERBOSE: Importing function 'Remove-SFTPItem'.
VERBOSE: Importing function 'Remove-SFTPSession'.
VERBOSE: Importing function 'Remove-SSHSession'.
VERBOSE: Importing function 'Remove-SSHTrustedHost'.
VERBOSE: Importing function 'Rename-SFTPFile'.
VERBOSE: Importing function 'Set-SFTPContent'.
VERBOSE: Importing function 'Set-SFTPLocation'.
VERBOSE: Importing function 'Set-SFTPPathAttribute'.
VERBOSE: Importing function 'Start-SSHPortForward'.
VERBOSE: Importing function 'Stop-SSHPortForward'.
VERBOSE: Importing function 'Test-SFTPPath'.
Import-Module Posh-SSH
[System.AppDomain]::CurrentDomain.GetAssemblies() | ? { $_.Location -like '*ssh*' }
# [Threading.Thread]::GetDomain().GetAssemblies() | ? { $_.Location -like '*ssh*' }
GAC Version Location
--- ------- --------
True v4.0.30319 C:\Windows\Microsoft.Net\assembly\GAC_64\Renci.SshNet\v4.0_10.0.0.0__31bf3856ad364e35\Renci.SshNet.dll
Renaming the file 'Assembly\Renci.SshNet.dll' into Renci.SshNet2.dll and merging these changes within the file Posh-SSH.psd1, your PS Module is working again on Windows Server 2019.
( Click to see how the edited parts of Posh-SSH.psd1 look like after those changes )
# Assemblies that must be loaded prior to importing this module
RequiredAssemblies = @('Assembly\Renci.SshNet2.dll')
# List of all files packaged with this module
FileList = @('Posh-SSH.psm1','PoshSSH.dll','Assembly\Renci.SshNet2.dll')
@moddingg33k Thank you for this solution - it seems to be the simplest interim resolution to this problem. @darkoperator My PS script using Posh-SSH has been working fine for months, until the server update to Windows Server 2019 Datacenter (1809) 10.0.17763 couple hours back. PSVersion 5.1.17763.592
I do see the conflicting GAC version: C:\Windows\Microsoft.Net\assembly\GAC_64\Renci.SshNet\v4.0_10.0.0.0__31bf3856ad364e35\Renci.SshNet.dll
I have the same issue across Windows 2019 Servers, and implementing the file name change addressed the issue.
Okay, sounds good. I am struggling with implementing this.
I have renamed my file Assembly\Renci.SshNet.dll -> Assembly\Renci.SshNet2.dll I enter the changes in the Posh.SSH.psd1 file, but still get the RenciSsshNet error.
This is what I have in my .psd1 file.
#
# Module manifest for module 'SSH'
#
# Generated by: Carlos
#
# Generated on: 10/12/2012
#
# Because of Windows update issues on 13.09.19, we need to rename the .dll file
RequiredAssemblies = @('Assembly\renci.SshNet2.dll')
# List of all files packed with this modul
Filelist = @('Posh-SSH.psm1','PoshSSH.dll','Assembly\Rence.SshNet2.dll')
@{
# Script module or binary module file associated with this manifest.
#RootModule = ''
# Version number of this module.
ModuleVersion = '2.2'
Okay, sounds good. I am struggling with implementing this.
I have renamed my file Assembly\Renci.SshNet.dll -> Assembly\Renci.SshNet2.dll I enter the changes in the Posh.SSH.psd1 file, but still get the RenciSsshNet error.
This is what I have in my .psd1 file.
# # Module manifest for module 'SSH' # # Generated by: Carlos # # Generated on: 10/12/2012 # # Because of Windows update issues on 13.09.19, we need to rename the .dll file RequiredAssemblies = @('Assembly\renci.SshNet2.dll') # List of all files packed with this modul Filelist = @('Posh-SSH.psm1','PoshSSH.dll','Assembly\Rence.SshNet2.dll') @{ # Script module or binary module file associated with this manifest. #RootModule = '' # Version number of this module. ModuleVersion = '2.2'
You made a typo in the dll-name (rence.sshnet instead of renci)
Okay, that was Amature like :) Now I just have to figure out why I get errors like
The term New-SFTPSession is not recognized
The term Set-SFTPSession is not recognized
The term Get-SFTPSession is not recognized
what does 'get-command -module posh-ssh' return?