Scripting Blog [archived]

Formerly known as the "Hey, Scripting Guy!" blog

Speed Up Array Comparisons in Powershell with a Runtime Regex

Summary: Learn how to speed up array comparisons in Windows PowerShell by using a runtime regular expression (image)   Hey, Scripting Guy! I am interested in speeding up comparisons of arrays when I use Windows PowerShell. Can you help me? —CR (image) Hello CR, Microsoft Scripting Guy, Ed Wilson, here. We are still in our Guest ...

Hey, Scripting Guy! How Can I Parse My Firewall Log File to See What Kind of Packets Are Being Sent?

(image) Hey, Scripting Guy! I would like to parse the firewall log on my computer and find out the kinds of packets that are going out. You know, how many Web page packets, how many DNS lookups, how many pings. That kind of stuff. I figure that I can look at these logs and pick up diagnostic information. For example, if I see a bunch of DNS ...

Hey, Scripting Guy! How Can I Store Arrays Within Another Array?

(image) Hey, Scripting Guy! I need to read in data from a text file and store each line as a separate item in an array. However, the data in each line must also be stored as an array; in other words, I need an array made up of other arrays. I tried creating a multidimensional array, but I can’t get it to work. Can you help?-- PA(image) (...

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

(image) Hey, Scripting Guy! How can I import a fixed-width data file into Microsoft Excel?-- RS(image) (image) (image) 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 ...

Hey, Scripting Guy! How Can I Remove Duplicate Values From a Pair of Text Files?

(image) Hey, Scripting Guy! I have two text files that contain numbers. I need to write a script that can determine whether a given number exists in both of these text files. If it does, I need to delete that line from each of the two files. How do I do that?-- KT(image) (image) (image) Hey, KT. Before we get started today, we have a ...