darkoperator / Posh-SSH

PowerShell Module for automating tasks on remote systems using SSH
BSD 3-Clause "New" or "Revised" License
983 stars 227 forks source link

SFTP Get-SFTPItem #317

Open rickschwabe opened 4 years ago

rickschwabe commented 4 years ago

If I want to load a folder with the following syntax, the download also starts. Get-SFTPItem -SessionId 0 -Destination 'C:\Temp\Folder' -Path '/Folder/' After a short time (3 folders) the Powershell Console and itself crashes without an error message.

PS-Version: 5.1.18362.628 OS: Windows 10 1909 Posh-SSH Version: 2.2

darkoperator commented 4 years ago

What ia the error message

Sent from my iPhone

On Mar 25, 2020, at 11:50 AM, Damich21 notifications@github.com wrote:

 If I want to load a folder with the following syntax, the download also starts. Get-SFTPItem -SessionId 0 -Destination 'C:\Temp\Folder' -Path '/Folder/' After a short time (3 folders) the Powershell Console and itself crashes without an error message.

PS-Version: 5.1.18362.628 OS: Windows 10 1909 Posh-SSH Version: 2.2

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

rickschwabe commented 4 years ago

What ia the error message Sent from my iPhone On Mar 25, 2020, at 11:50 AM, Damich21 @.***> wrote:  If I want to load a folder with the following syntax, the download also starts. Get-SFTPItem -SessionId 0 -Destination 'C:\Temp\Folder' -Path '/Folder/' After a short time (3 folders) the Powershell Console and itself crashes without an error message. PS-Version: 5.1.18362.628 OS: Windows 10 1909 Posh-SSH Version: 2.2 — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.

There is no error message, the console just closes. Windows Event Log only says unknown powershell error. Testet on multiple Systems

darkoperator commented 4 years ago

How deep, how many items and how much data? Just pulled a sbin and etc folder from a remote openssh linux server and could not replicate

rickschwabe commented 4 years ago

31 Folders in Top Level Folder

Overall Size: 9MB Overall Items: 159 Overall Folders with Subfolders: 248 Longest File Tree 4 Subfolders after Toplevel Folder

Pulled from Synology NAS FTP Top Level Folder - no hidden Items/Folder in it.

rickschwabe commented 4 years ago

With the WinSCP Powershell Module an the same Directory, run with no errors. But I want to use your module, any idea ?

darkoperator commented 4 years ago

Have not had a chance to test more. Will try to set some time this weekend

Sent from my iPhone

On Mar 27, 2020, at 1:36 PM, Damich21 notifications@github.com wrote:

 With the WinSCP Powershell Module an the same Directory, run with no errors. But I want to use your module, any idea ?

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

rickschwabe commented 4 years ago

Any Updates ?

darkoperator commented 4 years ago

Have not been able to replicate the issue on Linux and Windows SSH server :(

Sent from my iPhone

On May 14, 2020, at 11:07 AM, Damich21 notifications@github.com wrote:

 Any Updates ?

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

heabc-it commented 4 years ago

I'm getting the same problem as above. PowerShell just exits when downloading 80 files (around 105MB) from a linux server using Get-SFTPItem.

PowerShell: 5.1.18362.752 Windows OS: Windows 10 1909 Posh-SSH Version: 2.2

Interestingly, when running on Windows Server 2012, instead of just exiting, it actually pops up with "powershell has stopped working" and seems to actually keep running in the background (very slowly) until I close the popup.

From Event Viewer:

Fault bucket 2266114034348733615, type 5
Event Name: PowerShell
Response: Not available
Cab Id: 0

Problem signature:
P1: powershell.exe
P2: 10.0.18362.752
P3: nagement.Automation.PSArgumentOutOfRange
P4: nagement.Automation.PSArgumentOutOfRange
P5: ment.Automation.ProgressRecord.set_PercentComplete
P6: ment.Automation.ProgressRecord.set_PercentComplete
P7: unknown
P8: 
P9: 
P10: 

Any help would be appreciated!

rickschwabe commented 4 years ago

I'm getting the same problem as above. PowerShell just exits when downloading 80 files (around 105MB) from a linux server using Get-SFTPItem.

PowerShell: 5.1.18362.752 Windows OS: Windows 10 1909 Posh-SSH Version: 2.2

Interestingly, when running on Windows Server 2012, instead of just exiting, it actually pops up with "powershell has stopped working" and seems to actually keep running in the background (very slowly) until I close the popup.

From Event Viewer:

Fault bucket 2266114034348733615, type 5
Event Name: PowerShell
Response: Not available
Cab Id: 0

Problem signature:
P1: powershell.exe
P2: 10.0.18362.752
P3: nagement.Automation.PSArgumentOutOfRange
P4: nagement.Automation.PSArgumentOutOfRange
P5: ment.Automation.ProgressRecord.set_PercentComplete
P6: ment.Automation.ProgressRecord.set_PercentComplete
P7: unknown
P8: 
P9: 
P10: 

Any help would be appreciated!

Never find a s

I'm getting the same problem as above. PowerShell just exits when downloading 80 files (around 105MB) from a linux server using Get-SFTPItem.

PowerShell: 5.1.18362.752 Windows OS: Windows 10 1909 Posh-SSH Version: 2.2

Interestingly, when running on Windows Server 2012, instead of just exiting, it actually pops up with "powershell has stopped working" and seems to actually keep running in the background (very slowly) until I close the popup.

From Event Viewer:

Fault bucket 2266114034348733615, type 5
Event Name: PowerShell
Response: Not available
Cab Id: 0

Problem signature:
P1: powershell.exe
P2: 10.0.18362.752
P3: nagement.Automation.PSArgumentOutOfRange
P4: nagement.Automation.PSArgumentOutOfRange
P5: ment.Automation.ProgressRecord.set_PercentComplete
P6: ment.Automation.ProgressRecord.set_PercentComplete
P7: unknown
P8: 
P9: 
P10: 

Any help would be

I'm getting the same problem as above. PowerShell just exits when downloading 80 files (around 105MB) from a linux server using Get-SFTPItem.

PowerShell: 5.1.18362.752 Windows OS: Windows 10 1909 Posh-SSH Version: 2.2

Interestingly, when running on Windows Server 2012, instead of just exiting, it actually pops up with "powershell has stopped working" and seems to actually keep running in the background (very slowly) until I close the popup.

From Event Viewer:

Fault bucket 2266114034348733615, type 5
Event Name: PowerShell
Response: Not available
Cab Id: 0

Problem signature:
P1: powershell.exe
P2: 10.0.18362.752
P3: nagement.Automation.PSArgumentOutOfRange
P4: nagement.Automation.PSArgumentOutOfRange
P5: ment.Automation.ProgressRecord.set_PercentComplete
P6: ment.Automation.ProgressRecord.set_PercentComplete
P7: unknown
P8: 
P9: 
P10: 

Any help would be appreciated!

appreciated!

I'm getting the same problem as above. PowerShell just exits when downloading 80 files (around 105MB) from a linux server using Get-SFTPItem.

PowerShell: 5.1.18362.752 Windows OS: Windows 10 1909 Posh-SSH Version: 2.2

Interestingly, when running on Windows Server 2012, instead of just exiting, it actually pops up with "powershell has stopped working" and seems to actually keep running in the background (very slowly) until I close the popup.

From Event Viewer:

Fault bucket 2266114034348733615, type 5
Event Name: PowerShell
Response: Not available
Cab Id: 0

Problem signature:
P1: powershell.exe
P2: 10.0.18362.752
P3: nagement.Automation.PSArgumentOutOfRange
P4: nagement.Automation.PSArgumentOutOfRange
P5: ment.Automation.ProgressRecord.set_PercentComplete
P6: ment.Automation.ProgressRecord.set_PercentComplete
P7: unknown
P8: 
P9: 
P10: 

Any help would be appreciated!

I have not found a solution to this. with the WinSCP module it works for me. However, this does not offer me the same functions. So I still hope for a solution from the developer.

darkoperator commented 4 years ago

The reporting of progress in SSH.Net is unreliable I will have to fully remove it since it has been a source of problems in the past. The WinSCP module you are controlling the exe it self from .net via PS, if you start procmon from sysinternal you can see the actions. will look at removing progress printing for SFTP and SCP in the next major release

darkoperator commented 4 years ago

can you re-run using the noprogress param?

heabc-it commented 4 years ago

I actually tried this cause I thought it might be what what causing it. Still the same result though unfortunately, silently exits.

darkoperator commented 4 years ago

are you using Beta1 or 2.2?

heabc-it commented 4 years ago

Here what I get when running Get-PoshSSHModVersion:

WARNING: Could not retrieve the current version.

InstalledVersion CurrentVersion
---------------- --------------
2.2
darkoperator commented 4 years ago

can you test with the beta version?

heabc-it commented 4 years ago

Unfortunately the result is the same in 2.3, crashes in the exact same spot :(

darkoperator commented 4 years ago

Even with noprogess? Also could you provide info on what version of Linux is the target host? Also is there any firewall in-between? Seems deep SSH inspection causes issues with Posh-SSH

On Jun 23, 2020, at 12:42 PM, heabc-it notifications@github.com wrote:

Scratch the above, figured it out.

Unfortunately, result is the same in 2.3, crashes in the exact same spot :(

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/darkoperator/Posh-SSH/issues/317#issuecomment-648281347, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAD7IHSM5DO3OU4KWQ2RETTRYDLQRANCNFSM4LTRUPWQ.

heabc-it commented 4 years ago

Yes I left the -NoProgress flag in, same result. There is no firewall in-between.

Target host info: Ubuntu 16.04.6 LTS (GNU/Linux 4.4.0-177-generic x86_64)

Thanks for your quick responses! Hope this can be solved

darkoperator commented 4 years ago

was abe to replicate with that version of Linux, it does not happen with the more modern version for some reason. But if I go PowerShell with no progress which is done in C# it works image

darkoperator commented 4 years ago

image Download Example. This could be a workaround for now. definitely for version 3.x progress will be removed

heabc-it commented 4 years ago

Ahh thanks for this! I might just upgrade to a newer version of Linux if my server is able. If not I'll try the workaround, just not very familiar with C#.

darkoperator commented 4 years ago

That is PowerShell in the examples not C# :) you should be able to use those PS commands

heabc-it commented 4 years ago

Oh you're right! Sorry been a long day.

I got this working for a single file, but not for a directory of files (which is why I originally used Get-SFTPItem and not Get-SFTPFile). When I specify a folder instead of a file, I get Access to the path is denied.

darkoperator commented 4 years ago

You will need to list the files and download each individually, the object does not have a download directory method.

heabc-it commented 4 years ago

This isn't an option for me unfortunately as the file names are always changing, I need to be able to get the whole directory via Get-SFTPItem

I upgraded the remote server to 18.04 and am still having the same issue. What version is needed to stop this from happening?

sdeycode commented 4 years ago

Facing issue in using PSCredential in powershell 7. it seems it is not a problem with Powershell. Is there any solution for this? I am trying to get secure keyvault assigned to Pipeline variable and pass the same to powershell to connect to remote linux server for deployment from Windows Build machine

darkoperator commented 4 years ago

Powershell 7 is not supported, the module was written for windows powershell

Sent from my iPhone

On Aug 13, 2020, at 9:36 PM, sdeycode notifications@github.com wrote:

 Facing issue in using PSCredential in powershell 7. it seems it is not a problem with Powershell. Is there any solution for this? I am trying to get secure keyvault assigned to Pipeline variable and pass the same to powershell to connect to remote linux server for deployment from Windows Build machine

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

nathan-thomas commented 3 years ago

Replicated this issue downloading a directory from an ancient RedHat 5 server. It only has archaic encryption protocols. Hypothesis: the issue is with whatever encryption protocol Get-SFTPItem and the server are settling on.

This didn't happen when using Get-SFTPItem on a RedHat 8 server.

darkoperator commented 3 years ago

Have you tried using the beta versions?

On May 6, 2021, at 11:24 PM, nathan-thomas @.***> wrote:

Replicated this issue downloading a directory from an ancient RedHat 5 server. It only has archaic encryption protocols. Hypothesis: the issue is with whatever encryption protocol Get-SFTPItem and the server are settling on.

This didn't happen when using Get-SFTPItem on a RedHat 8 server.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/darkoperator/Posh-SSH/issues/317#issuecomment-834034812, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAD7IHWEUUE6BWKMMABY6R3TMNMNXANCNFSM4LTRUPWQ.