title: powershell constraints on arguments
body: <p>I need a little help on how I can enforce the following constraints on the arguments to a powershell script. Can I specify these constraints with in the <code>param</code> section.</p>
  
  <ol>
  <li>At least one argument constraint</li>
  <li>At most one argument constraint</li>
  </ol>
  
  <p>For example, (just an example, it's not what I am doing) to a script called <code>ReadPlainText.ps1</code>, I would like to give only either of the two arguments: <code>Lines</code> or <code>Chars</code>, but not both. The command <code>ReadPlainText.ps1 Sample.txt -Lines 20 -Chars 10</code> should result in an error. Similarly, the command <code>ReadPlainText.ps1 Sample.txt</code> should result in error.</p>