title: PowerShell Best Practices: Is it bad to treat a PowerShell script like an advanced batch file?
body: <p>I'm self-taught with PowerShell and I've written a few scripts now, some of which are pretty powerful. Despite this, I worry that I might not be using PowerShell in its intended way. Here are my two main concerns:</p>
  
  <ol>
  <li><p>From what I've read, PowerShell scripts should be written in such a way that they can be piped into and also so that they can pipe their output into something else. But the way I wrote my scripts is to be completely stand-alone and output everything to the user via <code>Write-Host</code>.</p></li>
  <li><p>Another thing I've read is that when errors come up (for example, you try to read a file but don't have permission), you should use <code>Write-Error</code> rather than <code>Write-Host</code>. I don't do this, though. I just capture the plain English error message and output it with <code>Write-Host</code> so it's more user-friendly for people who don't know anything about PowerShell or coding other than how to run scripts.</p></li>
  </ol>
  
  <p>Are either of these things heavily frowned upon in the PowerShell community? If I showed one of my powerful, well-commented, easy-to-read scripts to an advanced PowerShell coder, would he scoff at it and call it garbage?</p>
  
  <p>Some of my scripts could be useful to others, but I hesitate to show the code to anybody for fear that my style isn't correct. Any help would be appreciated. Thanks!</p>