Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7834139
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T13:04:19+00:00 2026-06-02T13:04:19+00:00

I’m self-taught with PowerShell and I’ve written a few scripts now, some of which

  • 0

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:

  1. 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 Write-Host.

  2. 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 Write-Error rather than Write-Host. I don’t do this, though. I just capture the plain English error message and output it with Write-Host so it’s more user-friendly for people who don’t know anything about PowerShell or coding other than how to run scripts.

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?

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!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T13:04:20+00:00Added an answer on June 2, 2026 at 1:04 pm

    I don’t think that it is expected of a script to use write-output rather than write-host so that the output can be piped to other scripts etc. Cmdlets and maybe functions can be expected to do that, but not scripts. If you have to display something to the user about the actions that the script is doing, you might as well use Write-Host. Note that using Write-Output might be good, if you want to log the output of the script to a logfile AND display on the screen to the user. Doing that when you are using Write-Host cannot be done easily / efficiently.

    Write-Error add some additional info that IMO is not necessary. I rarely use Write-Error. I use Write-Host -fore red message to indicate errors in my scripts. That keeps it nice and simple.

    But of course, we can’t make statements like always use Write-Output or always use Write-Host etc. It is going to depend on the situation and how you are going to be using the scripts.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have some data like this: 1 2 3 4 5 9 2 6
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.