Scripting Blog

A place to learn about PowerShell and share stories of automation

How Can I Open an Excel Workbook and Retrieve the Names of All the Worksheets?

Hey, Scripting Guy! How can I open an Excel workbook and retrieve the names of all the worksheets?-- JG Hey, JG. It’s the first day back after a three-day weekend, and this morning all the Scripting Guys stumbled into the office and just stared blankly into space. (All in all, pretty much business as usual.) Eventually one of us spoke up ...

How Can I Change the “Copy Music to This Location Folder” in Windows Media Player?

Hey, Scripting Guy! How can I change the Copy music to this location folder in Windows Media Player?-- BD Hey, BD. You know, a lot of people think that the reason we Scripting Guys don’t do very much work is because we’re just plain lazy. Those people are right. However, what we tell our bosses is this: it’s hard for us to do any work...

How Can I Get Just the User Name When Using the Win32_ComputerSystem Class?

  Hey, Scripting Guy! I’m using the Win32_ComputerSystem class to get the name of the logged-on user. The name comes back formatted like this: Domain\Name. How can I extract just the user name?-- KW Hey, KW. As our much-beloved and highly-respected editor reminded us the other day, instead of spending all our time telling people how ...

How Can I Extract Word Paragraphs That Use a Specific Style?

Hey, Scripting Guy! How can I save (to a separate file) all the paragraphs in a Word document that are formatted using a particular style, like Heading 1?-- RN Hey, RN. You know, when we first read this question we thought, “Interesting. But why would you ever want to do something like that?” And then one of the Scripting Guys ...

How Can I Use ADO to Open a Text File That has Spaces in the File Name?

Hey, Scripting Guy! How can I use ADO to open a text file that has spaces in the file name?-- TL Hey, TL. You might not even remember sending us this question; to say it’s been awhile would be an understatement. (You should have seen all the dust and cobwebs we had to brush off this question before we could post it in the Script Center.) ...

Feedback usabilla icon