Welcome to IIS.net Sign in | Join
spacer
  • HOME
  • TechCENTER
  • DOWNLOADS
  • FORUMS
  • BLOGS
  • TEAM
  • IIS 7
Search
You are here: IIS » Blogs » BillS' IIS Blog

BillS' IIS Blog

PowerShell Rocks!

Posted Tuesday, November 14, 2006 7:47 PM by bills
Filed under PowerShell

 

PowerShell has official been released!  Download your copy today!

Of all the new Microsoft technology coming down the pipe, PowerShell has got to be one the most exciting (after IIS7 of course :) ).  You might wonder why am I so excited about the new scripting shell for Windows.  Even if PowerShell is better than Command Prompt on steroids, what does this have to do with my main passion, Web servers and Web applications?    Check out the Channel9 video I did with Jeffrey Snover, architect of PowerShell, to get an idea of how cool PowerShell really is.  In the video we show off a demo we put together for BobMu's keynote in TechEd IT Forum this week, which appears to have gone very, very well.  Well done, Jeffrey. :)

A long long long time ago, when I was in school and even after that, before I came to Microsoft and joined the IIS team, I used to use Linux and spent my days in BASH and ZSH getting work done.   Until now, we sadly never really had the productive power of an interactive shell on Windows.  So as previous heavy-user of shells, I have to tell you what I really like about this new shell interface on its own, then I’ll explain the many ways PowerShell can make work simpler for IIS Administrators.

Ok first off, in PowerShell you input commands on objects not text and PowerShell returns objects and not text, so you can easily pipe commands together in one line.  This allows me to input in just one line, complicated commands like this one,

PS C:\Windows\System32> Get-ChildItem -Path G:\ -Recurse -Include *.mp3 | Where-Object -FilterScript {($_.LastWriteTime -gt "2006-10-01") -and ($_.Name -match "pearl jam")}| Copy -Destination C:\User\bills\Desktop\New_PJ_MP3s

… which recursively looks through the entire my entire external hard drive (G:), collects all of the “Pearl Jam” mp3’s that were recently added and copies them into a folder on my desktop.  Never was I given a text output listing all the mp3’s and I didn’t have to use the Copy command over and over, I just piped the all the items to Copy once.

Another thing I like so much about PowerShell is how consistent PowerShell commands are.   In the example above, I only used one “Get-ChildItem” command but rest assured if I wanted to get anything else, the command for that would start with “Get.”  Similarly, if we want to stop a process or an application or anything, we always use the Stop command, not kill, not terminate, not halt, just stop.

Finally, I love that PowerShell is extensible.  I love this because it means my team can produce a whole set of IIS PowerShell cmdlets to help you manage IIS6, IIS7 and future versions of IIS.  You will also be able to submit your IIS PowerShell scriptlets to this community area (coming very soon J). 

Now that I’ve listed my favorite things about this new shell, I’d like to give you a few ways that PowerShell can and will make IIS administration simpler than ever before.  The top 5…

1.  IIS7 has a new WMI Provider for quickly starting, stopping, creating, removing and configuring sites and applications.  Now use PowerShell, to give a list of applications sorted by a particular configuration setting.  Then pipe apps with the particular setting into the tasks you were performing before with the WMI Provider.  Sergei wrote and just published a fantastic article on how to write PowerShell cmd-lets using our WMI provder, titled Writing PowerShell Command-lets for IIS7.

2.  Because IIS7 has a distributed file-based configuration store, you can store your application’s IIS configurations in a Web.config file in the application’s directory beside its code and content.  Use PowerShell to rapidly XCopy deploy the application to an entire Web farm in one step.

3.  IIS7’s new Web.Administration API allows Admins to write short programs in .NET to programmatically tackle frequent IIS7 management tasks.  Then, since PowerShell completely supports the .NET Framework, use it to pipe IIS objects in and out of these handy bits of code.

4.  With IIS7, you can use the new Runtime Status and Control API to monitor the performance of your Web applications.  Use PowerShell to monitor performance information at a regular interval of every 5 minutes, then have this valuable runtime information displayed to the console or sent to a log file whenever CPU is above 80%.

5.  Take advantage of IIS7’s extensibility by writing your own custom request processing module with its own configuration and IIS Manager plug-in.  Then write a PowerShell cmdlet to serve as a management interface to exposes your custom IIS configuration to the command line and to power your IIS Manager plug-in. 

I could probably list more ways but this post is getting long so I will leave you with links to other good IIS7/PowerShell resources.

· An Introduction to Windows PowerShell and IIS7

· Channel 9 Webcast of Jeffrey Snover and I demoing Powershell managing IIS7

· Windows Powershell on TechNet Script Center

· Windows Powershell Scripting Sweepstakes

· Powershell Team Blog

· Writing PowerShell Command-lets for IIS7

Comments: re: PowerShell Rocks!

Posted December 1, 2006 2:59 PM by TobinTitus

I've written two blog posts on how to use and extend the IIS managed SDK within PowerShell.

Check out:

Accessing Microsoft.Web.Administration through PowerShell (Part I)

blogs.iis.net/tobintitus/archive/2006/11/30/powershell-and-microsoft-web-administration.aspx

and

Extending Microsoft.Web.Administration through PowerShell (Part II)

blogs.iis.net/tobintitus/archive/2006/12/01/more-on-iis-7-administration-with-powershell.aspx

Comments: Managing IIS7 with Powershell, Big Hit at ITForum!

Posted December 11, 2006 4:52 PM by iis

On its own, IIS7 already has a great management story. The new Web server ships with a totally rewritten

New Comments to this post are disabled

About bills

Bill Staples is a long time web enthusiast currently working at Microsoft Corporation as the Product Unit Manager for the Internet Information Services (IIS) team. Bill began his involvement with the web community in the early nineties, developing with rudimentary CGI applications on Apache server and Linux. Over the past ten years he has worked on web technologies running on OS platforms from Solaris to Windows, using dynamic scripting technologies including Cold Fusion, PERL, ASP, and ASP.NET. For the past six years Bill has led the IIS team at Microsoft, including the IIS 5.1, 6.0 and 7.0 projects.

BillS' IIS Blog

  • Home
  • Email
  • Links
  • RSS feed

Search BillS' IIS Blog


Search

BillS' IIS Blog Archives

  • May 2007 (4)
  • April 2007 (5)
  • March 2007 (3)
  • January 2007 (3)
  • December 2006 (1)
  • November 2006 (4)
  • October 2006 (6)
  • September 2006 (5)
  • June 2006 (1)
  • May 2006 (2)

BillS' IIS Blog Tags

  • Administration
  • ASP.NET
  • Community
  • Compatibility
  • Developers
  • Extensibility
  • IIS News Item
  • IIS7
  • Misc
  • mix07
  • Performance
  • PHP
  • PowerShell
  • Samples & Demos
  • Samples & Demos
  • Troubleshooting
  • Videos
  • Windows Media Server

Copyright © 2006 Microsoft Corporation. All rights reserved. | Terms of use | Privacy statement
Questions / Problems with www.iis.net? | Interested in Advertising with us? | Hosted by OrcsWeb | Ads served by BanManPro

gipoco.com is neither affiliated with the authors of this page nor responsible for its contents. This is a safe-cache copy of the original web site.