PowerShell Team

Automating the world one-liner at a time…

Latest posts

Jan 4, 2010
Post comments count 0
Post likes count 0

Workaround for Start-Transcript on native processes

PowerShell Team

Introduction Recently, we came across an interesting bug that had been around for awhile (http://connect.microsoft.com/PowerShell/feedback/ViewFeedback.aspx?FeedbackID=315875). If you do the following: Start-Transcript ipconfig Stop-Transcript If you look at the transcript, you’ll see that the output of ipconfig was not captured. Why is this happening? PowerShell recognizes that ipconfig is a native console application. Since many of these applications do direct writes to the console buffer (i.e. more.com, edit.com etc.), we don’t direct the output handles. Because of that, we can’t capture their outpu...

Jan 1, 2010
Post comments count 0
Post likes count 0

Scorecarding My 2009 Resolutions

PowerShell Team

A year ago I broke my habit and made a set of News Years resolutions and then published them on the team blog HERE.  Lee Holmes suggested I go back and review how I did on those.  Glug!  Let’s give it a go:   All and all, I’m very happy with the year but there are still lots of opportunity to improve. Experiment!  Enjoy!&#...

Dec 29, 2009
Post comments count 0
Post likes count 0

Saving remote session to your local disk

PowerShell Team

Read the previous post on implict remoting to learn how the Import-PSSession cmdlet makes it easier to work with remote commands by presenting them as if they were local commands. This user experience saves you the trouble of typing long Invoke-Command incantations to pass arguments to remote commands or to download remote help content. The next great thing would be to jump straight into the implicit remoting experience without having to explicitly set up a remote session each time and having to remember how to invoke Import-PSSession... This is where Export-PSSession cmdlet comes handy - it can be used to save...

Dec 29, 2009
Post comments count 0
Post likes count 0

Bringing remote commands to your local session

PowerShell Team

How can you manage multiple technologies installed on separate machines that expose their management surface through cmdlets?  One approach would be to open remote desktop connection to each of those machines, another approach would be to send commands using Invoke-Command and PowerShell Remoting.  But remote desktop is not a feasible solution for automation and invoking remote commands using Invoke-Command cmdlet can sometimes get burdensome - tab completion is missing, verbose incantations are needed for passing arguments to remote commands and Get-Help -Online doesn't quite work in a remote session. ...

Dec 29, 2009
Post comments count 0
Post likes count 0

How to pass arguments for remote commands

PowerShell Team

When invoking remote commands, one often wants to use local values as arguments to the remote command. This post explains how to do that. Hardcoded values Let's start with a simple example. Below you can see how Get-Process is invoked in a remote session when the Id parameter is set to 0: Passing local values What if we want to calculate the value of the Id parameter programmatically, instead of hard-coding it to a particular integer? Well, script blocks can declare parameters and the param block can be used to pass a value to the command that is being invoked. In the following example, we declare the $proce...

Dec 26, 2009
Post comments count 0
Post likes count 0

PowerShell Help Reader – WOW!

PowerShell Team

Alexey Martseniuk posted a blog entry in the PowerShell NewsGroup announcing a new version (V1.2) of the PowerShell Help Reader.  My first reaction is WOW! Start your wow experience by going to http://PowershellTools.Com and checking out the Silverlight-based intro screen.  (You’ll need Silverlight of course but you should have it anyway – it is awesome.)  This is the harbinger of things to come.  The installed app takes advantage of WPF to deliver an excellent help experience.  The basic edition of the product is free and contains all the features but works only for the built-in Power...

Dec 25, 2009
Post comments count 0
Post likes count 0

A Christmas Tree in WPK

PowerShell Team

Merry Christmas.  To celebrate the holiday, here’s a quick Christmas tree written in WPK (the WPF PowerShell Kit).  You can get WPK as part of the PowerShellPack (http://code.msdn.microsoft.com/PowerShellPack). Here’s a screenshot: and Here’s the script: It’s only about 30 lines, but this script has tons of Christmas goodies.  It shows an example of how to create any random polygon with a simple list of points, how to resize that polygon to whatever size the control need to be, and how to apply a quick bitmap effect to an image. Hope this Helps, James

Dec 23, 2009
Post comments count 1
Post likes count 0

PowerShellPack Reaches 10,000 Downloads in 3 Months

PowerShell Team

Just before the release of Windows 7, the Windows 7 Resource Kit PowerShell Pack was released.  Today, it hit 10,000 downloads. It contains 10 useful modules that help you do more with Windows PowerShell.  It has modules that can help every IT admin ( like the TaskScheduler module), and modules that can help any .NET developer (like PSCodeGen).  There’s also a nifty module, IsePack, which provides a set of tools for working with the Windows PowerShell Integrated Scripting Environment. It also contains WPK, a module that allows you to script rich WPF UIs with PowerShell. If you haven’t taken the t...

Dec 23, 2009
Post comments count 0
Post likes count 0

Windows PowerShell 2.0 SDK

PowerShell Team

Windows PowerShell 2.0 Software Development Kit (SDK) is now available for download. This SDK contains sample code and reference assemblies that allow you to build applications based on Windows PowerShell. The samples demonstrate how to use the Windows PowerShell 2.0 APIs. You will also find sample code that shows how to use the new PowerShell class, how to write cmdlets that supports eventing, transactions and jobs. In addition, there are examples of host applications that connect to remote computers using individual runspaces and runspace pools. This SDK release also include modified Windows PowerShell 1....