<?xml version="1.0"?><?xml-stylesheet type="text/xsl" href="http://code.msdn.microsoft.com/rss.xsl"?><rss version="2.0"><channel><title>PowerShellTunnel - script your app from PowerShell at runtime</title><link>http://code.msdn.microsoft.com/PowerShellTunnel/Project/ProjectRss.aspx</link><description>Use an ordinary PowerShell console to access your application&amp;#39;s objects &amp;#40;explicitly hosted in a PowerShell runspace&amp;#41; at runtime, including tab expansion and piping objects into and out of your appl...</description><item><title>UPDATED WIKI: PowerShellTunnel Known Issues</title><link>http://code.msdn.microsoft.com/PowerShellTunnel/Wiki/View.aspx?title=PowerShellTunnel Known Issues&amp;version=2</link><description>&lt;div class="wikidoc"&gt;
&lt;h1&gt;
PowerShellTunnel - Known Issues
&lt;/h1&gt; &lt;br /&gt;&lt;b&gt;1)&lt;/b&gt; Updating a UI control on the hosting application from a tunnelled command - hangs.  note that tunnel commands are executed on a non-UI thread so I had a go at ensuring that the update of the Ui control was done using Invoke or BeginInvoke but still got the hang.  it seems that being in the pipeline Invoke stops the UI control Invoke from doing anything?&lt;br /&gt;
&lt;/div&gt;</description><author>MatHobbs</author><pubDate>Mon, 15 Jun 2009 02:04:13 GMT</pubDate><guid isPermaLink="false">UPDATED WIKI: PowerShellTunnel Known Issues 20090615A</guid></item><item><title>UPDATED WIKI: PowerShellTunnel Known Issues</title><link>http://code.msdn.microsoft.com/PowerShellTunnel/Wiki/View.aspx?title=PowerShellTunnel Known Issues&amp;version=1</link><description>&lt;div class="wikidoc"&gt;
1) Updating a UI control on the hosting application from a tunnelled command - hangs.  note that tunnel commands are executed on a non-UI thread so I had a go at ensuring that the update of the Ui control was done using Invoke or BeginInvoke but still got the hang.  it seems that being in the pipeline Invoke stops the UI control Invoke from doing anything?&lt;br /&gt;
&lt;/div&gt;</description><author>MatHobbs</author><pubDate>Mon, 15 Jun 2009 02:02:45 GMT</pubDate><guid isPermaLink="false">UPDATED WIKI: PowerShellTunnel Known Issues 20090615A</guid></item><item><title>UPDATED WIKI: Home</title><link>http://code.msdn.microsoft.com/PowerShellTunnel/Wiki/View.aspx?title=Home&amp;version=28</link><description>&lt;div class="wikidoc"&gt;
&lt;h1&gt;
PowerShellTunnel
&lt;/h1&gt; &lt;br /&gt;Use an ordinary PowerShell console to access your application&amp;#39;s objects &amp;#40;explicitly hosted in a PowerShell runspace&amp;#41; at runtime, including tab expansion and piping objects into and out of your application.
&lt;br /&gt;&lt;h3&gt;
Contents
&lt;/h3&gt;&lt;ul&gt;
&lt;li&gt;&lt;a href="http://code.msdn.microsoft.com/PowerShellTunnel/Wiki/View.aspx?title=Home&amp;amp;referringTitle=Home"&gt;Home&lt;/a&gt; - where you are now.&lt;/li&gt;&lt;li&gt;&lt;b&gt;&lt;a href="http://code.msdn.microsoft.com/PowerShellTunnel/Wiki/View.aspx?title=PowerShellTunnel%20Quick%20Start&amp;amp;referringTitle=Home"&gt;PowerShellTunnel Quick Start&lt;/a&gt;&lt;/b&gt; - a quick step-by-step walk-through of PowerShellTunnel.&lt;/li&gt;&lt;li&gt;&lt;a href="http://code.msdn.microsoft.com/PowerShellTunnel/Wiki/View.aspx?title=PowerShellTunnel%20How%20to%20Install&amp;amp;referringTitle=Home"&gt;PowerShellTunnel How to Install&lt;/a&gt; - a guide to requirements and installing PowerShellTunnel.&lt;/li&gt;&lt;li&gt;&lt;a href="http://code.msdn.microsoft.com/PowerShellTunnel/Wiki/View.aspx?title=PowerShellTunnel%20How%20to%20Uninstall&amp;amp;referringTitle=Home"&gt;PowerShellTunnel How to Uninstall&lt;/a&gt; - a guide to uninstalling PowerShellTunnel.&lt;/li&gt;&lt;li&gt;&lt;a href="http://code.msdn.microsoft.com/PowerShellTunnel/Wiki/View.aspx?title=PowerShellTunnel%20How%20to%20Build&amp;amp;referringTitle=Home"&gt;PowerShellTunnel How to Build&lt;/a&gt; - a guide to building PowerShellTunnel.&lt;/li&gt;&lt;li&gt;&lt;a href="http://code.msdn.microsoft.com/PowerShellTunnel/Wiki/View.aspx?title=PowerShellTunnel%20Reference&amp;amp;referringTitle=Home"&gt;PowerShellTunnel Reference&lt;/a&gt; - a guide to the cmdlets and &lt;span class="codeInline"&gt;PowerShellTunnel.sln&lt;/span&gt;.&lt;/li&gt;&lt;li&gt;&lt;a href="http://code.msdn.microsoft.com/PowerShellTunnel/Wiki/View.aspx?title=PowerShellTunnel%20Considerations&amp;amp;referringTitle=Home"&gt;PowerShellTunnel Considerations&lt;/a&gt; - notes on various issues relating to PowerShellTunnel.&lt;/li&gt;&lt;li&gt;&lt;a href="http://code.msdn.microsoft.com/PowerShellTunnel/Wiki/View.aspx?title=PowerShellTunnel%20Known%20Issues&amp;amp;referringTitle=Home"&gt;PowerShellTunnel Known Issues&lt;/a&gt; - known issues using PowerShellTunnel.&lt;/li&gt;
&lt;/ul&gt;&lt;h3&gt;
PowerShellTunnel, what is it and why is it..
&lt;/h3&gt; &lt;br /&gt;While using &lt;a href="http://www.microsoft.com/windowsserver2003/technologies/management/powershell/default.mspx" class="externalLink"&gt;PowerShell&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; to construct and manipulate .NET objects, did you ever think that it would be pretty cool to be able to open a PowerShell console and connect to and directly access the objects of a running application (at least the objects it exposes)?  (You can't do this with Remoting in PowerShell 2.0 where you can only open new remote consoles.)&lt;br /&gt; &lt;br /&gt;For example you might want to do:&lt;br /&gt; &lt;br /&gt;&lt;ol&gt;
&lt;li&gt;Ad-hoc debugging, diagnostics, or monitoring.&lt;/li&gt;&lt;li&gt;Change object properties or calling methods at runtime.&lt;/li&gt;&lt;li&gt;Ad-hoc (or scripted) unit, system, or integrity tests on a live application.&lt;/li&gt;&lt;li&gt;Simulate events and actions.&lt;/li&gt;&lt;li&gt;Allow automation of your application without explicit interface contracts (ad-hoc or prototyping APIs).&lt;/li&gt;&lt;li&gt;Perhaps even adding or changing functionality on-the-fly.&lt;/li&gt;&lt;li&gt;... probably many other things you might think of.&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;There is an existing &lt;a href="http://www.codeplex.com/powershellremoting" class="externalLink"&gt;PowerShell Remoting&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; project which uses a remote service to which you connect to to create a PowerShell host that you talk to through your client connection.  This isn't quite what what I was after and after hearing that &lt;a href="http://blogs.msdn.com/powershell/archive/2007/11/06/what-s-new-in-ctp-of-powershell-2-0.aspx" class="externalLink"&gt;PowerShell 2.0&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; was coming, decided to wait and see.  So PowerShell 2.0 CTP is here and does have Remoting ability but this is also focused on the administrative desire to summon a PowerShell console on a remote host and control it from the client, but neither approach can connect to an existing application's embedded PowerShell runspace.&lt;br /&gt; &lt;br /&gt;So, after some reading and playing, PowerShellTunnel was created.  PowerShellTunnel is a single VS2005 solution containing:&lt;br /&gt; &lt;br /&gt;&lt;ol&gt;
&lt;li&gt;Server-side cmdlets allowing you to start a 'tunnel host' from a PowerShell console or runspace.  A 'tunnel host' allows 'tunnels' (tunnel clients) to access your console/runspace.&lt;/li&gt;&lt;li&gt;Client-side cmdlets allowing you to start a 'tunnel' (connection) from a PowerShell console or runspace to an existing tunnel host (local or remote) and send scripts to onvoke on the tunnel host console/runspace.  This includes piping objects in and out.&lt;/li&gt;&lt;li&gt;Tab-expansion 'works' on the client: pressing tab will return tab expansion results from the tunnel host's runspace.  A gotcha (for now) is that as long as you have a 'current tunnel' selected, tab expansion always diverts to the current tunnel's host.&lt;/li&gt;&lt;li&gt;An ordinary 'embeddable' PowerShell runspace class (hostable by any .NET app) where you explicitly specify what objects to expose (specifying which PowerShell variable names) and any tunnel hosts to host.&lt;/li&gt;&lt;li&gt;An example of a console application with a few simple objects that you can use to connect to from an ordinary PowerShell console.&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;Note that:&lt;br /&gt;&lt;ol&gt;
&lt;li&gt;WCF is used to do all the legwork of the underlying connection, by default the code uses http.  By using WCF we avoid having to code for transport options, security, and other issues as this should be all achievable through WCF.&lt;/li&gt;&lt;li&gt;Serializable objects can be piped into and out of the tunnel.&lt;/li&gt;&lt;li&gt;The cmdlets also allow an ordinary PowerShell console to act as a tunnel host.  This is the easiest way to start playing with PowerShellTunnel: use one PowerShell console as the tunnel host and another as the tunnel client.  Similarly an embedded runspace could start a tunnel to any tunnel host too.&lt;/li&gt;&lt;li&gt;Any console or runspace can have multiple tunnel hosts and/or can have multiple tunnels open.&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;To make a long story short, review the &lt;a href="http://code.msdn.microsoft.com/PowerShellTunnel/Wiki/View.aspx?title=PowerShellTunnel%20Quick%20Start&amp;amp;referringTitle=Home"&gt;PowerShellTunnel Quick Start&lt;/a&gt; to see if this suits you.  Use the Issue Tracker for any bugs or suggestions.&lt;br /&gt;Use the Discussions tab for questions, comments, ideas, or to share how you have used PowerShellTunnel.&lt;br /&gt; &lt;br /&gt;Cheers,&lt;br /&gt;-Matthew Hobbs&lt;br /&gt;&lt;a href="http://objectbusiness.wordpress.com" class="externalLink"&gt;(Very) Intermittent Blog&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;/div&gt;</description><author>MatHobbs</author><pubDate>Mon, 15 Jun 2009 02:00:24 GMT</pubDate><guid isPermaLink="false">UPDATED WIKI: Home 20090615A</guid></item><item><title>NEW POST: Working around the serialization issue</title><link>http://code.msdn.microsoft.com/PowerShellTunnel/Thread/View.aspx?ThreadId=835</link><description>&lt;div class="wikidoc"&gt;
Hi Phil,&lt;br /&gt; &lt;br /&gt;I haven't seen this or looked into that at all.  Fortunately, I've only had to deal with serializable objects when I've needed to actually bring the object up or down the tunnel.  I wonder if for other objects this clixml mechanism could be used to implement a proxy to 'wrap' an object living only at the other end of the tunnel (so the proxy would encapsulate the tunnel itself), or just use as a way to create local PSObjects with imitation properties for local use (with access only to data and not methods)...&lt;br /&gt; &lt;br /&gt;By now I was kind of hoping that the upcoming PowerShell 2.0 would have made this project obsolete but still there is no apparent way to connect to an existing runspace (e.g. hosted by an app, remote or otherwise) - perhaps 3.0?&lt;br /&gt; &lt;br /&gt;Cheers,&lt;br /&gt;-Mat&lt;br /&gt;
&lt;/div&gt;</description><author>MatHobbs</author><pubDate>Thu, 06 Nov 2008 08:59:02 GMT</pubDate><guid isPermaLink="false">NEW POST: Working around the serialization issue 20081106A</guid></item><item><title>NEW POST: Working around the serialization issue</title><link>http://code.msdn.microsoft.com/PowerShellTunnel/Thread/View.aspx?ThreadId=835</link><description>&lt;div class="wikidoc"&gt;
I was wondering if you could use export-clixml &amp;amp; import-clixml cmdlets to get around the issue of a type that could not be serialized.  The side effect is that you will need to write and then read from the file system.  Scott Hanselman's article on &lt;i&gt;ScriptBlock and Runspace Remoting in PowerShell&lt;/i&gt; discusses it use. &lt;a href="http://www.hanselman.com/blog/ScriptBlockAndRunspaceRemotingInPowerShell.aspx" class="externalLink"&gt;http://www.hanselman.com/blog/ScriptBlockAndRunspaceRemotingInPowerShell.aspx&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;. I was wondering if you had considered using it.&lt;br /&gt;
&lt;/div&gt;</description><author>Phil_Bolduc</author><pubDate>Tue, 21 Oct 2008 08:25:28 GMT</pubDate><guid isPermaLink="false">NEW POST: Working around the serialization issue 20081021A</guid></item><item><title>UPDATED WIKI: PowerShellTunnel Considerations</title><link>http://code.msdn.microsoft.com/PowerShellTunnel/Wiki/View.aspx?title=PowerShellTunnel Considerations&amp;version=15</link><description>&lt;div class="wikidoc"&gt;
&lt;h1&gt;
PowerShellTunnel - Considerations
&lt;/h1&gt; &lt;br /&gt;&lt;b&gt;A)&lt;/b&gt; If you don't want to connect to an existing embedded runspace but instead want to remote-connect to new PowerShell 'consoles' on remote clients, refer instead to PowerShell 2.0 or the &amp;quot;PowerShell Remoting&amp;quot; project.  PowerShellTunnel is designed for connecting to an existing console or runspace.&lt;br /&gt; &lt;br /&gt;&lt;b&gt;B)&lt;/b&gt; The &lt;a href="http://thepowershellguy.com/blogs/posh/pages/powertab.aspx" class="externalLink"&gt;PowerTab&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; project could make tab expansion integration cleaner.&lt;br /&gt; &lt;br /&gt;&lt;b&gt;C)&lt;/b&gt; Serialization: PowerShellTunnel uses ordinary serialization by serialized pipied input or output objects to a stream and sending a raw byte array to and from the tunnel host.  If the class is not serializable then just the type name will be sent.  PowerShellTunnel does not use WCF data contract serialization for the piped objects themselves.&lt;br /&gt; &lt;br /&gt;&lt;b&gt;D)&lt;/b&gt; TODO: Add 'help', 'verbose', functionality to cmdlets.&lt;br /&gt; &lt;br /&gt;&lt;b&gt;E)&lt;/b&gt; Security Warning: once connected to the tunnel host, the tunnel has access to all of the tunnel host's exposed objects and functionality (c.f. &lt;a href="http://www.codeplex.com/Skynet" class="externalLink"&gt;Skynet&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;).  (Future Powershell runspaces may be restrictable to limit what objects can be accessed.)&lt;br /&gt; &lt;br /&gt;&lt;b&gt;F)&lt;/b&gt; Multiple hosts/clients: You can create multiple tunnel hosts and multiple tunnels, e.g. a host may be accessed by multiple clients.  A client may use multiple tunnels (to different hosts) and use: &amp;quot;select-tunnel&amp;quot; to switch between them or use the &amp;quot;-tunnel&amp;quot; parameter of &amp;quot;invoke-tunnel&amp;quot;.&lt;br /&gt; &lt;br /&gt;&lt;b&gt;G)&lt;/b&gt; Threading: Be aware of threading considerations given that the tunnel host executes on a WCF worker thread (e.g. on a .NET Thread Pool thread).&lt;br /&gt; &lt;br /&gt;&lt;b&gt;H)&lt;/b&gt; No Ctrl-C?  If you invoke-tunnel a script, Ctrl-C from the client does not interrupt it, so beware of infinite loops or long operations.&lt;br /&gt; &lt;br /&gt;&lt;b&gt;I)&lt;/b&gt; After 'select-tunnel' (or add-tunnel without the -noselect switch), tab expansion is intercepted to to tab expansion on the tunnel host.  This is useful when typing the script block of the invoke-tunnel but not especially elsewhere.  Use select-tunnel without a parameter to turn off the tab expansion interception (and requires invoke-tunnel to specify a '-tunnel xyz' parameter).&lt;br /&gt; &lt;br /&gt;&lt;b&gt;J)&lt;/b&gt; There might be ways to streamline the user syntax/experience further.  In the meanwhile, consider using an alias to Invoke-Tunnel, e.g.&lt;br /&gt;&lt;span class="codeInline"&gt;Set-Alias T Invoke-Tunnel&lt;/span&gt;&lt;br /&gt;&lt;span class="codeInline"&gt;Set-Alias TP Invoke-Tunnel -pipeoutput&lt;/span&gt;&lt;br /&gt;or&lt;br /&gt;&lt;span class="codeInline"&gt;function T1 { Invoke-Tunnel -tunnel $mytunnel1 $args} &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;</description><author>MatHobbs</author><pubDate>Thu, 03 Apr 2008 07:56:27 GMT</pubDate><guid isPermaLink="false">UPDATED WIKI: PowerShellTunnel Considerations 20080403A</guid></item><item><title>CREATED ISSUE: Increase WCF Default Message Size Limits</title><link>http://code.msdn.microsoft.com/PowerShellTunnel/WorkItem/View.aspx?WorkItemId=1</link><description>The default WCF mssage receive size limit of 65536 bytes can be easily hit.  Increase this to 1000000000 bytes by default.  Also increase WCF data contract serializer setting MaxItemsInObjectGraph and set PreserveReferences to true.&lt;br /&gt;</description><author>MatHobbs</author><pubDate>Wed, 19 Mar 2008 06:16:40 GMT</pubDate><guid isPermaLink="false">CREATED ISSUE: Increase WCF Default Message Size Limits 20080319A</guid></item><item><title>NEW POST: Using invoke-tunnel on XP SP2</title><link>http://code.msdn.microsoft.com/PowerShellTunnel/Thread/View.aspx?ThreadId=173</link><description>&lt;div class="wikidoc"&gt;
Hi Marco, ah yes: WCF's default limits.  Your $x probably referenced an object that would be serialized to &amp;gt; 65536 bytes.  I uploaded a new PowerShellTunnel release (&amp;quot;1.01&amp;quot;) that bumps up two important WCF settings so you should not get this any more unless your objects is &amp;gt; 1000000000 bytes!&lt;br /&gt; &lt;br /&gt;Cheers,&lt;br /&gt;-Mat&lt;br /&gt;
&lt;/div&gt;</description><author>MatHobbs</author><pubDate>Wed, 19 Mar 2008 06:13:47 GMT</pubDate><guid isPermaLink="false">NEW POST: Using invoke-tunnel on XP SP2 20080319A</guid></item><item><title>CREATED RELEASE: PowerShellTunnel v1.01 Source (Mar 18, 2008)</title><link>http://code.msdn.microsoft.com/PowerShellTunnel/Release/ProjectReleases.aspx?ReleaseId=686</link><description>Additions only for the default WCF behavior&amp;#58;&lt;br /&gt;1&amp;#41; Increase the default MaxReceivedMessageSize so large objects can be serialized and piped without a WCF error.&lt;br /&gt;2&amp;#41; Add a custom data contract serializer behavior to increase MaxItemsInObjectGraph too.</description><author></author><pubDate>Wed, 19 Mar 2008 06:09:02 GMT</pubDate><guid isPermaLink="false">CREATED RELEASE: PowerShellTunnel v1.01 Source (Mar 18, 2008) 20080319A</guid></item><item><title>UPDATED WIKI: PowerShellTunnel Quick Start</title><link>http://code.msdn.microsoft.com/PowerShellTunnel/Wiki/View.aspx?title=PowerShellTunnel Quick Start&amp;version=45</link><description>&lt;div class="wikidoc"&gt;
&lt;h1&gt;
PowerShellTunnel - Quick Start
&lt;/h1&gt; &lt;br /&gt;With PowerShellTunnel you create a tunnel between two endpoints: the tunnel 'host' and the tunnel 'client' - you need to start both.  You send scripts from the client to execute on the host as if you had typed them directly into the host (including tab expansion), so you have access to all the objects and capabilities of the host from the client.  Objects can be piped into or out of the tunnel (ordinary serialization is used).&lt;br /&gt; &lt;br /&gt;If you want to follow through the quick start, you'll need to first go through &lt;a href="http://code.msdn.microsoft.com/PowerShellTunnel/Wiki/View.aspx?title=PowerShellTunnel%20How%20to%20Build&amp;amp;referringTitle=PowerShellTunnel%20Quick%20Start"&gt;PowerShellTunnel How to Build&lt;/a&gt; and &lt;a href="http://code.msdn.microsoft.com/PowerShellTunnel/Wiki/View.aspx?title=PowerShellTunnel%20How%20to%20Install&amp;amp;referringTitle=PowerShellTunnel%20Quick%20Start"&gt;PowerShellTunnel How to Install&lt;/a&gt;.&lt;br /&gt; &lt;br /&gt;This quick-start works through two scenarios:&lt;br /&gt; &lt;br /&gt;&lt;ol&gt;
&lt;li&gt;&lt;b&gt;Console -&amp;gt; Console&lt;/b&gt;:  Two PowerShell consoles, one acts as a tunnel host, the other as a tunnel client.&lt;/li&gt;&lt;li&gt;&lt;b&gt;Console -&amp;gt; Application&lt;/b&gt;:  One ordinary .NET console application with an embedded PowerShell runspace (which exposes some application objects as ordinary PowerShell variables) which hosts a tunnel, and an ordinary PowerShell console which acts as a tunnel client to interact with the application's objects while the application is running.&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;&lt;h1&gt;
Console -&amp;gt; Console
&lt;/h1&gt; &lt;br /&gt;In this scenario, the tunnel host will be a PowerShell console with a couple of objects which we will try to access from another PowerShell console (the tunnel client).&lt;br /&gt; &lt;br /&gt;&lt;h3&gt;
Step 1) Create the Tunnel Host.
&lt;/h3&gt; &lt;br /&gt;1-a)	Start a PowerShell console.&lt;br /&gt;	&lt;br /&gt;1-b)	Enter the following commands to add the snapin, add a tunnel host (use the address you specified when you did the install, or refer to &lt;a href="http://code.msdn.microsoft.com/PowerShellTunnel/Wiki/View.aspx?title=PowerShellTunnel%20How%20to%20Install&amp;amp;referringTitle=PowerShellTunnel%20Quick%20Start"&gt;PowerShellTunnel How to Install&lt;/a&gt; to add an http permission for your user if necessary), and create a couple of ordinary objects:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
add-pssnapin PowerShellTunnel
$tunnelhost = add-tunnelhost &amp;quot;http://localhost:8000/PowerShellTunnel/Host1&amp;quot;
$x = dir
$y = $x[0]
&lt;/pre&gt;&lt;h3&gt;
Step 2) Create the Tunnel Client.
&lt;/h3&gt; &lt;br /&gt;2-a)	Start a PowerShell console.&lt;br /&gt; &lt;br /&gt;2-b)	Enter the following commands to add the snapin and add a tunnel to the tunnel host (using the same address that you used for the host).&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
add-pssnapin PowerShellTunnel
$tunnel = add-tunnel &amp;quot;http://localhost:8000/PowerShellTunnel/Host1&amp;quot;
&lt;/pre&gt;2-c)	Access the objects on the host.  Note that tab expansion works correctly, e.g. on the Name property of $y, i.e. $y.N{TAB} becomes $y.Name.  The pipeline should work (both in and out) so long as types are WCF-OK (standard types or types made known to WCF &lt;a href="http://code.msdn.microsoft.com/PowerShellTunnel/Wiki/View.aspx?title=...&amp;amp;referringTitle=PowerShellTunnel%20Quick%20Start"&gt;...&lt;/a&gt;).&lt;br /&gt; &lt;br /&gt;&lt;i&gt;Examples:&lt;/i&gt;&lt;br /&gt;&lt;pre&gt;
invoke-tunnel { $x }
invoke-tunnel { $y.Name }
$yLocal = invoke-tunnel { $y }; $yLocal # $yLocal is set to a local (serialized &amp;amp; deserialized) copy of $y
invoke-tunnel { $z = &amp;quot;This variable is set on the host!&amp;quot; } 
&lt;/pre&gt; &lt;br /&gt;&lt;i&gt;Example piping objects in and out:&lt;/i&gt;&lt;br /&gt;&lt;pre&gt;
&amp;quot;write line #1&amp;quot;, &amp;quot;write line #2&amp;quot;, (&amp;quot;write&amp;quot;, &amp;quot;line&amp;quot;, &amp;quot;#3&amp;quot; ) | invoke-tunnel { $input | foreach { write-host $_; &amp;quot;$_&amp;quot;.Length } }
$myx = invoke-tunnel { $x } -pipe    #sets $myx to a list of DirectoryInfo and FileInfo objects piped from the host
&lt;/pre&gt; &lt;br /&gt;&lt;i&gt;Example sending a script file:&lt;/i&gt;&lt;br /&gt;&lt;pre&gt;
'$z = 4; $z = $z*$z; write-host &amp;quot;On Host: $z&amp;quot;; &amp;quot;Return to client: $z&amp;quot; ' &amp;gt; test.ps1
type test.ps1 | invoke-tunnel { invoke-expression $input }
del test.ps1
&lt;/pre&gt;Note: if there are multiple tunnels, then select-tunnel can be used to change the current invoke-tunnel default (and redirect tab expansion), or invoke-tunnel can be called with a '-tunnel xyz' parameter.&lt;br /&gt; &lt;br /&gt;&lt;h3&gt;
Step 3) Switch back to the host console and verify that you see:
&lt;/h3&gt; &lt;br /&gt;&lt;pre&gt;
write line #1
write line #2
write line #3
&lt;/pre&gt;and verify that $z was created:&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
$z  #You'll see &amp;quot;This variable is set on the host!&amp;quot;
&lt;/pre&gt;&lt;h3&gt;
Step 4) Switch back to the client console and remove (close) the Tunnel and remove the snapin.
&lt;/h3&gt; &lt;br /&gt;&lt;pre&gt;
Remove-Tunnel $tunnel
Remove-PSSnapin PowerShellTunnel
&lt;/pre&gt;&lt;h3&gt;
Step 5) Switch back to the host console and remove (close) the Tunnel Host and remove the snapin.
&lt;/h3&gt; &lt;br /&gt;&lt;pre&gt;
Remove-TunnelHost $tunnelhost
Remove-PSSnapin PowerShellTunnel
&lt;/pre&gt;&lt;h2&gt;
Console -&amp;gt; Application
&lt;/h2&gt; &lt;br /&gt;In this scenario, the tunnel host will be a PowerShell runspace hosted (embedded) within a console application (PowerShellTunnel.Embeddable.Example.exe) which 'exposes' a few of its objects as PowerShell variables in the hosted runspace.  The client will be an ordinary PowerShell console as before.&lt;br /&gt; &lt;br /&gt;&lt;h3&gt;
Step 1) Create the Tunnel Host.
&lt;/h3&gt; &lt;br /&gt;First, if you are re-using the same host address from before, close the tunnel host console from the 'Console -&amp;gt; Console' walkthrough if it is still open.&lt;br /&gt; &lt;br /&gt;Build and run PowerShellTunnel.Embeddable.Example.exe.  This is a console application that outputs some information and waits on a Console.Readline() where pressing Enter exits the application.   A PowerShell runspace is hosted and a tunnel host created in the runspace at address &amp;quot;http://localhost:8000/PowerShellTunnel/Host1&amp;quot; (or change this value in program.cs).&lt;br /&gt; &lt;br /&gt;&lt;h3&gt;
Step 2) Create the Tunnel Client.
&lt;/h3&gt; &lt;br /&gt;2-a)	Start a PowerShell console.&lt;br /&gt; &lt;br /&gt;2-b)	Enter the following commands to add the snapin, add a tunnel to connect to the above tunnel host (using the address that you used for the host).&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
add-pssnapin PowerShellTunnel
$tunnel = add-tunnel &amp;quot;http://localhost:8000/PowerShellTunnel/Host1&amp;quot;
&lt;/pre&gt;	2-c)	Access the objects on the host.  Note that tab expansion works correctly, e.g. on the Name property of $y, i.e. $y.N&amp;lt;TAB&amp;gt; becomes $y.Name. The pipeline should work (both in and out) so long as the piped types are serializable.&lt;br /&gt; &lt;br /&gt;&lt;pre&gt;
invoke-tunnel { $myvar1 }
invoke-tunnel { $myvar2 }
invoke-tunnel { $myvar3 }
&lt;/pre&gt;The same kinds of access is available as before with some warnings:&lt;br /&gt; &lt;br /&gt;&lt;ol&gt;
&lt;ol&gt;
&lt;li&gt;The example hosted runspace does not have a console so any scripts which access the console in any way will fail (you can create a more advanced host).&lt;/li&gt;&lt;li&gt;The tunnel host gets its requests on WCF worker threads, so be aware of multi-threading issues on whatever is exposed via the runspace.&lt;/li&gt;&lt;li&gt;Be aware that the client has access to anything that the hosted runspace has.&lt;/li&gt;&lt;li&gt;You may want to configure WCF security in the general case.&lt;/li&gt;
&lt;/ol&gt;
&lt;/ol&gt; &lt;br /&gt;&lt;h2&gt;
General Notes
&lt;/h2&gt; &lt;br /&gt;Refer to &lt;a href="http://code.msdn.microsoft.com/PowerShellTunnel/Wiki/View.aspx?title=PowerShellTunnel%20Considerations&amp;amp;referringTitle=PowerShellTunnel%20Quick%20Start"&gt;PowerShellTunnel Considerations&lt;/a&gt;.&lt;br /&gt;
&lt;/div&gt;</description><author>MatHobbs</author><pubDate>Wed, 19 Mar 2008 06:00:05 GMT</pubDate><guid isPermaLink="false">UPDATED WIKI: PowerShellTunnel Quick Start 20080319A</guid></item><item><title>EDITED ISSUE: Increase WCF Default Message Size Limits</title><link>http://code.msdn.microsoft.com/PowerShellTunnel/WorkItem/View.aspx?WorkItemId=1</link><description>The default WCF mssage receive size limit of 65536 bytes can be easily hit.  Increase this to 1000000000 bytes by default.  Also increase WCF data contract serializer setting MaxItemsInObjectGraph and set PreserveReferences to true.&lt;br /&gt;</description><author>MatHobbs</author><pubDate>Wed, 19 Mar 2008 03:17:32 GMT</pubDate><guid isPermaLink="false">EDITED ISSUE: Increase WCF Default Message Size Limits 20080319A</guid></item><item><title>NEW POST: Using invoke-tunnel on XP SP2</title><link>http://code.msdn.microsoft.com/PowerShellTunnel/Thread/View.aspx?ThreadId=173</link><description>&lt;div class="wikidoc"&gt;
Following your guides:&lt;br /&gt; &lt;br /&gt;PSH&amp;gt; invoke-tunnel { $x }&lt;br /&gt;Invoke-Tunnel : The maximum message size quota for incoming messages (65536) has been exceeded. To increase the quota,&lt;br /&gt;use the MaxReceivedMessageSize property on the appropriate binding element.&lt;br /&gt;At line:1 char:14&lt;br /&gt;+ invoke-tunnel &amp;lt;&amp;lt;&amp;lt;&amp;lt;  { $x }&lt;br /&gt; &lt;br /&gt;Still appears things are working.&lt;br /&gt;
&lt;/div&gt;</description><author>marcoshaw</author><pubDate>Fri, 14 Mar 2008 20:28:56 GMT</pubDate><guid isPermaLink="false">NEW POST: Using invoke-tunnel on XP SP2 20080314P</guid></item><item><title>UPDATED WIKI: Home</title><link>http://code.msdn.microsoft.com/PowerShellTunnel/Wiki/View.aspx?title=Home&amp;version=27</link><description>&lt;div class="wikidoc"&gt;
&lt;h1&gt;
PowerShellTunnel
&lt;/h1&gt; &lt;br /&gt;Host a PowerShell runspace and expose application objects as ordinary PowerShell variables.  Add a &amp;#39;tunnel host&amp;#39;, then use an ordinary &amp;#40;local or remote&amp;#41; PowerShell console &amp;#40;or runspace&amp;#41; to &amp;#39;tunnel&amp;#39; &amp;#40;connect using WCF&amp;#41; to your application&amp;#39;s runspace at runtime and script away.
&lt;br /&gt;&lt;h3&gt;
Contents
&lt;/h3&gt;&lt;ul&gt;
&lt;li&gt;&lt;a href="http://code.msdn.microsoft.com/PowerShellTunnel/Wiki/View.aspx?title=Home&amp;amp;referringTitle=Home"&gt;Home&lt;/a&gt; - where you are now.&lt;/li&gt;&lt;li&gt;&lt;b&gt;&lt;a href="http://code.msdn.microsoft.com/PowerShellTunnel/Wiki/View.aspx?title=PowerShellTunnel%20Quick%20Start&amp;amp;referringTitle=Home"&gt;PowerShellTunnel Quick Start&lt;/a&gt;&lt;/b&gt; - a quick step-by-step walk-through of PowerShellTunnel.&lt;/li&gt;&lt;li&gt;&lt;a href="http://code.msdn.microsoft.com/PowerShellTunnel/Wiki/View.aspx?title=PowerShellTunnel%20How%20to%20Install&amp;amp;referringTitle=Home"&gt;PowerShellTunnel How to Install&lt;/a&gt; - a guide to requirements and installing PowerShellTunnel.&lt;/li&gt;&lt;li&gt;&lt;a href="http://code.msdn.microsoft.com/PowerShellTunnel/Wiki/View.aspx?title=PowerShellTunnel%20How%20to%20Uninstall&amp;amp;referringTitle=Home"&gt;PowerShellTunnel How to Uninstall&lt;/a&gt; - a guide to uninstalling PowerShellTunnel.&lt;/li&gt;&lt;li&gt;&lt;a href="http://code.msdn.microsoft.com/PowerShellTunnel/Wiki/View.aspx?title=PowerShellTunnel%20How%20to%20Build&amp;amp;referringTitle=Home"&gt;PowerShellTunnel How to Build&lt;/a&gt; - a guide to building PowerShellTunnel.&lt;/li&gt;&lt;li&gt;&lt;a href="http://code.msdn.microsoft.com/PowerShellTunnel/Wiki/View.aspx?title=PowerShellTunnel%20Reference&amp;amp;referringTitle=Home"&gt;PowerShellTunnel Reference&lt;/a&gt; - a guide to the cmdlets and &lt;span class="codeInline"&gt;PowerShellTunnel.sln&lt;/span&gt;.&lt;/li&gt;&lt;li&gt;&lt;a href="http://code.msdn.microsoft.com/PowerShellTunnel/Wiki/View.aspx?title=PowerShellTunnel%20Considerations&amp;amp;referringTitle=Home"&gt;PowerShellTunnel Considerations&lt;/a&gt; - notes on various issues relating to PowerShellTunnel.&lt;/li&gt;
&lt;/ul&gt;&lt;h3&gt;
PowerShellTunnel, what is it and why is it..
&lt;/h3&gt; &lt;br /&gt;While using &lt;a href="http://www.microsoft.com/windowsserver2003/technologies/management/powershell/default.mspx" class="externalLink"&gt;PowerShell&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; to construct and manipulate .NET objects, did you ever think that it would be pretty cool to be able to open a PowerShell console and connect to and directly access the objects of a running application (at least the objects it exposes)?  (You can't do this with Remoting in PowerShell 2.0 where you can only open new remote consoles.)&lt;br /&gt; &lt;br /&gt;For example you might want to do:&lt;br /&gt; &lt;br /&gt;&lt;ol&gt;
&lt;li&gt;Ad-hoc debugging, diagnostics, or monitoring.&lt;/li&gt;&lt;li&gt;Change object properties or calling methods at runtime.&lt;/li&gt;&lt;li&gt;Ad-hoc (or scripted) unit, system, or integrity tests on a live application.&lt;/li&gt;&lt;li&gt;Simulate events and actions.&lt;/li&gt;&lt;li&gt;Allow automation of your application without explicit interface contracts (ad-hoc or prototyping APIs).&lt;/li&gt;&lt;li&gt;Perhaps even adding or changing functionality on-the-fly.&lt;/li&gt;&lt;li&gt;... probably many other things you might think of.&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;There is an existing &lt;a href="http://www.codeplex.com/powershellremoting" class="externalLink"&gt;PowerShell Remoting&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; project which uses a remote service to which you connect to to create a PowerShell host that you talk to through your client connection.  This isn't quite what what I was after and after hearing that &lt;a href="http://blogs.msdn.com/powershell/archive/2007/11/06/what-s-new-in-ctp-of-powershell-2-0.aspx" class="externalLink"&gt;PowerShell 2.0&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; was coming, decided to wait and see.  So PowerShell 2.0 CTP is here and does have Remoting ability but this is also focused on the administrative desire to summon a PowerShell console on a remote host and control it from the client, but neither approach can connect to an existing application's embedded PowerShell runspace.&lt;br /&gt; &lt;br /&gt;So, after some reading and playing, PowerShellTunnel was created.  PowerShellTunnel is a single VS2005 solution containing:&lt;br /&gt; &lt;br /&gt;&lt;ol&gt;
&lt;li&gt;Server-side cmdlets allowing you to start a 'tunnel host' from a PowerShell console or runspace.  A 'tunnel host' allows 'tunnels' (tunnel clients) to access your console/runspace.&lt;/li&gt;&lt;li&gt;Client-side cmdlets allowing you to start a 'tunnel' (connection) from a PowerShell console or runspace to an existing tunnel host (local or remote) and send scripts to onvoke on the tunnel host console/runspace.  This includes piping objects in and out.&lt;/li&gt;&lt;li&gt;Tab-expansion 'works' on the client: pressing tab will return tab expansion results from the tunnel host's runspace.  A gotcha (for now) is that as long as you have a 'current tunnel' selected, tab expansion always diverts to the current tunnel's host.&lt;/li&gt;&lt;li&gt;An ordinary 'embeddable' PowerShell runspace class (hostable by any .NET app) where you explicitly specify what objects to expose (specifying which PowerShell variable names) and any tunnel hosts to host.&lt;/li&gt;&lt;li&gt;An example of a console application with a few simple objects that you can use to connect to from an ordinary PowerShell console.&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;Note that:&lt;br /&gt;&lt;ol&gt;
&lt;li&gt;WCF is used to do all the legwork of the underlying connection, by default the code uses http.  By using WCF we avoid having to code for transport options, security, and other issues as this should be all achievable through WCF.&lt;/li&gt;&lt;li&gt;Serializable objects can be piped into and out of the tunnel.&lt;/li&gt;&lt;li&gt;The cmdlets also allow an ordinary PowerShell console to act as a tunnel host.  This is the easiest way to start playing with PowerShellTunnel: use one PowerShell console as the tunnel host and another as the tunnel client.  Similarly an embedded runspace could start a tunnel to any tunnel host too.&lt;/li&gt;&lt;li&gt;Any console or runspace can have multiple tunnel hosts and/or can have multiple tunnels open.&lt;/li&gt;
&lt;/ol&gt; &lt;br /&gt;To make a long story short, review the &lt;a href="http://code.msdn.microsoft.com/PowerShellTunnel/Wiki/View.aspx?title=PowerShellTunnel%20Quick%20Start&amp;amp;referringTitle=Home"&gt;PowerShellTunnel Quick Start&lt;/a&gt; to see if this suits you.  Use the Issue Tracker for any bugs or suggestions.&lt;br /&gt;Use the Discussions tab for questions, comments, ideas, or to share how you have used PowerShellTunnel.&lt;br /&gt; &lt;br /&gt;Cheers,&lt;br /&gt;-Matthew Hobbs&lt;br /&gt;&lt;a href="http://objectbusiness.wordpress.com" class="externalLink"&gt;(Very) Intermittent Blog&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;
&lt;/div&gt;</description><author>MatHobbs</author><pubDate>Thu, 13 Mar 2008 05:34:31 GMT</pubDate><guid isPermaLink="false">UPDATED WIKI: Home 20080313A</guid></item><item><title>UPDATED RELEASE: PowerShellTunnel v1.0 Source (Mar 02, 2008)</title><link>http://code.msdn.microsoft.com/PowerShellTunnel/Release/ProjectReleases.aspx?ReleaseId=595</link><description>First release &amp;#40;source only&amp;#41; including the source required to build the PowerShellTunnel assembly &amp;#40;PowerShellTunnel.dll&amp;#41; and an example application host &amp;#40;PowerShellTunnel.Embeddable.Example.exe&amp;#41;.</description><author></author><pubDate>Mon, 03 Mar 2008 07:34:18 GMT</pubDate><guid isPermaLink="false">UPDATED RELEASE: PowerShellTunnel v1.0 Source (Mar 02, 2008) 20080303A</guid></item><item><title>RELEASED: PowerShellTunnel v1.0 Source (Mar 02, 2008)</title><link>http://code.msdn.microsoft.com/PowerShellTunnel/Release/ProjectReleases.aspx?ReleaseId=595</link><description>First release &amp;#40;source only&amp;#41; including the source required to build the PowerShellTunnel assembly &amp;#40;PowerShellTunnel.dll&amp;#41; and an example application host &amp;#40;PowerShellTunnel.Embeddable.Example.exe&amp;#41;.</description><author></author><pubDate>Mon, 03 Mar 2008 07:34:18 GMT</pubDate><guid isPermaLink="false">RELEASED: PowerShellTunnel v1.0 Source (Mar 02, 2008) 20080303A</guid></item><item><title>UPDATED RELEASE: PowerShellTunnel - Initial Release (Source) (Mar 02, 2008)</title><link>http://code.msdn.microsoft.com/PowerShellTunnel/Release/ProjectReleases.aspx?ReleaseId=595</link><description>Initial source-only release including the source required to build the PowerShellTunnel assembly &amp;#40;PowerShellTunnel.dll&amp;#41; and an example application host &amp;#40;PowerShellTunnel.Embeddable.Example.exe&amp;#41;.</description><author></author><pubDate>Mon, 03 Mar 2008 07:32:41 GMT</pubDate><guid isPermaLink="false">UPDATED RELEASE: PowerShellTunnel - Initial Release (Source) (Mar 02, 2008) 20080303A</guid></item><item><title>UPDATED RELEASE: PowerShellTunnel - Initial Release (Source) (Mar 02, 2008)</title><link>http://code.msdn.microsoft.com/PowerShellTunnel/Release/ProjectReleases.aspx?ReleaseId=595</link><description>Initial source-only release including the PowerShellTunnel assembly &amp;#40;PowerShellTunnel.dll&amp;#41; and an example application host &amp;#40;PowerShellTunnel.Embeddable.Example.exe&amp;#41;.</description><author></author><pubDate>Mon, 03 Mar 2008 07:31:24 GMT</pubDate><guid isPermaLink="false">UPDATED RELEASE: PowerShellTunnel - Initial Release (Source) (Mar 02, 2008) 20080303A</guid></item><item><title>CREATED RELEASE: PowerShellTunnel - Initial Release (Source) (Mar 02, 2008)</title><link>http://code.msdn.microsoft.com/PowerShellTunnel/Release/ProjectReleases.aspx?ReleaseId=595</link><description>Initial source-only release including the PowerShellTunnel assembly &amp;#40;PowerShellTunnel.dll&amp;#41; and an example application host &amp;#40;PowerShellTunnel.Embeddable.Example.exe&amp;#41;.</description><author></author><pubDate>Mon, 03 Mar 2008 07:29:10 GMT</pubDate><guid isPermaLink="false">CREATED RELEASE: PowerShellTunnel - Initial Release (Source) (Mar 02, 2008) 20080303A</guid></item><item><title>UPDATED WIKI: PowerShellTunnel Considerations</title><link>http://code.msdn.microsoft.com/PowerShellTunnel/Wiki/View.aspx?title=PowerShellTunnel Considerations&amp;version=14</link><description>&lt;div class="wikidoc"&gt;
&lt;h1&gt;
PowerShellTunnel - Considerations
&lt;/h1&gt; &lt;br /&gt;&lt;b&gt;A)&lt;/b&gt; If you don't want to connect to an existing embedded runspace but instead want to remote-connect to new PowerShell 'consoles' on remote clients, refer instead to PowerShell 2.0 or the &amp;quot;PowerShell Remoting&amp;quot; project.  PowerShellTunnel is designed for connecting to an existing console or runspace.&lt;br /&gt; &lt;br /&gt;&lt;b&gt;B)&lt;/b&gt; The &lt;a href="http://thepowershellguy.com/blogs/posh/pages/powertab.aspx" class="externalLink"&gt;PowerTab&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; project could make tab expansion integration cleaner.&lt;br /&gt; &lt;br /&gt;&lt;b&gt;C)&lt;/b&gt; Serialization: PowerShellTunnel uses ordinary serialization by serialized pipied input or output objects to a stream and sending a raw byte array to and from the tunnel host.  If the class is not serializable then just the type name will be sent.  PowerShellTunnel does not use WCF data contract serialization for the piped objects themselves.&lt;br /&gt; &lt;br /&gt;&lt;b&gt;D)&lt;/b&gt; TODO: Add 'help', 'verbose', functionality to cmdlets.&lt;br /&gt; &lt;br /&gt;&lt;b&gt;E)&lt;/b&gt; Security Warning: once connected to the tunnel host, the tunnel has access to all of the tunnel hosts exposed objects and functionality.&lt;br /&gt; &lt;br /&gt;&lt;b&gt;F)&lt;/b&gt; Multiple hosts/clients: You can create multiple tunnel hosts and multiple tunnels, e.g. a host may be accessed by multiple clients.  A client may use multiple tunnels (to different hosts) and use: &amp;quot;select-tunnel&amp;quot; to switch between them or use the &amp;quot;-tunnel&amp;quot; parameter of &amp;quot;invoke-tunnel&amp;quot;.&lt;br /&gt; &lt;br /&gt;&lt;b&gt;G)&lt;/b&gt; Threading: Be aware of threading considerations given that the tunnel host executes on a WCF worker thread (e.g. on a .NET Thread Pool thread).&lt;br /&gt; &lt;br /&gt;&lt;b&gt;H)&lt;/b&gt; No Ctrl-C?  If you invoke-tunnel a script, Ctrl-C from the client does not interrupt it, so beware of infinite loops or long operations.&lt;br /&gt; &lt;br /&gt;&lt;b&gt;I)&lt;/b&gt; After 'select-tunnel' (or add-tunnel without the -noselect switch), tab expansion is intercepted to to tab expansion on the tunnel host.  This is useful when typing the script block of the invoke-tunnel but not especially elsewhere.  Use select-tunnel without a parameter to turn off the tab expansion interception (and requires invoke-tunnel to specify a '-tunnel xyz' parameter).&lt;br /&gt; &lt;br /&gt;&lt;b&gt;J)&lt;/b&gt; There might be ways to streamline the user syntax/experience further.  In the meanwhile, consider using an alias to Invoke-Tunnel, e.g.&lt;br /&gt;&lt;span class="codeInline"&gt;Set-Alias T Invoke-Tunnel&lt;/span&gt;&lt;br /&gt;&lt;span class="codeInline"&gt;Set-Alias TP Invoke-Tunnel -pipeoutput&lt;/span&gt;&lt;br /&gt;or&lt;br /&gt;&lt;span class="codeInline"&gt;function T1 { Invoke-Tunnel -tunnel $mytunnel1 $args} &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;</description><author>MatHobbs</author><pubDate>Mon, 03 Mar 2008 07:13:25 GMT</pubDate><guid isPermaLink="false">UPDATED WIKI: PowerShellTunnel Considerations 20080303A</guid></item><item><title>UPDATED WIKI: PowerShellTunnel Considerations</title><link>http://code.msdn.microsoft.com/PowerShellTunnel/Wiki/View.aspx?title=PowerShellTunnel Considerations&amp;version=13</link><description>&lt;div class="wikidoc"&gt;
&lt;h1&gt;
PowerShellTunnel - Considerations
&lt;/h1&gt; &lt;br /&gt;&lt;b&gt;A)&lt;/b&gt; If you don't want to connect to an existing embedded runspace but instead want to remote-connect to new PowerShell 'consoles' on remote clients, refer instead to PowerShell 2.0 or the &amp;quot;PowerShell Remoting&amp;quot; project.  PowerShellTunnel is designed for connecting to an existing console or runspace.&lt;br /&gt; &lt;br /&gt;&lt;b&gt;B)&lt;/b&gt; The &lt;a href="http://thepowershellguy.com/blogs/posh/pages/powertab.aspx" class="externalLink"&gt;PowerTab&lt;span class="externalLinkIcon"&gt;&lt;/span&gt;&lt;/a&gt; project could make tab expansion integration cleaner.&lt;br /&gt; &lt;br /&gt;&lt;b&gt;C)&lt;/b&gt; Serialization: PowerShellTunnel uses ordinary serialization by serialized pipied input or output objects to a stream and sending a raw byte array to and from the tunnel host.  If the class is not serializable then just the type name will be sent.  PowerShellTunnel does not use WCF data contract serialization for the piped objects themselves.&lt;br /&gt; &lt;br /&gt;&lt;b&gt;D)&lt;/b&gt; TODO: Add 'help', 'verbose', functionality to cmdlets.&lt;br /&gt; &lt;br /&gt;&lt;b&gt;E)&lt;/b&gt; Security Warning: once connected to the tunnel host, the tunnel has access to all of the tunnel hosts exposed objects and functionality.&lt;br /&gt; &lt;br /&gt;&lt;b&gt;F)&lt;/b&gt; Multiple hosts/clients: You can create multiple tunnel hosts and multiple tunnels, e.g. a host may be accessed by multiple clients.  A client may use multiple tunnels (to different hosts) and use: &amp;quot;select-tunnel&amp;quot; to switch between them or use the &amp;quot;-tunnel&amp;quot; parameter of &amp;quot;invoke-tunnel&amp;quot;.&lt;br /&gt; &lt;br /&gt;&lt;b&gt;G)&lt;/b&gt; Threading: Be aware of threading considerations given that the tunnel host executes on a WCF worker thread (e.g. on a .NET Thread Pool thread).&lt;br /&gt; &lt;br /&gt;&lt;b&gt;H)&lt;/b&gt; No Ctrl-C?  If you invoke-tunnel a script, Ctrl-C from the client does not interrupt it, so beware of infinite loops or long operations.&lt;br /&gt; &lt;br /&gt;&lt;b&gt;I)&lt;/b&gt; After 'select-tunnel' (or add-tunnel without the -noselect switch), tab expansion is intercepted to to tab expansion on the tunnel host.  This is useful when typing the script block of the invoke-tunnel but not especially elsewhere.  Use select-tunnel without a parameter to turn off the tab expansion interception (and requires invoke-tunnel to specify a '-tunnel xyz' parameter).&lt;br /&gt; &lt;br /&gt;&lt;b&gt;J)&lt;/b&gt; There might be ways to streamline the user syntax/experience further.  In the meanwhile, consider using an alias to Invoke-Tunnel, e.g.&lt;br /&gt;&lt;span class="codeInline"&gt;Set-Alias T Invoke-Tunnel&lt;/span&gt;&lt;br /&gt;or&lt;br /&gt;&lt;span class="codeInline"&gt;function T1 { Invoke-Tunnel -tunnel $mytunnel1 $args} &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;</description><author>MatHobbs</author><pubDate>Mon, 03 Mar 2008 07:10:50 GMT</pubDate><guid isPermaLink="false">UPDATED WIKI: PowerShellTunnel Considerations 20080303A</guid></item></channel></rss>