Read multiple values from console

Welcome Forums General PowerShell Q&A Read multiple values from console

This topic contains 3 replies, has 2 voices, and was last updated by

5 years, 4 months ago.

  • Author
  • #11769

    Points: 0
    Rank: Member

    Hi New to Powershell here, trying to fumble my way through...

    I'm trying to write a script to output the last 3 eventlog items from named servers to an HTML file.

    I want to have a prompt ask the user which servers they want to query. I can't quite work out how to handle multiple inputs, I think I need an array but not sure how to set it up. Can anyone give me any pointers?



  • #11770

    Points: 1,811
    Helping HandTeam Member
    Rank: Community Hero

    The BEST way is to let PowerShell do it. At the top of your script:


    If someone runs the script, they'll be prompted for the computer name. They can keep entering them, one at a time, hitting Enter on an empty prompt to indicate they're done. The nice thing is that they can bypass the prompt by running the script and providing a -ComputerName parameter up front.

    This remains consistent with the way the shell works for all commands.

  • #11773

    Points: 0
    Rank: Member

    Great, thank you Don. I'll play around with that now 🙂

  • #11774

    Points: 0
    Rank: Member

    Works a charm, thanks again!

The topic ‘Read multiple values from console’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort