How can I display a 'naked' error message in PowerShell without an accompanying stacktrace?
<p>How can I write to standard error from PowerShell, or trap errors such that:</p>

<ul>
<li>An error message is displayed as an error (truly writing to standard error so that <a href="https://en.wikipedia.org/wiki/TeamCity" rel="noreferrer">TeamCity</a> and Octopus see it as an error)</li>
<li>No stack trace garbage muddles my beautiful, concise error message</li>
</ul>

<p>All these years I've survived by <code>throw</code>ing errors or writing via <code>Write-Error</code>, but I'm tired and old, and in my scripts I just want to see one concise error message. I've been trying every combination of <code>trap</code>, <code>throw</code>, <code>Write-Error</code>, and <code>-ErrorAction</code>, to no avail:</p>

<pre><code>try {
  throw "error" # Sample code for a stack overflow. In the theater
  # of your mind, imagine there is code here that does something real and useful
} catch {
  Write-Error "An error occurred attempting to 'do something.' Have you tried rebooting?"
}
</code></pre>

<p>Here's the user experience I want to see:</p>

<pre><code>C:\&gt; &amp; .\Do-Something.ps1
An error occurred attempting to 'do something.' Have you tried rebooting?

C:\&gt; ▏
</code></pre>

<p>Instead I get:</p>

<pre><code>C:\&gt; &amp; .\Do-Something.ps1
An error occurred attempting to 'do something.' Have you tried rebooting?
At line:1 char:1
+ Do-RealWork
+ ~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Do-RealWork

C:\&gt; ▏
</code></pre>