Scripting Blog [archived]

Formerly known as the "Hey, Scripting Guy!" blog

Hey, Scripting Guy! How Can I Use the Windows PowerShell Equivalent of the VBScript While…Wend Loop?

(image) Hey, Scripting Guy! I have been using VBScript for a long time. One of my favorite language statements in VBScript is the While…Wend loop. It is easy to use and easy to understand. Is there an equivalent command in Windows PowerShell?- HS(image) (image) Hi HS, WE never did use the While…Wend loop very much. WE generally used ...

Hey, Scripting Guy! How Can I Write and Run a Windows PowerShell Script?

(image) Hey, Scripting Guy! I appreciate the command-line stuff you are showing, but to be honest, I am not interested in returning to the DOS days to administer my network. I am not a UNIX administrator-I am a Windows guy. If I wanted to do UNIX kinds of things, I would download the latest *nix distro, obtain a silly haircut, grow facial ...

Hey, Scripting Guy! How Can I Work with Directories, Files, and Folders by Using Windows PowerShell?

(image) Hey, Scripting Guy! This may not sound too exciting, but I do a lot of work with files and folders. I constantly have to create folders and files, move files, and move folders. This was easy to do by using VBScript, but nevertheless it always required at least six lines of code to do anything. Is it possible to simplify this process ...

Hey, Scripting Guy! How Can I Identify and Delete an Instance of a Process?

(image) Hey, Scripting Guy! I want to do a query for a process, and if the process is running, I want to delete that process. I know I could write a script by using WMI, but is there something native to Windows PowerShell that I can use to find and to delete the process? Next question: what if there is more than one process I have to delete...

Hey, Scripting Guy! Windows PowerShell and Pipelining

(image) Hey, Scripting Guy! I have seen you refer to this term pipeline many times since you started writing Windows PowerShell articles. What is up with that? Why don't you just store things in a variable and then walk through the contents of the variable when you are working with Windows PowerShell? This is the way that we did it in ...