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

An error occurred while enumerating through a collection: Collection was modified; enumeration operation may not execute..

Open jaumealg opened this issue 2 years ago • 1 comments

Hi, We were using a script with version 2.1 on a former server now we changed to a new server and installed version 3.0.8. Now with the same script we get this error. Any idea?

An error occurred while enumerating through a collection: Collection was modified; enumeration operation may not execute.. At C:\Program Files\WindowsPowerShell\Modules\Posh-SSH\3.0.8\Posh-SSH.psm1:977 char:9

  •         $result
  •         ~~~~~~~     + CategoryInfo          : InvalidOperation: (System.Collecti...SH.SftpSession]:Enumerator) [], RuntimeException     + FullyQualifiedErrorId : BadEnumeration

jaumealg avatar Aug 03 '23 14:08 jaumealg

You create a SFTP session and then you get the error when listing it?  Is this windows powershell or PS7? A snippet of the code where this fails and more info on source and target will help in trying to replicateSent from my iPhoneOn Aug 3, 2023, at 10:57 AM, jaumealg @.***> wrote: Hi, We were using a script with version 2.1 on a former server now we changed to a new server and installed version 3.0.8. Now with the same script we get this error. Any idea? An error occurred while enumerating through a collection: Collection was modified; enumeration operation may not execute.. At C:\Program Files\WindowsPowerShell\Modules\Posh-SSH\3.0.8\Posh-SSH.psm1:977 char:9

        $result         ~~~~~~~     + CategoryInfo          : InvalidOperation: (System.Collecti...SH.SftpSession]:Enumerator) [], RuntimeException     + FullyQualifiedErrorId : BadEnumeration

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you are subscribed to this thread.Message ID: @.***>

darkoperator avatar Aug 03 '23 17:08 darkoperator