Scripting Blog

A place to learn about PowerShell and share stories of automation

How Can I Determine the Drive Letter for the Drive My Script is Currently Running On?

Hey, Scripting Guy! I have a script that runs off a CD and copies a bunch of files to a computer. However, in order to copy the files I need to know the complete file path, including the drive letter. How can I determine the drive letter for the drive my script is currently running on?-- RKG Hey, RKG. You know, about a year or so ago one of...

How Can I Assign a New Home Drive to a User Who Doesn’t Have One?

  Hey, Scripting Guy! How can I check to see if a user has a home drive and home directory set and, if they don’t, assign them a new one?-- AM Hey, AM. No, no excuses: the Seahawks had plenty of opportunities to win the Super Bowl yesterday, but they failed to take advantage of it. At times it seemed like they were playing not to lose...

How Can I Search for Multiple File Extensions in a Single WQL Query?

Hey, Scripting Guy! How can I search for multiple file extensions in a single WQL query?-- AH Hey, AH. If we understand your question correctly, you want to know if it’s true that the Seattle Seahawks are playing in the Super Bowl this Sunday. Yes, it is true: our very own Seahawks will be taking on … well, some second-place team. This ...

How Can I Remove All the Formatting from an Excel Spreadsheet?

Hey, Scripting Guy! How can I remove all the formatting from an Excel spreadsheet?-- MT Hey, MT. You know, several years ago one of the Scripting Guys and his family went to the Blizzard Beach water park in Orlando. While there this Scripting Guy went down the Summit Plummet, reputed at the time to be the highest and fastest water slide in ...

How Can I Boldface a Specific Word Throughout a Microsoft Word Document?

Hey, Scripting Guy! How can I boldface a specific word throughout a Microsoft Word document?-- SB Hey, SB. You’ll probably find this hard to believe, but when you work with scripts and scripting all day you tend to get a little jaded. You say you have a script that automatically backs up and clears all the event logs on all your computers...