Scripting Blog [archived]

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

How Can I Determine the Date and Time that a Process Started?

(image) Hey, Scripting Guy! How can I determine the date and time that a process started?-- BM(image) (image) (image) Hey, BM. We’ve got good news for you: not only do we have an answer to your question, but we’re not going to bore everyone with any more stories regarding our Colt League All-Star team. Nope, we’re no longer haunted ...

How Can I Determine the Date for the Friday in a Given Week?

(image) Hey, Scripting Guy! Given a date, can a script tell me the date that the Friday for that week occurs?-- DLR(image) (image) (image) Hey, DLR. Too bad you didn’t ask which dates Saturdays, Sundays, and holidays fall on; coincidentally enough, each of the Scripting Guys have memorized - years in advance - all the days that we aren...

How Can I Determine the Week of the Month a Date Falls In?

(image) Hey, Scripting Guy! How can I determine the week of the month a date falls in?-- AK(image) (image) (image) Hey, AK. You’re probably familiar with the book Moby Dick, the story of a crazy sea captain who became obsessed with hunting down and finishing off the great white whale. Well, this question turned out to be the Moby Dick of...

How Can I Determine the Elapsed Time Between Two Dates?

(image) Hey, Scripting Guy! How can I tell how many days there are between two dates? For example, if I have a log file that says an application started on January 1, 2005 and that the application ended today, is there a way to determine how many days the application ran?-- AL(image) (image) (image) Hey, AL. You know, in the second Hey, ...

How Can I Determine the System Time on a Computer?

(image) Hey, Scripting Guy! Is there any way to retrieve the system time as configured on a remote computer?-- JJ(image) (image) (image) Hey, JJ. There are at least two ways to do this, both using WMI. If you’re running Windows XP or Windows Server 2003, you can use the WMI class Win32_LocalTime. As you can see, that makes it pretty easy...