Scripting Blog

A place to learn about PowerShell and share stories of automation

How Can I Retrieve the Path to the Program Files Folder on a Computer?

Hey, Scripting Guy! How can I retrieve the path to the Program Files folder on a computer?-- CC Hey, CC. How can you retrieve the path to the Program Files folder on a computer? Well, to be honest, not as easily as we thought you could. If you’re trying to retrieve the Program Files path on the local computer, well, that’s easy; ...

How Can I Change the Footer in an Excel Spreadsheet?

Hey, Scripting Guy! How can I change the footer in an Excel spreadsheet?-- JA Hey, JA. Ah, a trick question, huh? As it turns out, there’s no such thing as the footer in Excel; instead, Excel has three different footers: the left footer, the center footer, and the right footer. And here’s a script that can change all three of them:Set ...

How Can I Get the “Grandparent” of an Object in Active Directory?

Hey, Scripting Guy! How can I get the “grandparent” of an object in Active Directory?-- JG Hey, JG. Wait a second: is this “grandparent” thing some sneaky reference to the fact that the Scripting Guys (well, except for Jean, of course) are all starting to show their age a bit? OK; we just wanted to make sure. (Editor’s Note: Yes, ...

How Can I Delete the C$ Share from a Computer?

Hey, Scripting Guy! How can I delete the C$ share from a computer?-- RB Hey, RB. One quick clarification here: we can tell you how to temporarily delete the C$ share from a computer. However, the share will automatically be recreated any time the Server service is stopped and then restarted, or any time the computer is rebooted. Why? That...

How Can I Create an HTA that Doesn’t Have a Close Button in the Title Bar?

Hey, Scripting Guy! How can I create an HTA that doesn’t have a Close button in the title bar?-- AK Hey, AK. You know, you’ve presented us with a great moral and ethical quandary. After all, suppose we answer this question: suddenly the world might be inundated with HTAs that couldn’t be closed. We have this vision of unclosable, ...