Test Registry Item Revisited

I got some nice feedback on my original Test-RegistryItem function. I had been mulling some enhancements anyway and now have a more robust version that looks at individual values, accepts pipelined input and more The new version now lets you test if a given registry item exists as well as if the value meets some target value. First, here’s the new version, with comment help removed.

The new version writes a custom object to the pipeline which provides more information. Let me walk through an example of the new version.

I want to see if the AutoAdminLogon item has a value of 1. The original part of the function that verifies the path is unchanged. But now if you specify a target value, the function checks to see if the current value matches the actual value.

A variable is defined to indicate if the values match. I also define $Exists since the item was found. After checking for the property value, the function creates a custom object with a few baseline properties.

If I hadn’t been checking a specific property value, this object would have been written to the pipeline. But because I wanted to confirm a target value, a few additional properties are added to the object.

I end up with a custom object like this.

The function also takes pipelined input so I can quickly check to see what keys might be missing. And because I’m now writing an object to the pipeline I can easily filter my results.

I hope you’ll download the new version and let me know what you think. Oh..and that CSV file referenced in the last example? I’ve got that goody saved for another day.

Download Test-RegistryItem v2.0 here.

Test Registry Item

I’ve been doing some work lately involving the registry and Windows PowerShell. One of the tasks was to create new registry keys and entries. But because I wanted to some robustness, I wanted a way to verify if a given key or entry already existed. Continue reading “Test Registry Item”

TechMentor Orlando 2010 Decks and Demos

I had a great time in Orlando at the TechMentor conference. The crowd was enthusiastic and asked good questions. As promised, here are my slide decks and demos. My sessions tend to be heavy on demonstration so I can’t promise you’ll get a ton of value from the decks alone.  You’ll simply have to attend the next TechMentor.

Scripting, Error Handling and Debugging in Windows PowerShell

Top Ten Command Line Tools Every Administrator Should Know

Take Back Your File Server (slides only as demos were live)

I owe the attendees of my error handling and debugging session some additional information since I ran short of time. Stay tuned for future posts on debugging PowerShell 2.0.  Cool stuff.

If you were in one of my sessions and have a follow up question, feel free to post a comment or email me directly: jhicks at jdhitsolutions.com.  Thanks for all your support and enthusiasm.


I think Out-Printer is a very handy cmdlet, and one that doesn’t get used much. Pipe any cmdlet to it and the output will be printed to your default printer. You use it the same way you would Out-File except output is printed instead of saved to a file. The cmdlet also has a parameter that lets you specify a  printer. This is very handy if, like me, you have a PDF printer installed. The challenge though is to remember the printer names. To that end I wrote a simple PowerShell script to query the registry and return some basic printer information.

Continue reading “Get-Printer”