Scripting Blog

A place to learn about PowerShell and share stories of automation

Hey, Scripting Guy! How Can I Convert an Extension Number to an Actual Phone Number?

Our phone numbers are stored in Active Directory as extension numbers; however, we have a set of rules for converting those extensions to actual phone numbers. I’m writing a script to create an Outlook signature, but in that script I need to be able to convert an extension to a phone number. How do I do that?-- SM Hey, SM. You know, you ...

How Can I Remove All the Non-Alphabetic Characters in a String?

Hey, Scripting Guy! How can I remove all the non-alphabetic characters in a string?-- CD Hey, CD. You know, typically the Scripting Guys don’t play favorites; we treat all our readers and all the questions we receive exactly the same. (OK, so, technically that means that, for the most part, we simply ignore all our readers as well as all ...

How Can I Delete Specified Characters From the Beginning and End of My File Names?

Hey, Scripting Guy! How can I truncate file names by removing a common beginning and ending, leaving only the unique middle portion of the name?-- RE Hey, RE. Before we answer your question we’d like to point out that we’ve finally posted the winners of the Scripting Guys TechEd Challenge. (If you are a winner we’ve got good news: ...

How Can I Locate a Value in a Text File and Then Parse the Line of Text Where the Value Was Found?

Hey, Scripting Guy! How can I open a CSV file, locate a value in column 1, then store the value in column 2 in a variable?-- THvdH Hey, HvdH. We have to be honest with you, it’s a little difficult for the Scripting Guy who writes this column to stay focused on his work today. After all, tomorrow is one of the biggest and best of all ...

How Can I Extract the Text Between the Header and Footer in a Text File?

Hey, Scripting Guy! How can I extract the text between the header and footer in a text file?-- LL Hey, LL. Before we answer your question we should point out that, depending on when you’re reading this, you might be missing Day 1 of Windows PowerShell Week. Even as we speak the lovely and talented Jean Ross could be presenting an ...

Feedback usabilla icon