Powershell Team

# PowerShell Team

Automating the world one-liner at a time…

## 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&...

## Update-TypeData, ISE CTP3 vs ISE RC, and Teched2009 Demos

There were quite a few name changes in the ISE Object Model from CTP3 to RC Using Update-TypeData, we can achieve some parity between the two We can add aliases to the CTP3 version to make it look like the RC Version  For example,         <Name>System.Management.Automation.Host.PSGHost</Name>...

## V2 Quick Tips: Finding Extra Outputs From Your Script

One of the nifty features of functions in PowerShell is that they can return as many results from as many places as you’d like.  In fact, any method or cmdlet that would give you an output if you try it on the command line will also return values from a function.  While this can give you a lot of powerful capabilities (like easily ...

## V2 Quick Tip: Starting a new elevated process from a PowerShell script

One of the systems administration hurdles of the post-Vista world is figuring out how to make a script run as an administrator. In PowerShell V2, using the Start-Process cmdlet, this is a one liner that will get the job done: Hope this Helps, James Brundage [MSFT...

## 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 Demo files look ...

## 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: Hope this Helps, James Brundage [MSFT...

## 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 :)) There could be others, but parity with PowerShell is a big thing for the ISE. Cheers,Ibrahim Abdul Rahim[MSFT...

## 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 that the way to get at the image ...

## 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/...
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...