Foreach issues – only treating last domain on list

Welcome Forums General PowerShell Q&A Foreach issues – only treating last domain on list

Viewing 0 reply threads
  • Author
    Posts
    • #235756
      Participant
      Topics: 7
      Replies: 8
      Points: 88
      Rank: Member

      Hi Powershell!

      I am working on trying to make a Powershell / WinSCP script that can do the following:

      Consider a list of domains

      Delete a list of the same files, from each of these domains

      Upload new data to another location on these same domains.

      It sort of works by now, but, for some reason my foreach loop does not seem to quite get me.
      It seems to be only taking the last domain on the list, which is testmappe2.dk

      The ouput (written to host) is:

      Removing of file testmappe2.dk/pluginfil/* succeeded
      Removing of file testmappe2.dk/mappe/* succeeded
      Uploading to C:\Users\Dern\Desktop\REPLACEME\* testmappe2.dk/* …
      Uploading to C:\Users\Dern\Desktop\REPLACEME\* testmappe2.dk/* …
      Error: Exception setting “SessionLogPath”: “Object is disposed”

      Is seems to entirely skip testmappe.dk, which is the first one.

      Also, can anyone enlighten me on why i get this exception error “object is disposed”?

      I really hope someone can help me the last bit here! 🙂

      Link to code: https://gist.github.com/Jonatantwn/cf5a17a80327adcb6a25e11524a766c0

      Best regards
      Jonatan

Viewing 0 reply threads
  • You must be logged in to reply to this topic.