Scripting Blog [archived]

Formerly known as the "Hey, Scripting Guy!" blog

Hey, Scripting Guy! How Can I Start an Application From a Windows PowerShell Script, Then Pause the Script Until the Application Has Terminated?

(image) Hey, Scripting Guy! In Windows PowerShell, how can I start another application, then have my script pause until that application has terminated?-- AD(image) (image) (image) Hey, AD. Before we answer today’s question, we’d like to make an announcement: the Scripting Guys need friends! No, not those kind of friends. Well, come to...

Hey, Scripting Guy! How Can I Use Windows PowerShell to Delete All the Files in a Folder Older Than 90 Days?

(image) Hey, Scripting Guy! In Windows PowerShell, how can I determine the number of days difference between two dates? I want to be able to delete all the files in a folder that are more than 90 days old.-- JN(image) (image) (image) Hey, JN. You know, today is October 31st and, in the US at least, it’s the day when the dark underworld ...

How Can I Use Windows PowerShell to Retrieve Environment Variables and Special Folder Paths?

(image) Hey, Scripting Guy! How can I use Windows PowerShell to retrieve the value of environment variables and the path to a special folder?-- SB (image) (image) (image) Hey, SB. Well, it’s Thursday, which means that the Scripting Guy who writes this column is currently in Walla Walla, WA, which, as Daffy Duck fans all know, is the home...

How Can I Get a List of All the Users Who Have a Process Open on a Computer?

(image) Hey, Scripting Guy! How can I get a list of all the users who have a process open on a computer?-- RE (image) (image) (image) Hey, RE. You know, over the past 5 years the number of people who watch the news on the major networks (ABC, NBC, and CBS) has dropped precipitously; the number of people who read the newspaper each day has ...

How Can I Use Windows PowerShell to Be Notified When an Application Terminates?

(image) Hey, Scripting Guy! We have an in-house application that, unfortunately, crashes a lot; when that happens we have to go through a lengthy procedure to restart the program. Using Windows PowerShell, is there any way I can be notified when this application crashes?-- OI(image) (image) (image) Hey, OI. You know, at first we thoughts ...