Change is in the air

Petri_162x87If you have read my blog for any length of time, or followed me, then you know that I have contributed a lot of content to a number of online resources over the years, often on a recurring basis. You may not realize it, but spreading out my workload over several sites can be quite demanding. After a lot of deliberation, I’ve decided to consolidate all of my online writing efforts with the Petri IT Knowledgebase.

The Petri IT Knowledgebase has been around since 1999 and has always been a source of high quality content for IT Pros.  For the longest time it had a domain name. But now you can find it at I will be publishing all of my online content exclusively at Petri where I will be a contributing editor. The site is being re-launched, lots of exciting things are in the works and I’m looking forward to being a part of it. At Petri, I will be primarily responsible for PowerShell related content. But you can expect to see me write about Active Directory, Group Policy, WMI, Hyper-V and Windows Server 2012 (and later).

I will still be blogging here and I will continue to create courses at Pluralsight. You will still find me at conferences like TechEd (or whatever it gets renamed) and the PowerShell Summit. I’ll still be doing PowerShell-related consulting and training on my own as well. Naturally, all of my existing content “in the wild” will remain where it is.

In most regards, nothing really changes other than the fact that you only have one place to check for my latest work. I hope you’ll come along for a great ride.

The Altaro PowerShell Hyper-V Cookbook

powershell-cookbook-ebook1 For awhile now I’ve been contributing to the Altaro Hyper-V blog. Many of my articles centered on managing Hyper-V with PowerShell. I’ve gone through my library of management tools and written an eBook around them. All of the PowerShell scripts and functions have been polished up a bit. The eBook briefly discusses how to you use each recipe. It is a cookbook after all.

All of the recipes have been tested, but even so you should test everything in a non-production environment. Every Hyper-V environment has its own quirks. Or you can use the recipes as jumping-off points for your own PowerShell and Hyper-V. When you download the eBook be sure to get the accompanying zip file of code samples.

Visit to learn more and download your free copy. I hope you’ll let me know what you think

Friday Fun: Pick Up Milk

sticky-graphic Sometimes when working on a PowerShell problem, you might have to come to the conclusion that PowerShell is not the right tool for the job. There are some tasks or applications that simply don’t lend themselves to automation or PowerShell. This isn’t necessarily a limitation in PowerShell, nor would I say it is a deficiency in the application at hand. It is just the nature of IT.

That said, there may be situations where you still want to use PowerShell, even if the experience is less than optimal. So let’s have some fun with this today. For a number of versions of Windows client’s there has been a little utility called Sticky Notes.

This is an electronic version of Post-It Notes. Wouldn’t it be nice to be able to use PowerShell to take advantage of the utility? Sadly, this application is written in such a way that nothing is exposed that can be automated, either through COM or .NET. So we’re left with a drastic measure of sending keys to the application.

As in the days of VBScript, sending keys is a risky proposition because you can’t always guarantee that the application in question will have focus. But let’s try. First, we need to start the program simply by invoking the command stikynot.

To send keys I’m going to use the .NET Framework. So to be on the safe side, I’m going to add some necessary assemblies just in case. It won’t matter if they are already loaded.

Now to activate the window. You can do this by the window title.

Or the process ID. I’ll use the title.

While the window has focus, I can send keys to it.

And that’s all there is to it! Sticky Notes have a number of keyboard shortcuts you can send using this technique. I found a page at that listed many of them.

But you know I’m not going to stop here. I built a module called StickyNotes.

The module includes several functions for creating, adding, setting and removing sticky notes. The tricky part was getting the timing right. You might need to adjust some sleep values, or be prepared to re-run a command. I would not build any mission critical processes around anything that uses send keys techniques as it isn’t reliable. But it sure is fun!

You might even use it like this:

At the end of the command, a sticky note pops up letting you know the deed is done. You might see an error about a missing process, but you can ignore it. Or maybe you simply need a reminder to pickup that loaf of bread or your child on the way home.

Sometimes PowerShell isn’t the best tool for the job, but I think it can always be fun. Let me know what you think of my little project.

Have a great weekend.

Advice, solutions, tips and more for the lonely Windows administrator with too much to do and not enough time.

%d bloggers like this: