Scripting Blog

A place to learn about PowerShell and share stories of automation

How Can I Add Two Blank Lines Between Each Line in a Text File?

Hey, Scripting Guy! Hey, Scripting Guy! How can I add two blank lines between each line in a text file?-- LW Hey, LW. You know, when we wrote the Microsoft Windows 2000 Scripting Guide we included 4 or 5 examples of how you might work with text files. And then we thought to ourselves, “Well, we’ve pretty much exhausted all the things ...

Why Does My Performance Monitoring Script Keep Returning the Same Incorrect Values?

Hey, Scripting Guy! I’m using a script to monitor process performance, but every time I run the script the percent processor time for all the processes comes out as 0. What am I doing wrong?-- JL Hey, JL. We’ve simplified your script a bit to better illustrate the problem you’re running into. (And don’t feel bad: this is a very ...

How Can I Pass Command-Line Variables to an HTA When It Starts?

Hey, Scripting Guy! How can I pass command-line variables to an HTA when it starts?-- DM Hey, DM. Ok, we admit it: you almost had us on this one. (Not that being able to stump the Scripting Guys is particularly hard, mind you.) We had no idea whether you could pass command-line variables to an HTA, and even less idea how we could capture ...

How Can I Tell Whether a Group Member is a User, a Computer, or Another Group?

Hey, Scripting Guy! How can I tell whether the member of a group is a user, a computer, or another group?-- ON Hey, ON. Interesting question and - to tell you the truth - one we’d never really thought about. It’s easy enough to list all the members of a group; for example, here’s a script that reports back all the members of the ...

How Can I Determine the Version Number of a File?

Hey, Scripting Guy! How can I extract version information for a DLL or other type of file?-- DM Hey, DM. There at least two ways we know of to retrieve the version information for a file: one designed for working on the local computer and one that can work either locally or remotely. Being the kind of guys that we are, we’ll show you both...

Feedback usabilla icon