Script automatically pauses after some time

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

This topic contains 1 reply, has 2 voices, and was last updated by

 
Participant
3 months ago.

  • Author
    Posts
  • #161921

    Participant
    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

    Participant
    Topics: 2
    Replies: 54
    Points: 278
    Helping Hand
    Rank: 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.

The topic ‘Script automatically pauses after some time’ is closed to new replies.