Last week, I posted a PowerShell function that you could use as an accelerator to create your own PowerShell tools. My tool takes command metadata from an existing PowerShell cmdlet and gives you the structure to create your own tool wrapped around what is in essence a proxy function. The advantage, besides saving a lot…
Tag: Scripting
Using Optimized Text Files in PowerShell
If you are like many IT Pros that I know, you often rely on text files in your PowerShell work. How many times have you used a text file of computernames with Get-Content and then piped to other PowerShell commands only to have errors. Text files are convenient, but often messy. Your text file might…
Friday Fun: Creating PowerShell Scripts with PowerShell
Sometimes PowerShell really does seem like magic. Especially when you can use it to handle complicated or tedious tasks, such as creating a PowerShell script. I know many an IT Pro who want to script but without having to actually write a script. Well, I’m not sure that is realistic, but you can get pretty…
Making the Shell Work for You Revisited
The other day, I posted an article about creating your own commands to simplify your life at the PowerShell prompt. Most of the time, creating your own wrapper function for an existing PowerShell command isn’t too difficult. Personally, this is the approach I usually take. But PowerShell is all about building blocks and as you…
PowerShell for the People: Making the shell work for you
Once you have some basic PowerShell experience I think you will begin looking for all sorts of ways to use PowerShell. Although one of the biggest obstacles for many IT Pros is the thought of having to type everything. Certainly, PowerShell has a number of features to mitigate this, often misperceived, burden such as tab…
Friday Fun: Read Me a Story
A few days ago, someone on Twitter humorously lamented the fact that I expected them to actually read a blog post. After the laughter subsided I thought, well why does he have to? Perhaps I can make it easier for him. Plus I needed something fun for today. So I put together a PowerShell function…
Tracking Your Day with PowerShell
Not too long ago, I received an email with a snippet of PowerShell code and a request for assistance. The code snippet used a little .NET code to retrieve the process for the currently active window. The goal was to have a PowerShell script run, keeping track of how long a given window was active….
Friday Fun Text to HTML
I love being able to create HTML documents from PowerShell commands. The Convertto-HTML cmdlet will happily turn any object into an HTML table using whatever properties you specify. Plus you can do all sorts of fancy things such as embedding a style sheet in the header, creating HTML fragments and inserting additional HTML elements. Today’s…
A Timely PowerShell Prompt
During the course of writing a few scripts that refresh a specific part of the console, such as the recent Read-Host alternative, I realized that flashing colors wasn’t always necessary. The fact that I could update the same space on the screen meant I could write the same content with minor changes and it would…
More Flashing Fun
I received a lot of interest in my Invoke-Flasher script. One comment I received on Twitter was for a way to use it interactively in a script. In essence, he wanted a flashing Read-Host so I took my original concept and tweaked it until I came up with a Read-Host alternative I simply call Read-Host2….
Look at Me!
Last week I posted some ideas on how to add notifications to your scripts. Those ideas were variations on the old school “Press any key to continue” prompt that I assume many of you are familiar with. Most of those concepts should work for you, but they assume you looking at the PowerShell window. I…
Press PowerShell Pause to Continue
Everyone once in a while I come across a PowerShell script that behaves like an old-fashioned batch file. Not that there’s anything wrong with that, but often these types of scripts put in a pause at the end of script so you can see that it finished. You might have seen a command like this…
Pimp your Prompt
If you are like me and live in PowerShell, then you spend a great deal of your day looking at your PowerShell prompt. That little indicator in the console and ISE that usually shows where you are. That little part of your PowerShell world is defined by a built-in function called Prompt. You can easily…
Friday Fun: A Random PowerShell Console
This week I thought we’d have a little fun with the PowerShell console and maybe pick up a few scripting techniques along the way. Today I have a function that changes the foreground and background colors of your PowerShell console to random values. But because you might want to go back to your original settings…
So you need to write a PowerShell script
So…you have decided to write a PowerShell script or have at least identified a need. What do you do first? If you say “Google or Bing”, I’d say you are wrong. In my opinion, when you are developing a PowerShell script, searching for an existing script is not the first step. Sure, you will likely…