Scripting Blog [archived]

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

How Can I Search a Text File for 9-Digit Numbers?

(image) Hey, Scripting Guy! How can I search for user names in a text file? In my case, the user names all consist of 9 digits, although they can be any 9 digits.-- GG(image) (image) (image) Hey, GG. Interesting question. You want to search for 9-digit numbers (like 123456789) in a text file; the only problem is that these could be any 9-...

How Can I Display a Multi-Valued Attribute Returned from an Active Directory Search?

(image) Hey, Scripting Guy! How can I display a multi-valued attribute that I get back when using ADO to search Active Directory?-- ES(image) (image) (image) Hey, ES. For the most part Active Directory is a script writer’s paradise; with very few exceptions anything you can do using the Active Directory snap-ins and GUI tools you can ...

How Can I Eliminate Duplicate Names in a Text File?

(image) Hey, Scripting Guy! I have a text file that contains a bunch of names. How can I read through that text file and eliminate all the duplicate names?-- MW(image) (image) (image) Hey, MW. We’re assuming you have a text file that looks something like this:Ken Myer Dean Tsaltas Jonathan Haas Ken Myer Dean Tsaltas Syed Abbas Gail ...

Hey, Scripting Guy! How Can I Bind to a User Account Using Something Other Than the CN Attribute?

(image) Hey, Scripting Guy! Can I bind to an Active Directory account using the user’s mailNickname or their sAMAccoutName, something other than the CN?-- MB (image) (image) Hey, MB. When you bind to an account in Active Directory, you need to pass GetObject the account’s ADsPath. That means you need to use a line of code similar...

How Can I Insert a Column into a Spreadsheet?

(image) Hey, Scripting Guy! How can I insert a column into an Excel spreadsheet?-- HE(image) (image) (image) Hey, HE. Let’s assume you have a spreadsheet that looks something like this:(image) And, yes, it is a very nice little spreadsheet, except for one problem. As you can see, we goofed, and we forgot to insert Dataset 3; instead, ...