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

SFTP Get-SFTPItem

Open rickschwabe opened this issue 4 years ago • 30 comments

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

rickschwabe avatar Mar 25 '20 15:03 rickschwabe

What ia the error message

Sent from my iPhone

On Mar 25, 2020, at 11:50 AM, Damich21 [email protected] 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.

darkoperator avatar Mar 25 '20 15:03 darkoperator

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

rickschwabe avatar Mar 25 '20 15:03 rickschwabe

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

darkoperator avatar Mar 25 '20 16:03 darkoperator

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 avatar Mar 25 '20 16:03 rickschwabe

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

rickschwabe avatar Mar 27 '20 17:03 rickschwabe

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 [email protected] 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.

darkoperator avatar Mar 27 '20 18:03 darkoperator

Any Updates ?

rickschwabe avatar May 14 '20 15:05 rickschwabe

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 [email protected] wrote:

 Any Updates ?

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

darkoperator avatar May 14 '20 15:05 darkoperator

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!

heabc-it avatar Jun 23 '20 15:06 heabc-it

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.

rickschwabe avatar Jun 23 '20 15:06 rickschwabe

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 avatar Jun 23 '20 15:06 darkoperator

can you re-run using the noprogress param?

darkoperator avatar Jun 23 '20 15:06 darkoperator

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

heabc-it avatar Jun 23 '20 15:06 heabc-it

are you using Beta1 or 2.2?

darkoperator avatar Jun 23 '20 15:06 darkoperator

Here what I get when running Get-PoshSSHModVersion:

WARNING: Could not retrieve the current version.

InstalledVersion CurrentVersion
---------------- --------------
2.2

heabc-it avatar Jun 23 '20 15:06 heabc-it

can you test with the beta version?

darkoperator avatar Jun 23 '20 15:06 darkoperator

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

heabc-it avatar Jun 23 '20 16:06 heabc-it

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 [email protected] 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.

darkoperator avatar Jun 23 '20 16:06 darkoperator

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

heabc-it avatar Jun 23 '20 17:06 heabc-it

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 avatar Jun 23 '20 18:06 darkoperator

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

darkoperator avatar Jun 23 '20 18:06 darkoperator

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#.

heabc-it avatar Jun 23 '20 21:06 heabc-it

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

darkoperator avatar Jun 23 '20 21:06 darkoperator

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.

heabc-it avatar Jun 23 '20 21:06 heabc-it

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

darkoperator avatar Jun 23 '20 22:06 darkoperator

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?

heabc-it avatar Jul 09 '20 18:07 heabc-it

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

sdeycode avatar Aug 14 '20 01:08 sdeycode

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 [email protected] 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.

darkoperator avatar Aug 14 '20 02:08 darkoperator

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.

nathan-thomas avatar May 07 '21 03:05 nathan-thomas

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.

darkoperator avatar May 07 '21 13:05 darkoperator