I done this so far:
3 functions—- (function Main is the function that runs when you start the appliction)
And som more logging... and stuff.
My problem is this:
What to do??
It's hard to tell without seeing your code, but you're probably going to have better luck using event-driven monitoring rather than writing your PollAlerts function. If this were a .NET application, I'd say that your PollAlerts function was blocking your GUI thread, but I'm not sure how well that concept applies to a PowerShell script.
Anyhow, do a web search for "PowerShell FileSystemWatcher" and you'll find lots of examples for using .NET's System.IO.FileSystemWatcher class in conjunction with PowerShell's Register-ObjectEvent cmdlet.
I'll second that. Unless you've got a TON of files being created in a short period of time (e.g., seconds), the FileSystemWatcher .NET component is much more reliable. It fires an event when new files appear, and you can register to receive that event and execute code in response to it. It's much more reliable, and lower-overhead, than a polling routine.
Thanks for your answers guys!
I managed to solve it before I had a chance to read your answers. I Will look into the "FileSystemWatcher" when we have our next release.
You must be logged in to reply to this topic.