Here’s a technique you might want to use for ad hoc troubleshooting or reporting. Even though it is possible to set up scheduled tasks to run PowerShell commands or scripts, it is cumbersome and time consuming. PowerShell v3 offers a great alternative, but I’ll cover that another day. Suppose I want to do something every…
Category: PowerShell v2.0
Friday Fun – A PowerShell Console Menu
When working in PowerShell, and especially when scripting, you might want to give the user a choice of actions. For example, you might develop a configuration script that another admin or technician will run. Perhaps one of the steps is to configure networking depending on their location so you want to give the person running…
Thursday Treat – A PowerShell Word Find Game
Now for something completely different but hopefully a little fun. I’m a big fan of word games and puzzles. Tim Bolton has assembled a few PowerShell themed crosswords, which you can find on his blog. I’ve always like word finds so I put together a pretty simple one using 16 common PowerShell cmdlet names. You…
Background Performance Counters
Windows Powershell makes it relatively easy to collect performance counter information via the Get-Counter cmdlet. Because I’m assuming you want to collect more than a few seconds of performance information, you’ll need to take advantage of PowerShell background jobs if you want your prompt back. Of course, you can always open a second session, but…
Add WhatIf Support to Your PowerShell Scripts
In one of my recent articles for SMB IT, I included a PowerShell module. In the article I referenced that I included support for -Whatif in one of the functions. I was asked on Twitter to explain what I meant and how it works. So here goes.
Friday Fun – A Christmas Prompt
Over the last few weeks I’ve read about other people’s PowerShell prompts and offered a few suggestions of my own. This week’s Friday Fun creates colorful holiday prompt that counts down the number of days until Christmas.
Turning IPConfig DNSCache into PowerShell
Lately I’ve been writing about techniques to turn command line tools into PowerShell tools. Although I suppose the more accurate description is turning command line output into PowerShell pipelined output. The goal is to run a command line tool and write objects to the PowerShell pipeline so I can do other operations with them. Today…
Ping IP Range
Last week I came across a post on using PowerShell, or more specifically a .NET Framework class, to ping a range of computers in an IP subnet. The original post by Thomas Maurer is here. I added a comment. And after looking at this again I decided to take the ball and run with it…
Turning CLI Tools into PowerShell Tools Deep Dive Demos
Last week I did a presentation at the PowerShell Deep Dive in Frankfurt about turning command line tools into PowerShell tools. A video recording should be posted later. But in the meantime, here is a copy of my slide deck, in PDF and a zip file with my demos and scripts. I have some followup…
Scenes from the Powershell Deep Div…
Scenes from the Powershell Deep Dive in Frankfurt as part of The Experts Conference. This was posted on Google+…
Renaming Files with PowerShell
I am not a big fan of file names with spaces. I realize they are easy to read and obviously much more “natural”, but they are simply a royal pain to deal with, especially when working from a command prompt or PowerShell. So naturally the solution is to rename these files and replace the space…
Compress Files By Extension
I never seem to build my test virtual machines with enough disk space. Which means at some point I start dealing with space issues and resort to all sorts of hacks to buy myself a little time. One thing I do is look for files that I can compact using NTFS compression. For examples text…
Windows PowerShell Fundamentals Video Training
I’m very happy to report that my first training offering for Train Signal is now available. I have assembled a course that should cover just about everything you need to know to get started right away using Windows PowerShell. You can get the course online or on disk. If the disks are like other train signal courses,…
Select Object Properties with Values
Here’s another concept I know I’ve written about in the past but that needed an update. A common technique I use when exploring and discovering objects is to pipe the object to Select-Object specifying all properties, get-service spooler | select *. There’s nothing wrong with this approach but depending on the object I might get…
Friday Fun Export Transcript to Script
Over the years I’ve posted variations on this technique and discuss it often in my training classes. The idea is to take your PowerShell transcript and transform it into a PowerShell script. Remember that there is very little difference between running commands in the shell and in a script. Thus, any commands that have been…