Scripting Blog [archived]

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

Pausing a Windows PowerShell Script to Receive Keyboard Input

  Summary: Pausing execution of a Windows PowerShell script to receive keyboard input can be as simple as using the Read-Host cmdlet. But other methods are available.   (image) Hey, Scripting Guy! I would like to pause a Windows PowerShell script and wait for user input. When the user types a particular key on the keyboard, I would ...

Hey, Scripting Guy! How Can I Ensure That Users Submit Only Allowed Values for Script Parameters?

 (image) I have a script that I wrote for the help desk people. It is actually a pretty cool script because it lets the user of the script type in a WMI class name, and it connects to the remote computer and retrieves all the information from the particular WMI class that they typed. The problem is that some of the help desk people do not...

Hey, Scripting Guy! How Can I Verify Input Received from the Command Line?

 (image) I am the script writer at my company, and I have really been enjoying your articles on Windows PowerShell. I have begun the process of converting some of our old VBScripts to Windows PowerShell, and all of my new scripts are written in Windows PowerShell. Because I am the only one who writes scripts at my company (in fact, I am ...

Hey, Scripting Guy! Australian Dispatch #3: Self-Contained Underwater Breathing Apparatus

Cold. My nose is cold. My left eye opens slowly to investigate. Everything is dark. Cold and dark. "So why am I awake," I wonder seemingly to myself. No answers are forthcoming. So my right eye slowly opens to bring a modicum of assistance to the ongoing investigation. Still no answers present themselves. Where am I? What country am I in? "...