Tag Archives: VBScript

PowerShell Messagebox

messageboxRecently I posted an article explaining how to create a popup box in PowerShell using the Wscript.Shell COM object from our VBScript days. That was something I presented at the PowerShell Summit. Another option is a MessageBox, again like we used to use in VBScript. This works very much like the popup except the user has to click a button to dismiss the box. I can’t think of a compelling reason why you would choose one technique over the other if you need the user to click something. But I’ll let you make that call. Here’s the function, New-Messagebox.

Most of the function is a wrapper around this line:

Like the popup function, I wanted to make it easier to create a messagebox without having to remember the names for buttons and icons so I use validation sets with my parameters. This makes it much easier to create a command like this in your script:

In the version I presented at the PowerShell Summit, the function did not write anything to the pipeline unless you used -Passthru. After thinking about it more, I realized the whole reason you are likely to use a MessageBox is to capture an interaction so I flipped the parameter and now it is -NoPassthru. Now, when the user clicks a button, the text value of that button is automatically written to the pipeline. If you include -NoPassthru you’ll get nothing. Here’s an example:


Because the messagebox writes text to the pipeline, it is a little easier to use than the Popup technique where you have to decode an integer value. In any event, you now have some options.

If you find this useful, I hope you’ll let me know.

Friday Fun – Snappy Shortcuts

In one of my recent Prof. PowerShell columns, I wrote about using the Wscript.Shell VBScript object in PowerShell to retrieve special folder paths. Another handy trick is the ability to create shortcut links to either file or web resources. Let me show you how to accomplish this in PowerShell and why you might want to. Continue reading Friday Fun – Snappy Shortcuts

This Old Script

I’m very slowly revising my main web site. The upshot for now is that there is no direct link to my old script library. Many of my Mr. Roboto tools can be found on this page. Until I can finish the upgrade project, you can use this link, http://www.jdhitsolutions.com/scripts.htm to take you directly to the old page.  Enjoy.

TechEd 2010 VBScript to PowerShell

Last week I posted my demo slides as well as my demo videos. As promised, I’ve gone through and expanded a bit on my original slide deck.  TechEdNA-2010-Hicks-ParadigmShift is a 3MB PDF of my expanded PowerPoint slide deck. If you have any questions about the content or what it takes to get your head from the world of VBScript to Windows PowerShell, please let me know.  I hope you find this useful. Enjoy.

Microsoft TechEd NOLA

Print I’m very excited about Microsoft TechEd next week in New Orleans, LA. I’ll be presenting Tuesday afternoon at 1:30PM. The official title is “Paradigm Shift: Microsoft Visual Basic Scripting Edition to Windows PowerShell”. In more practical terms, I’ll be talking about the necessary mind shift in moving from VBScript to PowerShell. I’ll talk about what you have to get your head around to successfully make the transition and provide some practical examples to demonstrate how you might make these changes. As with many of my talks, you can expect a lot of demos.

Other than that, I’ll be in the Windows Server booth (TLC/Red/WSV) throughout the week.

Monday, June 7 10:30 AM – 12:30 PM

Tuesday, June 8 10:30 AM – 12:30 PM, 2:45 PM – 5:00 PM

Wednesday, June 9 10:30 AM – 3:00 PM

Thursday, June 10 12:15 PM – 3:00 PM

I hope you’ll come by and at least say Hi. Or feel free to pick my brain.  If you have books you’d like signed, I’m happy to do that as well. I’ll be pretty active with FourSquare and Twitter if none of these times work for you.

See you next week.

Laissez les bon temps rouler!