Scripting Blog

A place to learn about PowerShell and share stories of automation

How Can I Replace the First Five Characters in a Text File With the First Five Characters in the Computer Name?

Hey, Scripting Guy! How can I open a text file and replace the first 5 characters with the first 5 characters of the local computer name?-- EC Hey, EC. You know, you might find this hard to believe (his fellow Scripting Guys absolutely refuse to believe it), but sometimes the Scripting Guy who writes this column is all talk and no action. ...

How Can I Write a Script That Increments a Counter Each Time a Log File is Updated?

Hey, Scripting Guy! How can I write a script that increments a counter each time a particular log file gets updated?-- HJ Hey, HJ. You know, lately the Scripting Guy who writes this column has been victimized by a disturbing phenomenon: he keeps getting phone calls from machines. For the past several nights the phone has rung in the ...

How Can I Get a List of All the Local Users Who Have an Expiring Password?

Hey, Scripting Guy! How can I get a list of all the local users who have an expiring password?-- JM Hey, JM. Thanks for the question. Before we answer it, however, we have a question for you: you don’t by any chance have any spare dice lying around, do you? That’s right, dice, the kind you use when playing board games and craps and ...

How Can I Tell Which Version of QuickTime is Installed on a Computer?

Hey, Scripting Guy! How can I tell whether or not QuickTime is installed on a computer, and, if so, which version is installed?-- IU Hey, IU. You know, for some reason this column suddenly seems to have become a daily dancing column rather than a daily scripting column. After all, just yesterday we recapped the Scripting Son’s … dancing...

How Can I Tack a Prefix Onto the Telephone Numbers of All the Users in My Domain?

Hey, Scripting Guy! How can I tack a prefix onto the telephone numbers of all the users in my domain?-- JB Hey, JB. It’s Monday morning as this column is being written, and the Scripting Guy who actually writes this column is still a bit tired from driving across the state and back in order to attend his niece’s wedding. Yes, yet ...