I was working on a project with an advanced PowerShell function. One of the goals was to take advantage of the common parameters like -ErrorVariable and -WarningVariable so that when you run the function you can save errors and warnings and work with them later. Turns out one of these works and one doesn’t. But…
Tag: Function
Start-TypedDemo
As you know, I do a lot of presenting and training. Normally I use the ubiquitous Start-Demo function to run through a demo list of commands. Most of this time this works just fine. But when I’m doing videos, especially for a video project, I want the viewer to focus on the command and not…
PowerShell ISE Convert All Aliases
Yesterday I posted an article on how to convert a selected word to an alias or cmdlet. While I think there is still some value in this piecemeal approach. sometimes you want to make wholesale changes, such as when troubleshooting a script that someone else wrote that is full of cryptic aliases. I have a…
PowerShell ISE Alias to Command
Earlier this week I posted a function that you could incorporate into the PowerShell ISE to convert selected text to upper or lower case. I was challenged to take this a step further and come up with a way to convert aliases to commands. Which is exactly what I did.
Friday Fun PowerShell Pep Talk
Today’s Friday Fun is meant to help get you excited about the upcoming Scripting Games. I want to add a little pep to your PowerShell prompt. Perhaps it will even keep you motivated. What I have for you today are variety of prompt functions. Consider them variations on a theme.
Get My Variables
As you might imagine I write a lot of PowerShell scripts and examples. Often my PowerShell Window is open for days at a time. One challenge I have always has is trying to remember what variables I have defined. If I knew the name I’d simply use Get-Variable. What I really want is a way…
Importing and Exporting Registry Items
A while ago I posted a function to export registry items to either a CSV or XML file. Recently I had a question on Twitter about importing, which I assumed meant from my exported file. The import is actually pretty easy as I’ll show you, although it did require a change to the original Export-Registry…
More WMI Dates – Win32Product InstallDate
I’ve written in the past about converting obtuse WMI datetime formats into more user friendly formats. The other day via Twitter I got a question about the InstallDate property that comes from the Win32_Product class. This property has a different format, than what I’ve written about previously. And while I think the format is easy…
Friday Fun – More Prompts
Not too long ago I offered up a tasting of PowerShell prompts 3 ways. My first offering were variations on displaying the current date and time. But a PowerShell prompt can do much more. For today’s Friday Fun I present a duo of of calculating prompts.
Export Registry
Over the last week or so I’ve posted some functions for testing whether a given registry item exists or not, or even validating its value. To round this out, today I have an advanced function that makes it easier to export parts of the registry on the local computer.
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…
Custom Prompts 3 Ways
Recently, a number of PowerShell MVPs were having a discussion about the transcript feature in Windows PowerShell. One comment that arose was a need to see how long tasks have run or otherwise provide some sort of date time information. One solution is to use a customized PowerShell prompt and provide the information yourself. 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.
New Event Report
For a number of years I wrote the popular Mr. Roboto column for REDMOND magazine. When I first started the column, many of my scripts were written in VBScript. Then as PowerShell came along that became the preferred tool. Over time I realized there were some VBScripts that could be rewritten and even improved using…