Scripting Blog

A place to learn about PowerShell and share stories of automation

Hey, Scripting Guy! How Can I Use Windows PowerShell to Determine the Owner of a File?

Hey, Scripting Guy! Is it possible to determine the owner of a file using Windows PowerShell?-- GF Hey, GF. Well, today is April 15th, which, in the US, can mean only one thing: it’s time to celebrate the birthday of Italian mathematician Pietro Antonio Cataldi, best known for discovering the sixth and seventh Mersenne primes. Pietro, who...

Hey, Scripting Guy! How Can I Import a Fixed-Width Data File into Microsoft Excel?

Hey, Scripting Guy! How can I import a fixed-width data file into Microsoft Excel?-- RS Hey, RS. This column is being written on a Friday morning, and so far it’s been a very weird morning at that. For one thing, it’s not raining and – if you look closely – you can even see the sun. (It’s been awhile, but we’d recognize the sun ...

Hey, Scripting Guy! How Can I Use Windows PowerShell to Look at All the Microsoft Office Documents in a Folder?

Hey, Scripting Guy! I am trying to use Windows PowerShell to look at files on my computer; what I want to do is get back a history (that is, the last time a document was accessed) for all the Microsoft Office files in a folder and its subfolders. However, I’m not having much luck. Any ideas would be appreciated.-- KM Hey, KM. We don’t ...

Hey, Scripting Guy! How Can I Delete Duplicate Entries in a Tab-Delimited File?

Hey, Scripting Guy! How can I delete the duplicate entries in a tab-delimited file?-- ST Hey, ST. Before we start, is anyone out there familiar with the book Not Quite What I Was Planning: Six-Word Memoirs by Writers Famous and Obscure? Not Quite What I Was Planning is an interesting little book in which the editors of SMITH magazine asked ...

Hey, Scripting Guy! How Can I Conditionally Add Lines to a Text File?

Hey, Scripting Guy! I need a script that can read a file and, based on the contents, insert some additional lines of text into that file. Can you help me with that?-- JS Hey, JS. We’re sure that most of you have heard by now that Microsoft has made an offer to buy Yahoo!, an offer currently valued at around $42 billion. (Because the offer...