## Another Holiday Gift from the PowerShell Team: PowerShell 3.0 CTP2 – Getting Started with Windows PowerShell Workflow

After delivering the Thanksgiving Gift this year, it’s time for a Holiday Gift …. No not as big as the one we had about 3 years ago …!! Today, we published the “Getting Started with Windows PowerShell Workflow” document on the CTP2 download page, just look for “WMF3 CTP2 Windows PowerShell Workflow.pdf”. This will help… Read more

## Do PowerShell Demos in the ISE

Jeffry Snover and many other have used Start-Demo in powershell.exehttp://blogs.msdn.com/powershell/archive/2007/03/03/start-demo-help-doing-demos-using-powershell.aspx Continuing the tradition, we now have ISEDemo.psm1 To use it, start ISE and runImport-Module ISEDemo.psm1 #(attached)Start-Demo c:\path\to\demofile.txt Type enter to execute the command once its finished typing You can escape to clear and type some other command To get the next command again, execute a… Read more

## V2 Quick Tip: Monitoring Performance Counters with PowerShell

I just got a ping on our internal discussion list about how to get at the Performance counters in PowerShell.  In V2, we’ve got some nifty cmdlets to help read performance counters. Here are a few of quick one liners to get you started: # List all of the performance counters you can monitor Get-Counter… Read more

## Differences between the ISE and PowerShell console

Here is a collection of differences between the PowerShell_ise.exe and PowerShell.exe, as well as workaroundsand suggestion if you need them (assuming we have them :)) Limited support for interactive console apps, try cmd.exe, then try cmd.exe /k cmd.exe /c dir still works though, and more information is available herehttp://blogs.msdn.com/powershell/archive/2009/02/04/console-application-non-support-in-the-ise.aspx Console Application output is not colorful… Read more

## Image Manipulation in PowerShell

The other week, I showed a Get-ProgID function that I used to help someone at Microsoft Research find a good object to talk to images.  A few comments jumped to one of the possible solutions, which is to use the .NET Drawing assembly (which I have to load first).  I wanted to be reasonably sure… Read more

## Get closure with GetNewClosure

Have you ever created scriptblocks on the fly, say in a foreach loop, and they totally mess up because they all have the same value? This is something sort of advanced, and typically used when you’re proxying an object. The most basic example would be, taken from (http://www.powershellcommunity.org/Forums/tabid/54/aff/1/aft/2506/afv/topic/Default.aspx) function add([int]$x) { return { param([int]$y) return… Read more

## Tied Variables in PowerShell

With Add-Type and $executioncontext you can add special varibles that have tied values. I made$random, and $now add-type @”using System;using System.Management.Automation;public class RandomVariable : PSVariable{Random r;public RandomVariable () : base(“Random”, 0, ScopedItemOptions.ReadOnly | ScopedItemOptions.AllScope) {r = new Random();} public override object Value { get { return r.Next(); } }}“@$executioncontext.SessionState.PSVariable.Set((new-object RandomVariable))add-type @”using System;using System.Management.Automation;public class… Read more