Script automatically pauses after some time

Welcome Forums General PowerShell Q&A Script automatically pauses after some time

  • This topic has 1 reply, 2 voices, and was last updated 1 year ago by
    Senior Moderator
Viewing 1 reply thread
  • Author
    • #161921
      Topics: 1
      Replies: 0
      Points: 11
      Rank: Member

      Hi all

      I’ve written a powershell script that watches a specific directory. Once a file was placed in that directory it gets uploaded somewhere else by the script.
      I’ve noticed that after a few hours the script somehow goes into “idle” state and doesn’t keep watching the folder anymore until I press any key. Then the script continious doing its job again.

      This is very annyoing as the script needs to be awake 24/7.
      Anyone has an idea why this happens? Btw. the script ist started via Windows Task Scheduler, the scheduler logs show that the task was in “running” state all the time so I think it couldn’t have been causing the “idle” state of the script.

      Any help would be much appreciated.

    • #162033
      Senior Moderator
      Topics: 3
      Replies: 123
      Points: 653
      Helping Hand
      Rank: Major Contributor

      First off, it’s basically impossible for anyone to help troubleshoot a script without seeing the script itself. Imagine trying to fix a car engine without being able to look inside of it.

      Secondly, assuming you’re using FileSystemWatcher, I think postanote’s answer in this thread may help you.

Viewing 1 reply thread
  • The topic ‘Script automatically pauses after some time’ is closed to new replies.