1

I am getting the following errors when trying to get list of items from SharePoint online using PnP-PowerShell:

Get-PnPListItem : The underlying connection was closed: A connection that was expected to be kept alive was closed by the server.

Get-PnPListItem : Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.

This seems to happen when the List of items I am trying to retrieve is large. It might be a timeout error but I am not sure how to fix it. Looking online most people are suggesting updating TLS [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12; but I am not sure if it will help if it is timeout issue.

3
  • Hi.. I'm getting the same issue so by anychance could you share me how you solved this issue if you did. Thank you
    – ziico
    Commented Feb 24, 2022 at 18:07
  • Hi @ziico. I was trying to get list item of multiple library so I just did 1 Library at a time and whenever I got the error I ran the script again. I didn't find a fix for it unfortunately
    – hellothere
    Commented Feb 24, 2022 at 19:26
  • Hi I trying to get only 1 folder from 1 library tho but I'm still getting the error. could please look at my code and see what can I change?stackoverflow.com/questions/71254454/…
    – ziico
    Commented Feb 24, 2022 at 20:24

1 Answer 1

0

Did you check you internet speed? Slower internet speed could hit your computer when Window Auto-Tuning feature is “ON”. You could disable Windows Auto-Tuning level to improve the internet speed if internet speed is slow.

For Reference: https://github.com/pnp/PnP-PowerShell/issues/3000

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.