title: positional parameter cannot be found that accepts argument
body: <p>I have a problem with a script. I check for firmware type and after that I format the hard drive based on that. The problem is that I get an error when it runs the command</p>
  
  <pre><code>New-Partition -DiskNumber 0 -GptType '{ebd0a0a2-b9e5-4433-87c0-68b6b72699c7}' $partsize_param -DriveLetter C
  </code></pre>
  
  <p>It says</p>
  
  <pre>a positional parameter cannot be found that accept argument '-UseMaxiumSize'  
  + categoryinfo       : invalidargument: (:) [New-Partition], ParameterBindingException  
  + fullyqualifiederror: PositionalParameterNotFound, New-Partition</pre>
  
  <p>The funny thing is that the command runs just fine if I'm using <code>-UseMaximumSize</code> instead of <code>$partsize_param</code></p>
  
  <p>Can someone point what is the error that I'm making?</p>
  
  <pre><code>function clean_install_hdd () {
      Switch (Get-BiosType) {
          1       {$firmwaremode='Legacy BIOS'}
          2       {$firmwaremode='UEFI Mode'}
          Default {$firmwaremode='Unknown'}
      }
      Get-Disk
  
      $PartitionSize = Read-Host "Partition size - How many GB or max to use all available space"
  
      if ("$PartitionSize" -eq "max") {
          $partsize_param = '-UseMaximumSize'
      } else {
          $partsize_param = '-Size ' + $PartitionSize
      }
  
      if ("$firmwaremode" -eq "Legacy BIOS") {
          Clear-Disk 0 -RemoveData -RemoveOEM  -Confirm:$false; Initialize-Disk 0 -PartitionStyle MBR -Confirm:$false
          New-Partition -DiskNumber 0 -$partsize_param -DriveLetter C -IsActive | Format-Volume -FileSystem NTFS -NewFileSystemLabel Windows -ShortFileNameSupport $False  -Confirm:$false
      }
      if ("$firmwaremode" -eq "UEFI Mode") {
          Clear-Disk 0 -RemoveData -RemoveOEM  -Confirm:$false; Initialize-Disk 0 -PartitionStyle GPT  -Confirm:$false
          $systemPart = New-Partition -DiskNumber 0 -GptType '{c12a7328-f81f-11d2-ba4b-00a0c93ec93b}' -Size 100MB -DriveLetter S
          &amp; format.com "$($systemPart.DriveLetter):" /FS:FAT32 /Q /Y | Out-Null
          New-Partition -DiskNumber 0 -GptType '{e3c9e316-0b5c-4db8-817d-f92df00215ae}' -Size 128MB
          Write-Host $partsize_param
          New-Partition -DiskNumber 0 -GptType '{ebd0a0a2-b9e5-4433-87c0-68b6b72699c7}' $partsize_param -DriveLetter C | Format-Volume -FileSystem NTFS -NewFileSystemLabel Windows -ShortFileNameSupport $False -Confirm:$false
      }
  }​
  </code></pre>