Wednesday, February 14, 2007


PowerShell Send To OneNote 2007

[editing note: Changed the incorrect name of PowerNote in the title to PowerShell - had OneNote on the brain and it was late....]

I have been working with Microsoft PowerShell a new "interactive" command line tool. PowerShell can be downloaded from and if you are a command line junkie, you will want to look at this tool. Over the last week I have been working with PowerShell to create command line scripts and cmdlets (an extensibility mechanism) to administer a custom Microsoft-based solution.

I spent the last few days pouring over documents , web sites, blogs and even a book to quickly get up to speed with PowerShell and honestly the sheer number of PowerShell features not to include the numerous major extensibility points requires more than a few days to become fluent with. Of course as I dove into PowerShell there were many places where I can easily see how OneNote 2007 and PowerShell would work well together. Most of these integration points will require some custom coding but to do a Send to OneNote 2007 from PowerShell is practically built into PowerShell.

So lets look at the output created by PowerShell using the default PowerShell host - the console. Here is the output Get-Process which will return a list of process on the host machine:

PowerShell uses a pipeline pattern where the output of one command can be the input to another command generally using the pipe character "". PowerShell will output to the default host without a terminating out command. Other out options include files and printers and OneNote 2007 (seen below) installs a print driver named" Send To OneNote 2007".

Whenever you select the Send To OneNote 2007 printer the output will create a new OneNote page located in the Unfiled Notes section of your OneNote 2007. Any application that can output to a printer can "Send to OneNote".

Armed with this we can now send the output of our Get-Process example to OneNote 2007 with no custom coding. To do this simply pipe the Get-Process output to the Out-Printer cmdlet with the -name argument of "Send To OneNote 2007" as shown below.

Sending the PowerShell output to the Send To OneNote 2007 printer will result in a new page located in the Unfiled Notes section as seen below. It will insert the output as an image. Unfortunately you do not have easy access to the text but OneNote 2007 will "full-text" search the image.


PowerShell is a very powerful command line tool - many times more powerful than Cmd.exe. This blog is dedicated to OneNote 2007 and not PowerShell so I don't expect to go into much detail with the capibilites of PowerShell. It is too expansive to cover it without writing a book. But I have more than enough interest in how PowerShell can work with OneNote 2007 out of the box as well as possible extension points of PowerShell and OneNote 2007. So you can probably expect more PowerShell/OneNote 2007 posts in the future For those of you who wish to learn more about PowerShell go to the PowerShell Technology Center located at: which contains many resources including the download for PowerShell.


Comments: Post a Comment

<< Home

This page is powered by Blogger. Isn't yours?

website statistics