title: In a PowerShell script, is it possible to tell whether a default parameter value is being used?
body: <p>Lets say I have a simple script with one parameter, which has a default value:</p>
  
  <pre><code>param(
      [string] $logOutput = "C:\SomeFolder\File.txt"
  )
  # Script...
  </code></pre>
  
  <p>And lets say a user runs the script like so:</p>
  
  <pre><code>PS C:\&gt; .\MyScript.ps1 -logOutput "C:\SomeFolder\File.txt"
  </code></pre>
  
  <p>Is there any way the script is able to know that the user explicitly entered a value (which happens to be the same as the default), rather than let the default be decided automatically?</p>
  
  <p>In this example, the script is going to print some output to the given file. If the file was <em>not</em> specified by the user (i.e. the default got used automatically), then the script will <em>not</em> produce an error in the event it is unable to write to that location, and will just carry on silently. However, if the user <em>did</em> specify the location, and the script is unable to write to that location, then it should produce an error and stop, warning the user. How could I implement this kind of logic?</p>