Just played with this a bit.  Works like the normal functions in Powershell V1 but thought I would give an example in V2 advanced functions.
 

function Test {

 [CmdletBinding()]
 param(
 [Parameter(Mandatory=$true)]
 [ref]$var
 )
 #Note the $var.value.  $var = 5 will not work.
 $var.value = 5

}

PS C:\Users\spowser> $var = 1
PS C:\Users\spowser> Test -var ([ref]$var)
PS C:\Users\spowser> $var
5

-Shane

 
Advertisements