Scripting Blog

A place to learn about PowerShell and share stories of automation

How Can I Tally Up All the Words Found in a Text File?

Hey, Scripting Guy! While browsing the Internet I found a script that showed me how to get a list of all the unique words in a text file. That’s useful, but I’d like to go one step further: how can I determine the number of times each of those words occurs??-- TZ Hey, TZ. As it turns out, that’s a lot easier than you might think. In ...

How Can I Monitor Event Log Messages for Specific Words?

Hey, Scripting Guy! How can I monitor event log messages for a specific word or phrase?-- GH Hey, GH. You know, now that the 2007 Scripting Games are over (have we mentioned that the 2008 Games are just a year away?) it’s time for the Scripting Guys to rejoin the real world. Before we answer your question, however, could you give us a ...

How Can I Add the Last-Saved Date to the Footer of a Microsoft Word Document?

Hey, Scripting Guy! How can I put the date that a Microsoft Word document was last saved in the footer of that document? Oh: and how can I center that footer while I’m at it?-- GH Hey, GH. Well, the best way to go about – say, wait a second here: that sounds suspiciously like two questions, one about putting the last-saved date in the ...

How Can I Tell If a Script is Running on the First or Second Monday of a Month?

Hey, Scripting Guy! We have a logon script that needs to perform certain tasks only on the first and second Mondays of the month. How can I determine whether the script is running on the first or second Monday in a month?-- WA Hey, WA. You know, a few months ago the Scripting Guy who writes this column noticed that his watch had stopped; ...

How Can I Return Information For Each Member in a Group?

Hey, Scripting Guy! How can I write a script that, for each member in a group, returns the member’s name, department, address, title, and description?-- TL-V Hey, TL-V. You would have to mention the word “script,” wouldn’t you? Usually that wouldn’t bother us too much, but in the past 9 days or so the Scripting Guy who writes this...

Feedback usabilla icon