Scripting Blog

A place to learn about PowerShell and share stories of automation

How Can I Query a Text File and Retrieve Records That Occurred on a Specific Date?

Hey, Scripting Guy! We have tons of text files in which each line in the file represents a record or an event of some kind. How can I use a script to retrieve records or events that occurred on a specified date?-- TW Hey, TW. You know, in your email you sort of apologized for using text files, noting that “I know, I know, we should ...

How Can I Save a Disconnected Recordset?

  Hey, Scripting Guy! How can I save a disconnected recordset?-- RW Hey, RW. You know, the Scripting Guys believe in keeping things as simple as possible. For example, when one of the Scripting Guys had to buy a new tie several years ago, he simply asked his dad to tie it for him; on the rare occasions when this Scripting Guy has to ...

How Can I Locate and Replace Information for a Specific Item in a Spreadsheet?

Hey, Scripting Guy! In an Excel spreadsheet, how can I locate and replace information for a specific computer?-- BB Hey, BB. You know, there’s an old saying that goes, “If all you have is a hammer then everything looks like a nail.” Well, all we Scripting Guys have at the moment is some code for modifying a record in a database. So ...

How Can I Use ADO to Read a Text File Where All the Data is on a Single Line?

Hey, Scripting Guy! I have a fixed-width text file which includes first name (6 characters), last name (13 characters), and department (9 characters) all on a single line. How do I read that using ADO?-- DW Hey, DW. Well, to be perfectly honest, we don’t think you can read a file like this using ADO (ActiveX Data Objects). ADO is a ...

How Can I Retrieve a List of the System DSNs on a Computer?

Hey, Scripting Guy! How can I retrieve a list of the System DSNs on a computer?-- RT Hey, RT. You know, there’s an old Hollywood superstition that suggests that famous movie stars always die in threes: if a famous star dies today, then according to legend two more famous stars are doomed to die in the next week as well. We don’t know if...

Feedback usabilla icon