title: How to pass arguments to functions in PowerShell
body: <p>I have the below PowerShell script</p>
  
  <pre><code>Function Publish
  {
      Param(
          [parameter(Mandatory=$true)]
          [String]
          $RELEASEDIR,
  
          [parameter(Mandatory=$true)]
          [String]
          $SERVICENAME,
  
          [parameter(Mandatory=$true)]
          [String]
          $SERVER
      )
  
      Get-ChildItem "$RELEASEDIR\*"
      $service = Get-Service -Name $SERVICENAME -Computername $SERVER -ErrorAction SilentlyContinue
      $service.Status
  }
  Publish
  </code></pre>
  
  <p>How I am executing this:</p>
  
  <pre><code>PS C:\Release\RPCPS&gt; .\RPCPublish.ps1 -RELEASEDIR "C:\Location" -SERVICENAME "value" -SERVER "server"
  cmdlet Publish at command pipeline position 1
  Supply values for the following parameters:
  RELEASEDIR:
  </code></pre>
  
  <p>Even after passing arguments while executing, the script is expecting it again. What am I doing wrong here?</p>