title: Named Parameter not working in my script
body: <p>I'm trying to write a PS function that takes a -Computername parameter. Here is the code I'm using:</p>
  
  <pre><code>function Get-Foo {
  param(
      [Parameter(Mandatory=$False,Position=0,ValueFromPipeline=$True,ValueFromPipelineByPropertyName=$True)]
      [string[]]$Computername = $env:COMPUTERNAME
  )
  </code></pre>
  
  <p>However, when I run the function as <code>Get-Foo -Computername BAZ</code> it never passes the named parameter BAZ, but instead always uses the value of <code>$env:COMPUTERNAME</code>. I'm generally new to PowerShell, and definitely to writing functions, so hopefully someone can quickly see where I'm going wrong here. I cut and modified the <code>param</code> line from another script that does work, so I don't know why it doesn't work here... Thanks.</p>