IT Forum Day One: Windows Vista and Windows PowerShell

Today is Day 1 of the IT Forum conference in Barcelona, Spain. One of the big announcements in Bob Muglia's keynote this morning was the release of Windows PowerShell 1.0 today as a free download.

Windows PowerShell is Microsoft's new command-line shell and scripting language designed specifically to improve the manageability of Windows and products running on Windows such as Exchange Server 2007. If you haven't heard of Windows PowerShell before, think of it as an integrated version of the Windows Command Prompt (cmd.exe) and VBScript that is easy to use and will allow you to automate and control system administration tasks.

I asked the PowerShell team to put together some examples that show how PowerShell makes it easy for IT Pros to manage Windows Vista. Wow! I had no idea that PowerShell was this awesome. I think you will find that PowerShell will really jumpstart the productivity of a lot of IT pros as well power users who like to tweak their systems. To try any of the following tasks, you simply need to install Windows PowerShell on your Vista computer.

12 Cool Features of Windows PowerShell
By David Aiken, PowerShell Architect Evangelist and Jeffrey Snover, Windows PowerShell Architect. David Aiken has also recorded a video of these examples that you can view online on his Channel 9 DFO Show.

1. Built-in Cmdlets (pronounced "commandlets") for Managing Windows
All Cmdlets in Windows PowerShell follow a verb-noun syntax such as get-service, get-process, stop-service, get-wmiobject. Type get-command at the prompt to see the over 130 cmdlets provided by Windows PowerShell.

To get all services, type:

PS> get-service

2. The power of wildcards and working objects.
To get all services that start with "w" and then also get all dependent services associated with these services, simply type:

PS> get-service w* | format-list DisplayName, DependentServices

3. Whatif you could test your commands before committing to them.
Windows PowerShell has a unique feature called Whatif that will tell you the result of the command without executing the command.

The following command tells you which services starting with "w3" would be stopped. This utility is addictive once you start using it as it allows you to explore the features of PowerShell without causing any harm.

PS> stop-service w3* -whatif

Windows PowerShell Whatif

4. Take a transcript
PowerShell allows you to start and stop transcripts of all your commands. This makes it easy to test commands and simultaneously save them for use in a script.

PS> Start-Transcript -Path c:\demo\dfoshow.txt
PS> Stop-Transcript

5. Make Windows talk from the command line.
Because Windows PowerShell is optimized to work with objects it is easy to access COM objects as well as the .NET framework from the command line.  The commands below tell your Vista machine to pronounce the words "Windows Vista and PowerShell".  Substitute your favorite phrase. Talk about easy command line access.

PS> $spVoice = new-object -com "SAPI.spvoice"
PS> $spVoice.Speak("Windows Vista and PowerShell")

6. Using Windows PowerShell to access applications such as Windows Media Player 11.
The following commands - which can easily be put in a script - will play a song by the band The Posies in Windows Media Player. This is a trivial example (see ScriptCenter for more WM11 examples) but demonstrates how Windows PowerShell provides comprehensive command line access to applications.

PS> $band = "The Posies"
PS> $player = New-object -com wmplayer.ocx
PS> $playlist = $player.mediacollection.getbyauthor($band)
PS> $player.openPlayer($playlist.item(0).sourceurl)

7. Windows PowerShell as a command line storage calculator
PowerShell allows you to complete basic calculations from the command line.

PS> 2*2

But PowerShell will also allow you to quickly solve storage problems. For instance, how many 700MB cds are needed to backup 11GB?

PS> 11gb/700mb

Or, how many terabytes (1000 GB) of storage is needed to backup 425 Vista desktops with 320gb storage each?

PS > (320gb*425)/1000GB

8. Using PowerShell as a calendar calculator
To find out how many days until the New Year, simply type:

PS> ([DateTime]"1/1/2007" -[datetime]::now).days

Using PowerShell as a calendar calculator
Using Windows PowerShell to manage Windows Vista: Files, WinSAT, UAC, and Bitlocker
If you are an IT Professional and you are evaluating new Windows Vista functionality, you should also evaluate Windows PowerShell. Here are some examples to get you started.

9. How many files of type X do I have on my machine?
Windows Vista has many new file types for event logs, group policy files, etc.  .PS1 is the extension for Windows PowerShell scripts. Here is a command that will return the number of VBScript files, Bat files and PowerShell Scripts in a directory and its subdirectories.

PS> dir -include *.vbs, *.ps1, *.bat -recurse | group-object extension -noelement

10. Collecting Windows System Assessment Tool data from the command line.
The Windows System Assessment Tool (WSAT) provides numeric ratings (1= bad, 5=good) of system performance for processor, disk, graphics, etc so you can get a summary and potential solutions for improving performance. Because this data is stored in WMI, Windows PowerShell can programmatically collect this data from multiple computers and allow you to quickly evaluate the health of a set of machines without having to log in to each one. Here is a command to get WSAT data from a single Vista machine and format it in a nice, auto-sized table for viewing. Also an example of a PowerGadgets chart.

PS> get-wmiobject win32_winsat | format-table __SERVER, *SCORE -autosize
PS> get-wmiobject win32_winsat | select *score | out-chart -Title "System Assessment Scores by PowerGadgets"

Collecting Windows System Assessment Tool data from the command line

11. Configuring User Account Control
Windows Vista's User Account Control (UAC) helps improve security by requiring that all programs run in standard user mode by default, rather than with administrator privileges. Some IT pros have asked if they can temporarily disable the prompts if they need to do a sequence of administrative tasks in a row. The following example can be used to temporarily disable the UAC prompt, and easily turn it back on. A value of 0 will turn off the Prompt Behavior of UAC on Vista. With a Value of 2, the UAC prompt will be turned back on.

PS> set-itemproperty -path HKLM:\SOFTWARE\MICROSOFT\WINDOWS\CurrentVersion\Policies\System -name ConsentPromptBehaviorAdmin -value 0

12. Managing BitLocker with PowerShell
Vista's BitLocker feature helps prevents data loss via encryption. A thief who attempts to use another operating system or run a software hacking tool is prevented from overriding Windows Vista file and system protections or performing offline viewing of the files stored on the protected drive if BitLocker is installed. Here is how you can view, disable and enable BitLocker features from the Windows PowerShell prompt. (For this example, Windows BitLocker needs to be enabled on the c: drive.)

PS > $drives = get-wmiobject -namespace root\CIMv2\Security\MicrosoftVolumeEncryption -class Win32_EncryptableVolume
PS> $drives | format-table DriveLetter, PersistentVolumeID -autosize
PS> $BitLockDrive = $drives[0]
PS> $BitLockDrive.GetProtectionStatus()
PS> $BitLockDrive.DisableKeyProtectors()
PS> $BitLockDrive.EnableKeyProtectors()

One customer already using PowerShell is MySpace. It's been so useful for them that they are already using Windows PowerShell in their production environment to manage thousands of Windows Servers. Ad-hoc system administration tasks that used to take MySpace 10 minutes now take them only seconds.

A number of Microsoft partners have also provided Windows PowerShell-based tools designed specifically for Windows Vista. FullArmor announced Windows PowerShell cmdlets that improve the manageability of Group Policy on Vista. /n Software announced a beta of their free PowerShell-based network management tools. And PowerGadgets has built amazing charting and gauge utilities including gadgets that easily integrate with the Windows Vista Sidebar. These gadgets allow Windows Vista users and application developers to easily visualize system or application data - such as sales numbers or website performance -- and other line-of-business relevant data visualization needs.

This was a long post, but we were only able to scratch the surface of what PowerShell can do. For more comprehensive info see www.microsoft.com/powershell, the PowerShell team blog and the TechNet PowerShell ScriptCenter.


Comments

  1. Posted on: November 14, 2006 at 11:27AM  

    The download links don't appear to be working for XP yet, but the direct URL for the downloads is at:

    http://support.microsoft.com/kb/926139

  2. Posted on: November 14, 2006 at 2:13PM  

    Is this release gonna work on Vista?

    I see no Vista version on the downloads page :(

  3. Posted on: November 14, 2006 at 2:51PM  

    Its a pity that its not 1.0 but RC2 and most of the download links don't actually work.

  4. Posted on: November 14, 2006 at 3:13PM  

    FYI, Windows6.0-KB923569-x86.msu which is PowerShell RC2 for Vista build 5600 does not work on Vista build 5840 or 6000.

  5. Posted on: November 15, 2006 at 8:38AM  

    Apperently PW version "Windows6.0-KB923569-x86" does not seem to work on Vista RC2 build 5744.

    This is a pity because I was willing to try this at IT Forum after attending all the great sessions about PS. Is there an other version available ?

  6. Posted on: November 15, 2006 at 1:25PM  

    Cool, congrats!

    But still text mode, and still not Unicode :-(

    Well, maybe in 2020 :-(

  7. Posted on: November 15, 2006 at 1:31PM  

    Correction: Unicode is there, but since in text mode fonts are limited, you can only see question marks or squares :-(

  8. Posted on: November 15, 2006 at 6:27PM  

    Hey,

    Sorry about the confusion over Windows PowerShell RTM availability for Vista RTM. We will be releasing a version for Windows Vista RTM by the end Jan.  Currently we only have PowerShell RC2 available for Windows Vista RC1 (5600). Final PowerShell testing on Vista could not start until Nov 8th until we had Vista RTM code . So the team is aggressively testing it now but this requires us to take a lot of time to ensure that it has the same quality as RTM for Windows Server 2003 and Windows XP.  We will have by January 31st, 2007, at the latest, but we are working very hard to deliver it sooner.  To download Windows PowerShell, go to www.microsoft.com/powershell/download.

    You can read more about this and be notified of the release of PowerShell RTM for Vista RTM at http://blogs.msdn.com/powershell.

    Thanks for supporting PowerShell.

    Scott Ottaway [MSFT]

  9. Posted on: November 17, 2006 at 12:30PM  

    The Powershell is excellent, but too difficult for the average Joe enthusiast who needs to automate stuff in Windows or needs more accessibility. MS should develop an easy to use GUI-based automation tool (take a look at www.finalbuilder.com). Their Automise tool is exactly what novice users need.

  10. tfl
    Posted on: November 30, 2006 at 1:36PM  

    We can hack powershell support for Vista, and get it up and working in under 10 minutes - I can not belive it will take Microsoft (with 10,000 programmers as its disposal) another 2 months to get this out.

    I am now self-hosting on Vista and want PowerShell RTM. Maybe someone just needs to spend half an hour using WIX to build an MSI for this. It's NOT rocket science, surely.

  • Page:
  • 1
  • 2

Trackbacks

  1. Posted by: Windows PowerShell on November 14, 2006 at 9:54AM

    I thought you might enjoy my blog entry on the Windows Vista blog. Those guys have a much cooler background

  2. Posted by: The Official SBS Blog on November 14, 2006 at 11:33AM

    As those of you who have been preparing for Exchange Server 2007 know, Windows PowerShell (aka Monad)

  3. Posted by: Clive Watson's Weblog on November 14, 2006 at 1:18PM

    So Windows PowerShell v1.0 was declared RTM today and made available for download, the PowerShell blog,

  4. Posted by: Full of I.T. on November 14, 2006 at 1:27PM

    Check out this post on the Windows Vista Team blog . FYI - I'm doing a webcast this coming Friday on

  5. Posted by: TenBrink Tech on November 14, 2006 at 1:50PM

    Everyone's favorite new management shell, Windows PowerShell went final today at IT Forum | Tech-Ed 06....

  6. Posted by: Mohammed Jeelani's Blog on November 14, 2006 at 2:20PM

    As you probably know Windows Powershell has RTWed ! You can find the download links and more information

  7. Posted by: Craig Nicholson on November 14, 2006 at 3:02PM

    Windows PowerShell 1.0 (known previously as project Monad) has been released to the web today. Well thats

  8. Posted by: Research and Development Log on November 14, 2006 at 9:04PM

    Microsoft PowerShell 1.0 is released today. Powershell is the commandline and scripting language. Additional information can be found at Microsoft Windows Vista blog

  9. Posted by: Microsoft Higher Education Tech on November 15, 2006 at 4:12PM

    Windows PowerShell (our new command line scripting and administration too) officially RTW’d today. If

  10. Posted by: とーめいの不透明な話 on November 16, 2006 at 8:16AM

    一般の人にはまず縁のないのが「スクリプト言語」、かな。

    まあ、自分でホームページ作ったりする人は、JavaScriptとかPerlなんかは使ったことがあるかもしれない。 例によってCNET JAPAN によればマイクロソフトが「Windows Power Shell」なるものを発表したらしい。

    既にダウンロードして使用することもできるようだが、僕は普段はMacな人なのですぐに試してみるわけにもいかない。 リンク先のブログによれば、従来のコマンドラインやWSHの強化版らしく、コマンドラインでアプリケーションにアクセスできたりとか、

  11. Posted by: Tecnologia y estrategia en español on November 16, 2006 at 8:48PM

    Finalmente un Shell en Windows Una de las grandes ausencias que hemos tenido en el mundo Windows por

  12. Posted by: OpsanBlog on November 16, 2006 at 9:53PM
  13. Posted by: OpsanBlog on November 17, 2006 at 4:18AM
  14. Posted by: Windows Server Division WebLog on November 17, 2006 at 12:26PM

    Last Tuesday in front of over 4000 attendees, Jeffrey Snover and Bob Muglia announced the release of

  15. Posted by: [MSFT-BE] Arlindo's Blog - IT Pro Evangelist on November 20, 2006 at 3:40PM

    I know most of you already know that we Released To Web (RTW) Windows Powershell 1.0 for Windows XP SP2

  16. Posted by: Niall Merrigan's Blog on February 21, 2007 at 5:09AM
  17. Posted by: TrackBack on June 14, 2007 at 1:44AM
  18. Posted by: Lipitor. on July 21, 2008 at 12:41PM

    Lipitor anxiety. Generic lipitor. Lipitor when genaric. Side effects of lipitor drugs. Lipitor and alcohol. Side effects of generic lipitor. Lipitor.

  19. Posted by: Windows Server team Blog on October 13, 2008 at 8:18PM

    Last Tuesday in front of over 4000 attendees, Jeffrey Snover and Bob Muglia announced the release of