InfoQ

News

Free PowerShell Book

Posted by Jonathan Allen on Jul 26, 2007 02:50 PM

Community
.NET
Topics
Artifacts & Tools
Tags
PowerShell

Frank Koch of Microsoft Switzerland has released a free mini-book on Windows PowerShell.

Windows PowerShell is a replacement for the DOS-based command prompt currently distributed with Windows. Inspired by the powerful shells found in Linux, PowerShell gives administrators full access to COM and .NET libraries from the command prompt.

One of the key topics covered by this book is piping. Unlike UNIX based shells, PowerShell doesn't pipe just text. Instead, it is based on the ability to pipe objects from one command to the next.

For example, consider this command.

get-wmiobject -class win32_computersystem | get-member | sort name

The first part gets the WMI object Win32.ComputerSystem.
In order to get a list of methods on the object, it is piped to the get-member command.
Finally, the list is piped to the sort command.

The concept of file systems and objects have been merged in PowerShell. This allows you to register an object model and explore it like a file system. Built-in "drives" include the Windows Registry, certificate stores, environmental variables, and aliases. There is even a "Variable" drive for working with shell variables. Just as in an actual drive, features such as Tab Completion work in these pseudo-drives.

Other interesting tricks found in this book include PowerShells support for numeric constants. Wherever numbers are allowed, one can write "512KB" and the shell will automatically convert into bytes. The suffix MB and GB are also supported.

You can download the book and sample code from the Scattered Notes blog. 


3 comments

Reply

I Love Powershell! by John DeHope Posted Jul 27, 2007 8:22 AM
Re: I Love Powershell! by Alex Popescu Posted Jul 29, 2007 3:20 AM
Re: I Love Powershell! by berkay NiQuiL Posted Jun 30, 2008 3:03 PM
  1. Back to top

    I Love Powershell!

    Jul 27, 2007 8:22 AM by John DeHope

    Thanks for this link. A friend of mine turned me on to powershell recently and I must say MS has really outdone themselves with this one. Now if I could just get my company to let me install it!

  2. Back to top

    Re: I Love Powershell!

    Jul 29, 2007 3:20 AM by Alex Popescu

    What were the features that sold you out to PowerShell? (I had it on my todo list for quite a while and never got to it...) ./alex -- .w( the_mindstorm )p. ________________________ Alexandru Popescu Senior Software Eng. InfoQ TechLead&CoFounder

  3. Back to top

    Re: I Love Powershell!

    Jun 30, 2008 3:03 PM by berkay NiQuiL

Exclusive Content

Rationalizing the Presentation Tier

Thin client paradigm characterized by web applications is a kludge that needs to be repudiated. Old compromises are no longer needed and it's time to move the presentation tier to where it belongs.

Agile Project Management: Lessons Learned at Google

In this presentation filmed during QCon 2007, Jeff Sutherland, the creator of Scrum, talks about his visit at Google to do an analysis of Google's first implementation of Scrum.

AtomServer – The Power of Publishing for Data Distribution

In this article, Bryon Jacob and Chris Berry introduce AtomServer, their implementation of a full-fledged Atom Store based on Apache Abdera, which is now available as open source.

An Introduction to Virtualization

It is easy to think that virtualization applies only to servers. In reality the recent resurgence of the concept is also being applied to networking, storage, and application infrastructure.

REST Anti-Patterns

In this article, Stefan Tilkov explains some of the most common anti-patterns found in applications that claim to follow a "RESTful" design and suggests ways to avoid them.

Choosing between Routing and Orchestration in an ESB

In this article, Adrien Louis and Marc Dutoo discuss the differences and relative merits of using orchestration vs. routing in a typical ESB setup, and discuss various implementation options.

Enterprise Batch Processing with Spring

Wayne Lund discusses batch processing, Spring Batch objectives and features, scenarios for usage, Spring Batch architecture, scaling, example code, failures and retrying, and the future roadmap.

User Story Estimation Techniques

Developer Jay Fields draws on his experiences as a ThoughtWorks consultant to describe effective user story estimation techniques.