Scripting Blog

A place to learn about PowerShell and share stories of automation

Hey, Scripting Guy! How Do I Display a Message and the Time a Process Was Terminated?

Hey, Scripting Guy! We have this application that is supposed to run all the time. It is constantly giving us headaches and crashing. The applications vendor evidently expects it to crash all the time and has a thread that will restart it three times. After that, it is pretty much down for the count. The problem is that we never know when ...

Hey, Scripting Guy! How Can I Be Notified When a Process Begins?

Hey, Scripting Guy! I need to be notified when a process begins. I would like to use Windows PowerShell to do this, but it does not seem to work. While I could do this in VBScript, I prefer to use Windows PowerShell. Can this be done?- NLHi NL,Because we have access to the .NET Framework in Windows PowerShell, it can most certainly be done...

How Can I Check Every 30 Minutes to See If a File Has Been Modified?

Hey, Scripting Guy! How can I monitor an application’s log file and issue an alert if the timestamp on that file hasn’t changed in the last 30 minutes?-- JA Hey, JA. You know that’s a very interesting question, and one that – say, wait a second. You’re not JA from Stanwood, WA are you? Are you sure about that? Well, OK; we’ll ...

How Can I Start a Process and Then Log the User Off When That Process Ends?

Hey, Scripting Guy! How can I write a script that starts a process, waits until that process ends, and then logs the user off the computer?-- AG Hey, AG. You know, the Scripting Guy who writes this column is never one to brag, mainly because he never has much of anything to brag about. In addition tot that, however, he is a humble and ...

How Can I Start a Process and Then Wait For the Process to End Before Terminating the Script?

Hey, Scripting Guy! How can I start a process and then wait until that process quits before terminating the script?-- FGHey, FG. Before we answer your question, the Scripting Guy who writes this column has a confession to make: he’s the one who ruined Christmas for everyone. Not that he meant to, mind you, but that doesn’t matter; all ...