Scripting Blog

A place to learn about PowerShell and share stories of automation

How Can I Add a Line to the Top of a Text File?

Hey, Scripting Guy! How can I add a line to the top of a text file?-- FT Hey, FT. You know, at one point in his career Sir Arthur Conan Doyle actually killed off Sherlock Holmes, figuring he’d written everything anyone could ever write about the master detective. Public outcry soon made him change his mind, and in short order he brought ...

How Can I Change the Background Color of a Cell Depending on the Date?

Hey, Scripting Guy! I have a Microsoft Excel spreadsheet I periodically analyze using a script. How can I change the color of a cell to red if the date stored in that cell has passed?-- DM Hey, DM. We were going to start today’s column off with some clever and witty remark about red-letter dates, but we couldn’t actually think of one. ...

How Can I List All the Attributes Used by the Computer Class in Active Directory?

Hey, Scripting Guy! How can I list all the attributes used by the Computer class in Active Directory?-- KP Hey, KP. Thanks for your question. In response, yes, it is true that the Kirkland Fire, the Colt League baseball team coached by one of the Scripting Guys, won the city championship this past weekend, nicely bookending the regular-...

How Can I Retrieve a List of OUs that have a Specific Word in Their Name?

Hey, Scripting Guy! We have a number of OUs in our domain that have the word Servers in the OU name. How can I retrieve a list of those OUs?-- AM Hey, AM. One of the Scripting Guys has a 15-year-old son who, whenever he hears his father tell a story about the good old days, rolls his eyes and says, “You’re just one of those old guys ...

How Can I Get the Actual Text of a List Box or Dropdown List Option?

Hey, Scripting Guy! In my HTA, how can I get the actual text of a list box or dropdown list option?-- MM Hey, MM. You might be familiar with an old Mac Davis song, a song that starts off like this:Oh Lord it's hard to be humble When you're perfect in every way Now, admittedly, the Scripting Guys aren’t perfect in every way. But - all ...

Feedback usabilla icon