PowerShell with a Purpose Blog

May 17, 2010
blog

Advanced Functions Part 2: ShouldProcess() in Your Script Cmdlets

Advanced functions' ability to behave almost exactly like a "real" cmdlet isn't limited to parameter binding. You can also take advantage of the common -verbose parameter. Simply output your verbose output this way:...More
May 14, 2010
blog

Advanced Functions Part 1: Cmdlets From Scripts

Have you ever wished you could write a "real" cmdlet without having to crank up Visual Studio and learn Visual Basic or C#? If so, then PowerShell's "advanced functions," or "script cmdlets," are just what you're looking for....More
May 13, 2010
blog

PowerShell Training Roundup 4

If you haven't started learning Windows PowerShell yet - crawl out from under that rock! PowerShell isn't going anywhere; the longer you wait, the more you'll have to learn all at once. Trust me, it's easier to pick this stuff up in increments. With that in mind, here are some of the current and forthcoming options by which you may choose to learn this fabulous administrative tool....More
May 12, 2010
blog

The Windows IT Pro PowerShell Page is Up!

Drop by www.windowsitpro.com/go/DonJonesPowerShell for consolidated access to my PowerShell blog, the Windows IT Pro PowerShell FAQ, and upcoming feature articles related to Windows PowerShell. I'm also lining up some guest articles from my fellow Windows PowerShell MVPs, and I've got a whole slew of scripts that folks submitted to ConcentratedTech.com for my review. I'll start posting those, along with some suggestions for improvement and color commentary on the scripters' technique. You're also welcome to submit your own scripts for a review, if you like - you'll find my address on the new PowerShell page on the left-hand side....More
May 11, 2010
blog

Pipeline Parameter Binding: ByPropertyName

In a previous article, I discussed pipeline binding ByValue; this time, I want to look at pipeline binding ByPropertyName. Let's start with the Get-Service cmdlet. If you look at the full help ("Help Get-Service -full"), you'll notice that several parameters accept pipeline input ByPropertyName, including -Name and -ComputerName. Let's play with those two....More
May 7, 2010
blog

Pipeline Parameter Binding: ByValue

One of the most flexible and powerful techniques you can learn in Windows PowerShell is pipeline parameter binding. With it, you can perform a number of extremely complex tasks simply by stringing together the right commands - rather than having to write a complicated script. Let's start by looking at the first of two pipeline parameter binding techniques: ByValue....More
May 3, 2010
blog

What makes a good PowerShell editor? 10

Windows PowerShell v2 ships with an "Integrated Scripting Environment," or ISE. It's actually intended to be a "graphical shell" (and was originally called that), and one of its driving features is support for double-byte character sets. That's right, the original text-based console can't handle double-byte character sets, which means a lot of people couldn't use the shell because it couldn't display their language....More
Apr 30, 2010
blog

PowerShell FAQ Now Online

Hover over "FAQs" in the site's main menu, or visit PowerShell FAQs for the new PowerShell-focused section of Windows IT Pro's Frequently Asked Questions. You're guaranteed to find a tip or two that you didn't know, and you'll find new FAQ's online two or three times a week....More
Apr 29, 2010
blog

PowerShell FAIL Worked Around (+Awesome Remoting Trick)

Last week, I posted about a problem I was having with Invoke-Command. In short, I was trying to pipe in an object that had a ComputerName property, expecting it to bind to Invoke-Command's -computerName parameter, thus invoking a command on multiple remote computers. It doesn't work. That's because Invoke-Command's -inputObject parameter binds all pipeline input objects first (it binds objects of type [object] ByValue), so no other parameters even get a shot. That's a bug of sorts in Invoke-Command; given how -inputObject is constructed, my understanding is that nothing should claim to bind pipeline input ByPropertyName (I've actually logged it on Microsoft Connect, which is a site you should become familiar with if you encounter what you think is a bug in an MS product). But here's the workaround:...More
Apr 26, 2010
blog

Here's a GREAT remote registry "cmdlet" 3

The Microsoft Scripting Guys' 2010 Scripting Games is in full swing, and I've been perusing the entries. One of my favorites so far is in the advanced division, and is designed to set a registry key on one or more remote computers. The author notes, however, that "I'm unhappy with this solution... IMO this script needs a -credential parameter, but I couldn't get alternate credentials working across platforms( xp,vista,w7)... So I settled on the .net alternative."...More
Apr 26, 2010
blog

Want to write an Advanced Function ("script cmdlet?") Here's how. 3

I'm off to speak at the Wisconsin IT Symposium this week, so I thought I'd offer a beefy article to tide you over. This isn't meant to be so much a USEFUL Advanced Function as it is an all-in-one demo of what Advanced Functions can look like...More
Apr 23, 2010
blog

MS launches PowerShell Visual Guide Thingy on Bing 1

Bing's "Visual Search" doohickey has a new friend: Windows PowerShell cmdlets. Basically, you get a page full of big, colorful boxes that each represent one of the core (e.g., built-in) PowerShell cmdlets. I am, however, having some difficulty in figuring the value of this kind of reference, but I'm promising myself to make use of this over the next few weeks and see if I start relying on it. What's your take? Is this a useful way to explore cmdlets and look up syntax? Will it help you find cmdlets that you might have otherwise overlooked?...More
Apr 20, 2010
blog

Deciphering my PowerShell FAIL... 3

So, I've been prepping some new materials for this training kit that I offer at conferences and classes I teach at, and I constructed a statement that I thought would be super-cool - and it super-failed. Here's how I went about deciphering my problem - or at least identifying what the problem is, if not the solution (yet)....More
Apr 19, 2010
blog

New Microsoft Official Curriculum for PowerShell v2 2

There's lots of PowerShell training options available, with more on the way - here's a rundown, including some secret info on a new course by Microsoft....More
Apr 19, 2010
blog

Welcome to PowerShell With A Purpose 1

When I was approached to begin blogging here on Windows IT Pro, the publishing team's first question to me was, "what will you write about?" PowerShell was an obvious answer, since I've been working with it since well before its launch; in fact, my MVP Award from Microsoft is in the PowerShell specialization. But what, specifically, would I write about PowerShell?...More
Apr 18, 2010
blog

PowerShell Tip: Querying Multiple Computers with WMI

I found myself having to grab a bunch of information from several servers today. They're all domain controllers, and I actually have several text files that list all of my servers holding various roles. There's a DomainControllers.txt file, a DNSServers.txt file, and so on. Each file includes one computer name per line, and it's just the computer names in there - nothing else....More
Apr 17, 2010
blog

Judging the 2010 Scripting Games

I'm honored to have been selected as a judge for the 2010 Scripting Games. In case you're not familiar with it, this is an annual event produced by Microsoft's Scripting Guys in the online TechNet Scripting Center. Thee are different divisions based on your expertise, and each division essentially consists of a series of tasks or puzzles that you have to solve using scripts. They allow both PowerShell and VBScript, and it's honestly quite a lot of fun. It's also a good way to hone your scripting and automation skills!...More
Apr 16, 2010
blog

Why PowerShell Isn't VBScript or KiXtart 4

For more than a decade (heck, close to two), Windows administrators relied upon scripting technologies to automate key tasks. Both KiXtart - part of the Windows 95 Resource Kit and earlier Windows Resource Kit editions - and Visual Basic Scripting Edition (VBScript to its fans) offered a simplified programming language that seemed purpose-built for administrative tasks....More
What's PowerShell with a Purpose Blog?

Don Jones demystifies Windows PowerShell.

Blog Archive

Sponsored Introduction Continue on to (or wait seconds) ×