# Saturday, March 28, 2009

After some hints from Ibrahim on the Microsoft PowerShell team, I realised it was possible to rewrite the dynamic module body generation from the Get-Interface function in my last post without using string literals and nested here-string tricks. I was able to increase the brevity by using a new [to PowerShell] v2 feature called “Closures.” Ibrahim talks a bit about the technique over on the official PowerShell Blog. It’s a common feature in so-called Functional languages and there are plenty of other tidbits to read about it, both academic and practical if you search online.

A closure in PowerShell, in short, lets you take a snapshot of a ScriptBlock by calling its GetNewClosure() method. The snapshot is taken of its variables and will let you pass it around so it is no longer directly tied to the particular scope chain it was declared in. As some are fond of saying though, Thar Be Dragons. Although closing around a ScriptBlock will make copies of the PSVariables that are within, it is still subject to the whims of .NET – particularly ByRef and ByValue semantics. If a ScriptBlock contains a PSVariable pointing to an integer, it’s safe to say that integer will be copied and is frozen as that value as long as you remain within the domain of the current SessionState context (more about this later).

.NET intervenes: ByRef and ByVal

Closing around a ScriptBlock that contains PSVariables that point to reference types, however - like Arrays for example – will only duplicate the reference, not the instance itself. If elements in the array are changed via the PSVariable from the originating scope, the corresponding array element in the closure will also change. After all – you got a copy of the pointer, not the value itself. This is the very essence of ByRef and ByVal.

Let’s take a look at the revised Get-Interface script:

function Get-Interface {

#.Synopsis
#   Allows PowerShell to call specific interface implementations on any .NET object. 
#.Description
#   Allows PowerShell to call specific interface implementations on any .NET object. 
#
#   As of v2.0, PowerShell cannot cast .NET instances to a particular interface. This makes it
#   impossible (shy of reflection) to call methods on explicitly implemented interfaces.   
#.Parameter Object
#   An instance of a .NET class from which you want to get a reference to a particular interface it defines.
#.Parameter InterfaceType
#   An interface type, e.g. [idisposable], implemented by the target object.
#.Example
#   // a class with explicitly implemented interface   
#   public class MyObj : IDisposable {
#      void IDisposable.Dispose()
#   }
#   
#   ps> $o = new-object MyObj
#   ps> $i = get-interface $o ([idisposable])
#   ps> $i.Dispose()      
#.ReturnValue
#   A PSCustomObject with ScriptMethods and ScriptProperties representing methods and properties on the target interface.
#.Notes
# AUTHOR:    Oisin Grehan http://www.nivot.org/
# LASTEDIT:  2009-03-28 18:37:23
# REVISION:  0.2

    [CmdletBinding()]
    param(
        [ValidateNotNull()]
        $Object,
        
        [ValidateScript( { $_.IsInterface } )]
        [type]$InterfaceType
    )

    $script:t  = $Object.GetType()
    
    try {
        
        $script:m  = $t.GetInterfaceMap($InterfaceType)

    } catch [argumentexception] {
        
        throw "Interface $($InterfaceType.Name) not found on ${t}!"
    }

    $script:im = $m.InterfaceMethods
    $script:tm = $m.TargetMethods
    
    # TODO: use param blocks in functions instead of $args
    #       so method signatures are visible via get-member
    
    $body = {
         param($o, $i) 
         
         $script:t  = $o.GetType()
         $script:m  = $t.GetInterfaceMap($i)
         $script:im = $m.InterfaceMethods
         $script:tm = $m.TargetMethods
                  
         for ($ix = 0; $ix -lt $im.Count; $ix++) {
            
            $mb = $im[$ix]

            # for the function body, we close over $ix to capture the index
            # so even on the next iteration of this loop, the $ix value will
            # be frozen within the function's scriptblock body
            set-item -path function:script:$($mb.Name) -value {

                # call corresponding target method
                $tm[$ix].Invoke($o, $args)

            }.GetNewClosure() -verbose -force

            if (!$mb.IsSpecialName) {
                # only export the function if it is not a getter or setter.
                Export-ModuleMember $mb.Name -verbose
            }
         }
    }

    write-verbose $body.tostring()    
    
    # create dynamic module
    $module = new-module -ScriptBlock $body -Args $Object, $InterfaceType -Verbose
    
    # generate method proxies - all exported members become scriptmethods
    # however, we are careful not to export getters and setters.
    $custom = $module.AsCustomObject()
    
    # add property proxies - need to use scriptproperties here.
    # modules cannot expose true properties, only variables and 
    # we cannot intercept variables get/set.
    
    $InterfaceType.GetProperties() | % {

        $propName = $_.Name
        $getter   = $null
        $setter   = $null
       
        if ($_.CanRead) {
            
            # where is the getter methodinfo on the interface map?
            $ix = [array]::indexof($im, $_.GetGetMethod())
            
            # bind the getter scriptblock to our module's scope
            # and generate script to call target method
            #
            # NOTE: we cannot use a closure here because sessionstate
            #       is rebound to the module's, and $ix would be lost
            $getter = $module.NewBoundScriptBlock(
                [scriptblock]::create("`$tm[{0}].Invoke(`$o, @())" -f $ix))
        }
        
        if ($_.CanWrite) {
            
            # where is the setter methodinfo on the interface map?
            $ix = [array]::indexof($im, $_.GetSetMethod())
            
            # bind the setter scriptblock to our module's scope
            # and generate script to call target method
            #
            # NOTE: we cannot use a closure here because sessionstate
            #       is rebound to the module's, and $ix would be lost
            $setter = $module.NewBoundScriptBlock(
                [scriptblock]::create(
                    "param(`$value); `$tm[{0}].Invoke(`$o, `$value)" -f $ix))
        }
        
        # add our property to the pscustomobject
        $prop = new-object management.automation.psscriptproperty $propName, $getter, $setter
        $custom.psobject.properties.add($prop)
    }
    
    # insert the interface name at the head of the typename chain (for get-member info)
    $custom.psobject.TypeNames.Insert(0, $InterfaceType.FullName)
    
    # dump our pscustomobject to pipeline
    $custom
}

The changes are around line 56, where I now declare $body with a script syntax, no longer using [scriptblock]::create. Where previously I used a subexpression inside a here-string to general literal function declarations, I now use a “for” loop and set-item to create the functions (thanks Ibrahim!). You can see that I am calling GetNewClosure() on the function body each time I create a new function. This “captures” the value of the $ix index variable, so that the value will not change on subsequent loops. If I did not use closures, when the for loop ended, all of the functions would be using the same terminating value of the loop for $ix, which would be $im.count + 1. Doh.

Module SessionState Context, Wha?

So if I ripped out that literal string parsing stuff for the module $body, why am I still using it for the property getter/setter generation? (lines 115 / 130)  Well, I have no choice: Creating a new module creates an entirely new SessionState; in simple terms, session state is essentially a giant Hashtable in which PSVariables are stored. If I closed over those get/set ScriptBlocks containing the $ix PSVariable, when it is bound to the module it will use the new module’s SessionState – which is empty! The value of $ix would be undefined. The other variables in those strings are escaped, because they will be evaluated in the module’s context later, when the getters and setters are invoked. Those variables are seeded by the module’s initialization done at the new-module call at line 88.

It’s all very succinct, but rest assured, very powerful.

Have fun!

NOTE: I realise that some more refactoring could probably eliminate this script parsing, but the value is in understanding how modules may affect usage of closures, and the problems that may occur.

posted on Saturday, March 28, 2009 6:23:11 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0] Trackback
Related posts:
PowerShell Script Provider
PowerShell ISE Hacking: Change default save encoding to ASCII
PowerShell 2.0 – PSCX Labs: Invoke-Reflector
PowerShell 2.0 – Developer Essentials #1 – Initializing a Runspace with a Module
SharePoint Resources & Localization – What, Where and Why?
PowerShell 2.0 – Partial Application of Functions and Cmdlets

Referred by:
http://blogs.msdn.com/powershell/archive/2009/03/27/get-clos... [Referral]
http://twitturls.com/ [Referral]
http://twitter.com/home [Referral]
http://www.google.com/reader/view/ [Referral]
http://powershellcommunity.org/blogs/externalblogs.aspx [Referral]
http://www.powershellcommunity.org/Blogs/ExternalBlogs.aspx [Referral]
http://www.google.co.uk/reader/view/?hl=en&tab=wy [Referral]
PowerShell (blogsearch.google.co.jp) [Referral]
http://webemail.telenet.be/cgi-bin/inbox.exe?id=@ID@&fld=HF6... [Referral]
http://us.mg1.mail.yahoo.com/dc/launch?.partner=sbc&.gx=1&.r... [Referral]
http://www.google.com/ [Referral]
powershell (blogsearch.google.com) [Referral]
http://pipes.yahoo.com/pipes/pipe.info?_id=uAmYy9xq3BGHcV361... [Referral]
http://search.twitter.com/search?ands=powershell&from=oising [Referral]
http://powertwitter.me/ [Referral]
http://www.tweetgrid.com/grid?l=5 [Referral]
powershell (search.twitter.com) [Referral]
http://mail.google.com/mail/?ui=2&view=bsp&ver=1qygpcgurkovy [Referral]
http://35.gmodules.com/ig/ifr?url=http://1o4.jp/google/modul... [Referral]
http://blog.usepowershell.com/ [Referral]
powershell (search.live.com) [Referral]
ScriptBlock.Create powershell (www.google.com) [Referral]
powershell modules in practice (www.google.com) [Referral]
http://pipes.yahoo.com/pipes/pipe.info?_id=d16957ab499cae0a1... [Referral]
powershell 2.0 ctp3 modules (www.google.com) [Referral]
PowerShell CTP 3 String array (www.google.com) [Referral]
PowerShell 2.0 (www.google.ch) [Referral]
powershell call method with variable (www.google.com) [Referral]
powershell v2 closure (www.google.com) [Referral]
dynamic functions in powershell (www.google.com.sg) [Referral]
powershell 2.0 dynamic types (www.google.com) [Referral]
powershell 2.0 ctp3 (www.google.ca) [Referral]
powershell practice (www.google.com) [Referral]
powershell dynamically call function (www.google.com) [Referral]
http://pauerschell.blogspot.com/ [Referral]
http://stackoverflow.com/questions/746014/how-can-i-call-exp... [Referral]
http://stackoverflow.com/questions/745956/how-can-i-dispose-... [Referral]
CTP 3 powershell add module (www.google.com) [Referral]
powershell new-module (www.google.com) [Referral]
list modules powershell 2.0 (www.google.dk) [Referral]
http://stackoverflow.com/questions/746014/how-can-i-call-exp... [Referral]
"powershell 2.0" module (www.google.com) [Referral]
powershell the array index evaluated to null (www.google.co.nz) [Referral]
powershell 2.0 release date (www.google.com) [Referral]
powershell v2.0 (www.google.com) [Referral]
powershell 2.0 (www.google.com) [Referral]
"Powershell 2.0" (www.google.com) [Referral]
insert varible into powershell scriptblock (www.google.com) [Referral]
http://stackoverflow.com/questions/746014/how-can-i-call-exp... [Referral]
powershell add note properties to pscustomobject array (www.google.com) [Referral]
powershell closure (www.google.com) [Referral]
powershell 2.0 modules (www.google.ru) [Referral]
powershell call indexof string (www.google.com) [Referral]
powershell dynamic functions (www.google.com) [Referral]
google powershell 2.0 (www.google.com) [Referral]
ctp3 modules (www.google.com) [Referral]
Windows Live - PowerShell Modules (www.google.com) [Referral]
Powershell modules new-module (www.kumo.com) [Referral]
create custom Module which integrate with powershell (www.google.com) [Referral]
powershell ctp3 modules (www.google.com) [Referral]
Powershell CTP3 Modules (www.google.com) [Referral]
powershell closure (www.google.com) [Referral]
powershell 2.0 ctp 3 (www.google.com) [Referral]
creating modules in powershell (www.google.co.in) [Referral]
pass scriptblock to new-module (www.google.ch) [Referral]
powershell ctp 3 (www.google.com) [Referral]
http://snipr.com/ercx2 [Referral]
pscustomobject get specific property (www.google.com) [Referral]
powershell 2.0 modules (www.google.ch) [Referral]
Powershell 2 CTP 3 get the name of the current function (www.google.com) [Referral]
powershell IndexOf (search.live.com) [Referral]
powershell ctp3 (www.google.com) [Referral]
powershell add-module ctp3 (www.google.com) [Referral]
powershell module's session state (www.google.com) [Referral]
powershell getnewclosure -"get closure" (www.google.com) [Referral]
powershell v2.0 release date (www.google.ca) [Referral]
powershell ctp3 add-module (www.google.pl) [Referral]
PowerShell xml item Cannot index into a null array (www.google.fr) [Referral]
powershell bind variable to a script block (www.google.com) [Referral]
powershell byref function (www.kumo.com) [Referral]
inbox.items properties and methods powershell (www.google.com) [Referral]
windows powershell ctp3 add-module (www.google.com) [Referral]
powershell 2.0 function (www.google.co.uk) [Referral]
powershell indexof (search.live.com) [Referral]
Powershell dynamically call a variable (www.google.com) [Referral]
powershell closures (www.google.com) [Referral]
PowerShell in Practice (www.google.com) [Referral]
powershell Cannot index into a null array (www.google.com) [Referral]
search for powershell modules (www.google.ie) [Referral]
powershell call module method (www.google.com) [Referral]
powershell 2.0 module (www.google.com) [Referral]
powershell 2.0 ctp 3.0 (www.bing.com) [Referral]
powershell get functions body (www.google.at) [Referral]
powershell 2.0 ctp3 modules (www.google.com) [Referral]
powershell 2.0 ctp3 modules path (www.google.com) [Referral]
creating a Powershell 2.0 module (www.bing.com) [Referral]
powershell 2.0 changes (www.google.com) [Referral]
powershell CTP 3 changes (www.google.com) [Referral]
wwwgoogle.com.co closeres (www.google.es) [Referral]
RSS 2.0 modules (www.google.com) [Referral]
powershell "module initialization" (www.google.com) [Referral]
PowerShell 2.0 modules (www.google.com) [Referral]
create powershell module (www.bing.com) [Referral]
create dynamic script block in powershell (www.google.lk) [Referral]
powershell create module (www.google.nl) [Referral]
Powershell dynamically call method on object (www.bing.com) [Referral]
powershell .GetType().GetInterfaces() (www.google.com) [Referral]
PowerShell 2.0 module (www.google.com) [Referral]
powershell module initialize (www.google.nl) [Referral]
powershell New-Module { (www.google.nl) [Referral]
powershell 2.0 release date (www.google.com) [Referral]
powershell indexof (www.google.be) [Referral]
powershell closure (www.google.com) [Referral]
powershell create modules (www.google.nl) [Referral]
powershell 2.0 release date (www.google.com) [Referral]
powershell indexof (www.google.com) [Referral]
powershell module initialize (www.google.com) [Referral]
powershell 2.0 ctp 3 learn (www.google.com) [Referral]
powershell closures (www.google.com) [Referral]
call iexplore www.google.com (www.google.pt) [Referral]
powershell "the array index evaluated to null" (www.google.com) [Referral]
powershell indexof (www.google.com) [Referral]
"cannot index into a null array" (www.google.com) [Referral]
http://stackoverflow.com/questions/745956/how-can-i-dispose-... [Referral]
powershell cannot index into a null array (www.google.co.uk) [Referral]
powershell module context (www.google.cz) [Referral]
powershell dynamically export module functions (www.bing.com) [Referral]
add-module CTP3 (www.google.com) [Referral]
powershell dynamic module (www.google.com) [Referral]
the index array evaluated to null powershell (www.google.co.uk) [Referral]
powershell dynamic create "script block" (www.google.com) [Referral]
for loop string powershell (www.google.com) [Referral]
$Script variable powershell ctp3 (www.google.com) [Referral]
how to add module powershell v2 (www.bing.com) [Referral]
Powershell 2.0 release (www.google.com) [Referral]
powershell indexof (www.google.com) [Referral]
powershell 2.0 release date 2009 (www.google.com) [Referral]
Powershell array Cannot index into a null array. (translate.google.ca) [Referral]
powershell ctp3 modules (www.google.com) [Referral]
add-module ctp3 (www.google.com) [Referral]
powershell cannot index into null array (www.google.co.uk) [Referral]
add-module powershell (www.google.com) [Referral]
powershell New-Module (www.google.com) [Referral]
powershell 2.0 "release date" (www.google.com) [Referral]
SessionState powershell (www.google.com) [Referral]
powershell 2.0 array (www.google.com) [Referral]
powershell ctp3 modules (www.google.com) [Referral]
powershell 2.0 release date (www.google.com) [Referral]
GetNewClosure (www.google.co.jp) [Referral]
"powershell 2" try catch (www.google.de) [Referral]
powershell modules CTP3 (www.google.com) [Referral]
"cannot index into null array" (www.google.com) [Referral]
create powershell module (www.google.com) [Referral]
powershell scriptblocks (www.google.com) [Referral]
powershell Cannot index into a null array. (www.google.com) [Referral]
POwerShell 2.0 release date (www.google.com) [Referral]
powershell call modules (www.google.com) [Referral]
closure ibrahim (www.google.com) [Referral]
powershell dynamic script method (www.google.com) [Referral]
Add-module powershell v2 CTP3 (www.google.fr) [Referral]
CTP3 add-module (www.google.fr) [Referral]
"Cannot index into a null array" +powershell (www.google.com) [Referral]
PSCustomObject dump properties (www.google.com) [Referral]
powershell new-module (www.google.com) [Referral]
powershell v2.0 example objects (www.google.nl) [Referral]
powershell scriptproperty refactor (www.google.com.au) [Referral]
"Cannot index into a null array." & powershell & bing (www.google.de) [Referral]
Powershell "cannot index into a null array" (www.bing.com) [Referral]
powershell scriptblock pass variables (www.google.com) [Referral]
powershell 2.0 release date (www.google.com) [Referral]
powershell release date (www.google.com) [Referral]
powershell the array index evaluated to null. (www.google.com) [Referral]
powershell 2.0 ctp 3 examples (www.google.com) [Referral]
powershell 2.0 release date (www.google.com) [Referral]
powershell 2.0 modules (www.google.com) [Referral]
powershell cannot index into a null array (www.bing.com) [Referral]
"cannot index into a null array" (www.bing.com) [Referral]
powershell (www.bing.com) [Referral]
"cannot index into a null array" $args (www.google.com) [Referral]
http://www.google.com/reader/view/?tab=my [Referral]
indexof powershell (www.google.com) [Referral]
creating a script module +powershell (www.google.co.uk) [Referral]
powershell indexof (www.google.com) [Referral]
release-ref powershell (www.google.com) [Referral]
Powershell "Cannot index into a null array." (www.bing.com) [Referral]
invoke scriptblock pscustomobject (www.google.nl) [Referral]
invoke scriptblock value pscustomobject (www.google.nl) [Referral]
powershell closures (www.google.com) [Referral]
powershell closure (www.google.com) [Referral]
powershell export function and its scriptmethod (www.google.com.hk) [Referral]
powershell 2.0 modules visual studio (www.google.com) [Referral]
powershell 2.0 release date (www.google.com) [Referral]
+"powershell 2" "new-object" (www.bing.com) [Referral]
powershell modules exported variables scopes (www.google.se) [Referral]
Dynamically generating scriptblocks powershell (www.google.com) [Referral]
powershell 2.0 module (search.conduit.com) [Referral]
powershell dynamic generate function (www.bing.com) [Referral]
powershell 2.0 module (www.google.com) [Referral]
"cannot index into a null array" powershell (www.google.com) [Referral]
powershell cannot index into a null array (www.google.com) [Referral]
powershell closure function (www.google.fr) [Referral]
powershell call dynamic function (www.google.com) [Referral]
powershell module function script help .note (www.google.com) [Referral]
powershell >null (www.google.nl) [Referral]
Powershell byref (www.bing.com) [Referral]
powershell 2.0 loop (www.google.com) [Referral]
powershell 2.0 try catch (www.google.co.in) [Referral]
"Cannot index into a null array." powershell (www.bing.com) [Referral]
powershell null array (www.bing.com) [Referral]
powershell .body -match (www.bing.com) [Referral]
getinterfacemap The current Type represents an interface (www.google.co.il) [Referral]
CTP3 Session State Provider (www.google.com.au) [Referral]
powershell cannot index into null array (www.google.fr) [Referral]
closure powershell (www.google.ch) [Referral]
powershell initialise map (www.google.co.uk) [Referral]
Powershell not exporting array values (www.google.com) [Referral]
powershell 2.0 (www.bing.com) [Referral]
powershell 2 release date (www.bing.com) [Referral]
powershell get dynamic property value (www.google.com) [Referral]
Powershell Newclosure (www.google.co.jp) [Referral]
powershell 2.0 release date (www.google.com) [Referral]
powershell version 2 interface (www.google.com) [Referral]
powershell 2.0 module (www.google.com) [Referral]
powershell closure (www.google.com) [Referral]
http://www.outertech.com/ [Referral]
powershell try catch array next (www.google.be) [Referral]
POWERSHELL Cannot index into a null array (www.google.com) [Referral]
powershell create modules (www.google.com) [Referral]
powershell 2.0 release date (www.google.com) [Referral]
powershell v2 try catch (www.google.com) [Referral]
assigning variables in scriptblock powershell 2.0 (www.google.com) [Referral]
powershell 2.0 final release date (www.google.kz) [Referral]
PowerShell 2.0 modules (www.bing.com) [Referral]
powershell modules scope (www.bing.com) [Referral]
powershell try catch v2 ArgumentException (www.google.com) [Referral]
closure powershell (www.google.com) [Referral]
powershell 2.0 modules (www.google.co.uk) [Referral]
resolve variable scriptblock powershell (www.google.com) [Referral]
powershell the array index evaluated to null (www.bing.com) [Referral]
powershell dynamic function call (www.google.ie) [Referral]
indexof powershell (www.google.com) [Referral]
"Cannot index into a null array." args (www.bing.com) [Referral]
powershell add-property (www.google.com) [Referral]
powershell "cannot index into null array" (www.google.com) [Referral]
http://snipr.com/site/404checker [Referral]
array storing pscustomobject (www.google.pl) [Referral]
powershell ctp 3 set-property (www.google.ch) [Referral]
powershell 2.0 release date (www.google.com) [Referral]
powershell closures (www.google.com) [Referral]
powershell 2.0 release date (www.google.com) [Referral]
Cannot index into a null array. (search.yahoo.com) [Referral]
powershell + "Index into null" (www.google.co.in) [Referral]
powershell cannot index into a null array (www.bing.com) [Referral]
powershell modules changes in ctp3 (www.google.com) [Referral]
pass array of strings in a powershell script (www.bing.com) [Referral]
powershell scriptblock pass variable (www.bing.com) [Referral]
powershell pass by value byval (www.bing.com) [Referral]
array index evalued to null powershell (www.google.com) [Referral]
+powershell +ctp3 +try +catch (www.google.de) [Referral]
powershell byref (www.google.com) [Referral]
IDisposable Closures (www.bing.com) [Referral]
powershell array Cannot index into a null array. get-event (www.bing.com) [Referral]
powershell 2.0 release date (www.google.com) [Referral]
powershell dynamic feature (www.google.com) [Referral]
powershell array "Cannot index into a null array" (www.google.de) [Referral]
bing map powershell (www.google.com) [Referral]
+powershell 2 +add-module (www.google.com) [Referral]
powershell 2.0 try catch (www.google.com) [Referral]
powershell v2.0 (www.google.co.uk) [Referral]
powershell 2.0 release (www.google.com) [Referral]
powershell v2 CTP3 modules (www.google.com) [Referral]
try/catch powershell 2.0 (www.google.com) [Referral]
+powershell +try (www.bing.com) [Referral]
powershell v2.0 module initialization (www.google.com.eg) [Referral]
"new-object" dynamic array Powershell (www.bing.com) [Referral]
powershell try V2 catch (www.bing.com) [Referral]
http://stackoverflow.com/questions/1637999/com-interface-wra... [Referral]
pscustomobject copy (www.google.com) [Referral]
powershell module sessionstate (www.google.co.uk) [Referral]
Powershell Loop scripts (www.google.com) [Referral]
powershell 2.0 release date (www.google.com) [Referral]
powershell closures (www.google.com) [Referral]
powershell closure (www.bing.com) [Referral]
powershell closures (www.google.com) [Referral]
index into null array powershell (www.google.co.uk) [Referral]
powershell call module methods (www.google.com) [Referral]
+powershell ".returnvalue" (www.bing.com) [Referral]
powershell v2 variable scope (www.google.com) [Referral]
powershell in practice (www.bing.com) [Referral]
"visual studio" powershell 2 modules (www.google.com) [Referral]
powershell 2.0 catch try (www.google.com.au) [Referral]
Cannot index into a null array. powershell sharepoint (www.google.com) [Referral]
powershell create dynamic module (www.google.com) [Referral]
powershell try catch 2.0 (www.google.com) [Referral]
powershell 2.0 release date (www.bing.com) [Referral]
powershell 2.0 release date (www.google.com) [Referral]
powershell 2.0 release date (www.google.com) [Referral]
powershell indexof (www.google.com) [Referral]
powershell create dynamic script block (www.google.ch) [Referral]
create powershell module (www.google.co.uk) [Referral]
powershell cannot index a null array (www.google.no) [Referral]
powershell closure (www.google.com) [Referral]
how to pass an array to a function in powershell (www.google.com) [Referral]
powershell duplicate pscustomobject (www.google.com) [Referral]
closures in powershell (www.google.com.do) [Referral]
powershell v2 array int contains (www.google.com) [Referral]
powershell v2 try catch (www.google.com.au) [Referral]
powershell v2 scriptblock closure (www.google.com.au) [Referral]
Windows PowerShell(TM) V2 (CTP3 (www.google.it) [Referral]
Windows PowerShell(TM) V2 (CTP3): (www.google.com) [Referral]
powershell "create scripblock " (www.google.de) [Referral]
powershell 2 ctp3 samples (www.google.ru) [Referral]
powershell 2.0 create modules (www.google.nl) [Referral]
powershell calling getter setters (www.google.com) [Referral]
PowerShell(TM) V2 (CTP3) (www.google.es) [Referral]
powershell 2.0 try catch (www.google.com) [Referral]
powershell closure (www.google.com) [Referral]
powershell closure ScriptProperties (www.google.com) [Referral]
PScustomObject pipeline invoke (www.google.co.th) [Referral]
powershell 2.0 looping (www.google.com) [Referral]
powershell closures (www.google.com) [Referral]
powershell 2.0 release date (www.google.com) [Referral]
powershell try catch nested (www.google.com) [Referral]
Windows PowerShell TM V2 CTP3 (www.google.com) [Referral]
powershell 2.0 ctp 3 (www.bing.com) [Referral]
powershell 2.0 try catch (www.google.de) [Referral]
PowerShell script closure (www.google.com) [Referral]
http://stackoverflow.com/questions/1831955/powershell-an-ele... [Referral]
initialize module powershell (www.google.cz) [Referral]
Windows PowerShell(TM) V2 (CTP3) (www.google.co.il) [Referral]
powershell modules initialization (www.google.cz) [Referral]
powershell byval byref (www.google.com) [Referral]
powershell closure (www.google.com) [Referral]
powershell 2.0 try catch (www.google.co.uk) [Referral]
powershell modules initialization (www.google.be) [Referral]
powershell 2.0 try catch (www.google.co.uk) [Referral]
"powershell" "closures" (www.google.com) [Referral]
create a powershell 2.0 module (www.google.com) [Referral]
powershell closure (www.google.de) [Referral]
powershell closure (www.google.se) [Referral]
powershell "Cannot index into a null array." (www.bing.com) [Referral]
powershell pass array to a function (www.bing.com) [Referral]
arrays in powershell 2.0 (www.google.com) [Referral]
powershell closure (www.google.com) [Referral]
scriptblock create powershell (www.google.com) [Referral]
powershell 2.0 arrays (www.google.se) [Referral]
powershell closures (www.google.com) [Referral]
powershell "array index evaluated to null" (www.bing.com) [Referral]
pass scriptblock in variable (www.bing.com) [Referral]
powershell passing reference to array (www.google.com) [Referral]
powershell pass array (www.bing.com) [Referral]
Windows PowerShell TM V2 CTP3 (www.google.com) [Referral]
PowerShell nested here strings (www.google.com) [Referral]
powershell netsted here strings (www.google.com) [Referral]
create powershell modules (www.google.de) [Referral]
custom module powershell (www.bing.com) [Referral]
powershell module list functions (www.bing.com) [Referral]
powershell array index (www.google.ru) [Referral]
Add-Module CTP3 (www.google.com) [Referral]
dynamic modules powershell (www.google.com) [Referral]
Windows PowerShell(TM) V2 (CTP3) (www.google.co.th) [Referral]
powershell 2.0 try catch (www.google.fr) [Referral]
scriptproperty scriptmethod powershell module scope (www.google.com.au) [Referral]
powershell "dynamicproperty (www.google.com) [Referral]
powershell module interface (www.bing.com) [Referral]
powershell module initialization (www.google.com) [Referral]
how to use try catch in powershell v2.0 (www.google.com) [Referral]
powershell 2.0 array declaration (www.google.com) [Referral]
pass variable into a script block in powershell (www.google.com) [Referral]
powershell modules + invoke + Properties (www.google.co.uk) [Referral]
powershell 2.0 try catch usage scope (www.google.co.uk) [Referral]
Windows PowerShell(TM) V2 (CTP3 (www.google.nl) [Referral]
powershell arrays lists "2.0" (www.google.dk) [Referral]
powershell dynamic scope (www.google.com) [Referral]
powershell ctp3 module scope (www.bing.com) [Referral]
powershell scriptblock dynamic (www.google.com) [Referral]
powershell closure (www.google.com) [Referral]
SharePoint Powershell passing variables null array (www.bing.com) [Referral]
PowerShell closures (www.google.com) [Referral]
WSS RootFolder.Update cannot index into a null array (www.bing.com) [Referral]
"cannot index into null array" (www.google.com) [Referral]
sharepoint "cannot index into null array" (www.google.com) [Referral]
powershell array index evaluated null (www.google.co.uk) [Referral]
Windows PowerShell(TM) V2 (CTP3) (www.bing.com) [Referral]
powershell get property from pscustomobject (www.google.com) [Referral]
powershell casting interface (www.google.com) [Referral]
powershell 2.0 release (www.google.de) [Referral]
duplicate pscustomobject (www.bing.com) [Referral]
powershell closures (www.google.com) [Referral]
powershell create script block bind variables (www.google.com) [Referral]
powershell no add-module (www.google.com) [Referral]
powershell array index evaluated as null (www.google.com) [Referral]
how to declare null array in powershell (www.google.com) [Referral]
scriptblock powershell example (search.yahoo.com) [Referral]
powershell null array (www.google.com) [Referral]
powershell array 2.0 (www.google.com) [Referral]
powershell indexof string (www.google.se) [Referral]
PowerShell 2.0 New-Module asCustomObject example (www.google.nl) [Referral]
powershell function cannot index null array (www.bing.com) [Referral]
powershell 2.0 get current function name (www.google.com) [Referral]
sharepoint powershell cannot index into a null array (www.google.ca) [Referral]
Windows PowerShell(TM) V2 (CTP3) (www.google.com) [Referral]
pscustomobject pass by reference (www.google.com) [Referral]
powershell 2.0 release date (www.google.ca) [Referral]
powershell array version 2 (www.google.com) [Referral]
powershell reference append array (www.google.com) [Referral]
powershell add method arrays functions (www.google.com) [Referral]
scriptblock getnewclosure (www.google.cz) [Referral]
how to initialize string array in Powershell (www.google.ca) [Referral]
pwoershell 2.0 modules (www.google.com) [Referral]
powershell scriptblock scope (www.google.com) [Referral]
powershell 2.0 array (www.google.co.uk) [Referral]
powershell $index for (www.google.com) [Referral]
pass variables in scriptblock powershell (www.google.com) [Referral]
Powershell 2.0 modules Add-Content : Cannot bind argument to parameter (www.google.com) [Referral]
powershell 2.0 CTP3 (www.google.com.hk) [Referral]
New-Module AsCustomObject powershell (www.google.se) [Referral]
powershell 2.0 catch variables (www.google.de) [Referral]
powershell generate module (www.google.com) [Referral]
cache:wutTDAzR_I0J:stackoverflow.com/questions/1637999/com-interface-wrappers-in-powershell typelib powershell (74.125.153.132) [Referral]
trycatch example powershell v2 (www.google.co.uk) [Referral]
"PowerSHell module" and script and -site:microsoft.com (www.google.cz) [Referral]
powershell dump properties (www.google.com) [Referral]
powershell 2.0 remoting pass variables into scriptblock (www.google.com) [Referral]
powershell 2.0 + Release-Ref (www.google.com) [Referral]
powershell try catch (www.google.nl) [Referral]
Cannot index into a null array powershell sharepoint (www.google.co.in) [Referral]
powershell function byref (www.google.com) [Referral]
powershell dynamic script block (www.google.com) [Referral]
powershell closures (www.bing.com) [Referral]
Dynamic array in powershell (www.google.co.in) [Referral]
powershell script block and array (www.google.com) [Referral]
Windows PowerShell(TM) V2 (CTP3) (www.google.co.kr) [Referral]
http://www.google.com/webhp?rls=ig#hl=en&rls=ig&q=powershell... [Referral]
PSVariable module variable (www.google.com) [Referral]
powershell name of the "current function" (www.google.com.au) [Referral]
powershell casting interface pointer (www.google.com) [Referral]
powershell reference psobject byval (www.google.com) [Referral]
powershell 2.0 Module (www.google.com) [Referral]
scriptblock powershell 2.0 (www.google.co.nz) [Referral]
powershell "dynamic function call" (www.google.com) [Referral]
add-module ctp3 (www.google.es) [Referral]
powershell closure pipeline (www.google.fr) [Referral]
powershell new-module ascustomobject reference this object (www.google.com) [Referral]
powershell "note properties" (www.google.com) [Referral]
powershell the array index evaluated to null. (www.google.com) [Referral]
add property to pscustomobject (www.google.com) [Referral]
calling variables loop powershell (www.google.com) [Referral]
powershell list literals (www.google.com) [Referral]
powershell modules referencing variables (www.google.co.uk) [Referral]
powershell script "array index evaluated to null" (www.google.com) [Referral]
arrays in powershell 2.0 (www.google.com) [Referral]
powershell looping through a dynamic array (www.google.com) [Referral]
powershell new-module (www.google.com) [Referral]
powershell 2.0 copy array (www.google.com) [Referral]
powershell ctp3 try catch (www.google.co.uk) [Referral]
powershell ctp3 arrays (www.google.com) [Referral]
how to powershell 2.0 add-module (www.google.com) [Referral]
powershell 2.0 array (www.google.com) [Referral]
powershell 2 (www.bing.com) [Referral]
powershell v2 append to array (www.google.com) [Referral]
powershell scriptblock reference variable (www.google.com) [Referral]
create powershell 2.0 modules (www.google.com) [Referral]
array powershell 2.0 (www.google.com) [Referral]
powershell pass hashtable "by value" (www.google.com) [Referral]
powershell get-property (www.bing.com) [Referral]
powershell passing parameters to module (www.google.com) [Referral]
scriptBlock dynamic string powershell (www.google.com) [Referral]
byval powershell (www.google.com) [Referral]
Add-Module CTP3 (www.google.com) [Referral]
powershell 2.0 scriptmethod (www.google.com) [Referral]
byref powershell (www.google.com) [Referral]
nullarray powershell (www.google.ca) [Referral]
powershell nullarray (www.google.ru) [Referral]
powershell parameter bind variable (www.google.com) [Referral]
powershell null array (www.google.com) [Referral]
PowerShell(TM) V2 (CTP3 (www.google.com.tr) [Referral]
"get-property" powershell (www.google.pl) [Referral]
powershell scriptproperty set (www.google.com) [Referral]
DECLARATIONS exp PowerSHell (www.google.co.jp) [Referral]
append string to an array in powershell v2 (www.google.ca) [Referral]
Power Shell Functions byref (www.google.com) [Referral]
powershell sessionstate (www.google.com) [Referral]
powershell arrays (www.google.pl) [Referral]
powershell using idispose (www.google.com) [Referral]
PowerShell(TM) V2 (CTP3) (www.google.com) [Referral]
powershell how to pass an array to a function (www.google.pt) [Referral]
powershell call function dynamic (www.google.at) [Referral]
GetNewClosure powershell (www.google.com) [Referral]
Windows PowerShell(TM) V2 (CTP3) (www.google.de) [Referral]
powershell array copy (search.yahoo.com) [Referral]
indexof powershell (www.google.de) [Referral]
http://www.baidu.com/s?tn=radish88_pg&wd=indexof/www.google.... [Referral]
PowerShell 2.0 create module (www.google.fr) [Referral]
powershell v2 try catch syntax (www.google.nl) [Referral]
download windows PowerShell(TM) 2.0 ctp3 (www.google.com) [Referral]
Windows PowerShell(TM) 2.0 (CTP3) (www.bing.com) [Referral]
PowerShell 2.0 Release Date (www.bing.com) [Referral]
powershell try catch nested (www.google.dk) [Referral]
powershell passing properties on pipeline (www.google.com) [Referral]
scriptblock create powershell (www.google.com) [Referral]
powershell dynamic scriptblock (www.google.com) [Referral]
powershell +asCustomObject (www.google.gr) [Referral]
scriptblock dynamic (www.google.com) [Referral]
Windows PowerShell(TM) V2 (CTP3) (www.google.co.in) [Referral]
sta je Windows PowerShell (TM) (www.google.ba) [Referral]
powershell closure (www.bing.com) [Referral]
powershell 2.0 array indexing (www.google.com) [Referral]
powershell pass array by reference (www.google.com) [Referral]
powershell closure (www.google.com) [Referral]
download Windows PowerShell(TM) V2 (CTP3) (www.google.com.eg) [Referral]
module session state NewScriptBlock (www.google.com) [Referral]
$mail.body powershell 2.0 array (www.google.com) [Referral]
Powershell: "Cannot index into a null array" (www.google.ch) [Referral]
powershell initialize dynamic array (www.google.com) [Referral]
powershell 2.0 ctp3 (www.google.com.tw) [Referral]
sharepoint listitems.add "cannot index into a null array" (www.google.co.uk) [Referral]
powershell v2 try catch (www.google.com) [Referral]
powershell Cannot bind parameter 'Snapshot' (www.google.com) [Referral]
datewww.google.ru (www.google.com) [Referral]
powershell 2.0 catch (www.google.nl) [Referral]
powershell cannot index into a null array (www.google.pl) [Referral]
powershell "list functions" (www.bing.com) [Referral]
indexing changes powershell 2.0 (www.google.com) [Referral]
wss powershell "Cannot index into a null array" (www.google.ca) [Referral]
powershell 2.0 array @ (www.google.de) [Referral]
powershell 2.0 array (www.google.de) [Referral]
powershell AddNote (www.google.com) [Referral]
PSCustomObject count elements (www.google.com) [Referral]
powershell scriptblock.create example (www.google.com) [Referral]
powershell the array index evaluated to null (www.google.com) [Referral]
powershell using verbose in custom module (www.google.com) [Referral]
powershell "release-ref" v2 (www.google.com) [Referral]
powershell decalre variable $null (www.google.com) [Referral]
powershell closures (www.google.com) [Referral]
powershell closures (www.google.com.au) [Referral]
powershell getnewclosure (www.google.com) [Referral]
getnewclosure powershell (www.google.com.do) [Referral]
powershell getnewclosure (www.google.ca) [Referral]
powershell closures (www.google.com) [Referral]
error "Cannot index into a null array." in PowerShell SharePoint (www.google.com.vn) [Referral]
dynamic scriptblock powershell (www.google.com) [Referral]
powershell closure (www.google.com) [Referral]
powershell closure invocation (www.google.fr) [Referral]
powershell arrays passing from function index (www.bing.com) [Referral]
powershell Release-Ref (www.google.ch) [Referral]
http://www.baidu.com/s?wd=wwwgoogle.com.co&tn=ylmf_4_pg&ch=4 [Referral]
the array index evaluated to null powershell (www.google.dk) [Referral]
powershell (TM)v2 ctp3 download (www.google.com) [Referral]
powershell closure (www.google.co.uk) [Referral]
+powershell +"create module" (www.google.de) [Referral]
powershell closure (www.google.com) [Referral]
powershell 2 new-module (www.bing.com) [Referral]
powershell closure (www.google.com) [Referral]
powershell dynamic module empty variable (www.google.ru) [Referral]
powershell change "COM interface" pointer (www.google.co.uk) [Referral]
casting PSCustomObject (www.bing.com) [Referral]
PowerShell function parameter byref (www.bing.com) [Referral]
powershell sharepoint try argumentexception (www.google.fr) [Referral]
Powershell function pointer array (www.bing.com) [Referral]
closure powershell (www.google.co.uk) [Referral]
powershell byref (www.bing.com) [Referral]
add element to pscustomobject (www.google.com) [Referral]
newclosure powershell (www.google.com.do) [Referral]
powershell dispose array (www.google.com) [Referral]
powershell script closures (www.bing.com) [Referral]
Cannot index into a null array. (www.bing.com) [Referral]
"call module" powershell example (www.google.nl) [Referral]
ctp3 add-module (www.google.com) [Referral]
powershell 2.0 create empty array (www.google.de) [Referral]
dynamic ScriptMethod powershell (www.google.fr) [Referral]
sta je PowerShell (www.google.com) [Referral]
powershell PSCustomObject copy (www.google.co.jp) [Referral]
powershell 2.0 +Create new array (www.google.co.uk) [Referral]
powershell closure parameter (www.google.com) [Referral]
powershell array byval (www.google.co.il) [Referral]
powershell passing an array to a pipeline (ca.search.yahoo.com) [Referral]
try catch powershell loops (www.google.pl) [Referral]
+"scriptblock.create" (cc.bingj.com) [Referral]
powershell 2.0 array (www.google.com) [Referral]
powershell "list modules" (www.bing.com) [Referral]
Powershell Cannot index into a null array (www.bing.com) [Referral]
powershell dynamic array (www.google.ru) [Referral]
export module psvariable (www.bing.com) [Referral]
ScriptBlock.GetNewClosure (www.bing.com) [Referral]
powershell closure (www.bing.com) [Referral]
powershell modules initialization (www.google.ch) [Referral]
powershell passing PSCustomObject (www.google.com) [Referral]
powershell 2.0 array (www.google.com) [Referral]
Cannot index into a null array.+powershell+sharepoint (www.google.co.uk) [Referral]
Cannot index into a null array. powershell (www.bing.com) [Referral]
powershell "current function name" (www.google.com) [Referral]
powershell script block getnewclosure (www.google.com) [Referral]
closure powershell (www.google.com.ua) [Referral]
powershell get current session state (www.google.com.hk) [Referral]
powershell "Strings" module (www.google.com) [Referral]
powershell ctp 1 modules (www.google.com) [Referral]
poershell dynamic scriptblock (www.bing.com) [Referral]
http://www.google.ch/ [Referral]
Comments are closed.