Cat5bird Seat

Is There a PowerShell In Your Future?

If your goal as an admin is to become more efficient by automating more of your environment, the answer is yes.

If Windows PowerShell isn't on your systems administration radar yet, it should be. No, despite the unfortunate marketing influenced name, this is not some new multi-state lottery, the latest powered exoskeleton for our frontline troops or some crab-flavored sports drink. Rather, it's Microsoft's next-generation command-line shell and scripting environment, due to ship in the fourth quarter of 2006 and destined to replace or supplement everything from venerable batch files right up through WMI programming and one-off .NET console utilities. You can already download RC1 of PowerShell off the Windows Server System home page here, and between documentation, scripts, and newsgroups Microsoft is pushing out a lot of information to help you get started. If your job includes automating anything in the Windows environment, it's time to start up the learning curve.

The documentation prefers the term "glide path" to "learning curve," but make no mistake -- whether you come from a pure Windows background or a Unix shell background, you’ll have both moments of familiarity and moments of head-scratching here. While most things you already know from the Windows command prompt still work in PowerShell, the PowerShell team spent several years throwing in just about everything else they could think of. Here's a small and completely random assortment of what you’ll find when you start prowling around:

  • Enumerate Registry keys just like files on your hard drives
  • Create .NET objects from the command line
  • Interrogate .NET classes to find out what methods they support
  • Get command output as HTML tables
  • Set up tracing and debugging of PowerShell scripts
  • Perform arithmetic at the command line
  • Extend the shell by writing your own cmdlets in C#

Microsoft may not have thrown the kitchen sink into this shell, but I wouldn't bet on it; I’m not done exploring all of the nooks and crannies myself yet.

If systems administration is your business, you probably already have a toolkit you’ve built up for managing things. Likely it relies in whole or in part on the command line. Maybe you're a Windows shell expert, or maybe you rely on Cygwin or another port of a Unix shell. But you can’t really afford to ignore PowerShell, unless you’re planning to retire soon.

Microsoft has already announced that both Exchange Server 2007 and System Center Operations Manager 2007 will build their own management capabilities on top of PowerShell. It seems pretty clear that that’s just the start of a general use of PowerShell across all or most of Microsoft’s server products. So the camel’s nose is headed straight for your tent.

Fortunately, it seems likely that PowerShell will catch fire in the community, so there should be plenty of resources to help you learn how to leverage it. For example, Sapien (makers of PrimalScript), have already announced PowerShell support across their product line, and they’re publishing one of several books announced on the subject. A number of blogs have already popped up with helpful tips, even before the software is released, and newsgroup activity is starting to heat up. [Editor's note: Don Jones is the author of the new "PowerShell Answer," coming soon to MCPmag.com and at his ScriptingAnswers.com Web site.]

Still, with hundreds of commands and dozens of new concepts to learn, you shouldn’t treat this new software as a throwaway. Plan on spending some serious learning time with PowerShell, and then think about where you can apply it in your own operations. Fortunately, the backwards compatibility with existing scripting environments should make upgrading simple. Most sysadmins should be able to install PowerShell and start using it to run existing batch, command, and WMI jobs with almost no changes. Then, as you learn about new features, you’ll spot areas where you can make things more efficient or add new capabilities to your existing systems management tools. Or maybe you’ll find a way to automate some task that you’ve been doing by hand. Either way, by mixing new "sandbox" time with the routine work of doing your regular job under the new shell, you should be able to develop the skills that will keep you going through this revolution with minimal threat to the smooth running of your network. And who knows -- you might even come up with the killer script that makes you a company superstar!

Ready for PowerShell? Or are you going to stick with bash until they pry the emulator away from your cold, dead keyboard? Let me know at [email protected].

About the Author

Mike Gunderloy, MCSE, MCSD, MCDBA, is a former MCP columnist and the author of numerous development books.

comments powered by Disqus
Most   Popular