title: Powershell script support for -verbose
body: <p>I'm creating a .ps1 script which invokes <code>Write-Verbose</code>. I would like to be able to enable/disable these.</p>
  
  <p>I was hoping that I could pass the <code>-Verbose</code> flag when invoking the script and everything would just work. Unfortunately this doesn't seem to be the case.</p>
  
  <p>The verbose messages are not written out to the host. I looked around a bit and found <a href="http://blogs.msdn.com/b/powershell/archive/2007/02/25/supporting-whatif-confirm-verbose-in-scripts.aspx" rel="noreferrer">Supporting -Whatif, -Confirm, -Verbose – In SCRIPTS!</a></p>
  
  <p>But this is from 2007 and the PS team member stated that they were looking for built in support in PS v2.</p>
  
  <p>Anybody have any updates on this or do we have to use the same technique described in that blog post?</p>
  
  <p><strong>Here is an example of the current behavior.</strong></p>
  
  <p>I created a simple script,ex01.ps1, with the following.</p>
  
  <pre><code>Write-Host "line 1"
  Write-Verbose "line 2"
  Write-Host "line 3"
  </code></pre>
  
  <p>I first executed the script with <code>.\ex01.ps1</code>, and only 1 &amp; 2 were printed as expected. Then I executed it with <code>.\ex01.ps1 -verbose</code>, and got the same result. I was expecting all 3 lines to be printed the second time.</p>
  
  <p><img src="https://i.stack.imgur.com/jwVRZ.png" alt="Powershell example result"></p>