You can use a required parameter (for Powershell versions less than 5.1 or 'Get-Clipboard' for version 5.1 or greater) that has type of String array [string[]]. It will prompt you for to enter the value of each array element until it detects a blank line that is entered.
I figured this out recently by looking at the input Parameters of a script. For years I was manipulating the text into the PowerShell single line array format with Excel's transpose and replacing 'Tab' characters in Notepad.
Just for reference PowerShell single line array format is ("1", "2", "3", "4", "5")
...
param
(
[parameter(Mandatory = $true)]
[string[]]
$listOfStrings
)
...
Example prompt to fill to a string array
Supply values for the following parameters:
listOfStrings[0]:
I created a list in Notepad (or Excel) of 1 through 5 and directly copied it into PowerShell window. Below is my sample output.
1
2
3
4
5
Supply values for the following parameters:
listOfStrings[0]: 1
listOfStrings[1]: 2
listOfStrings[2]: 3
listOfStrings[3]: 4
listOfStrings[4]: 5
listOfStrings[5]:
1
2
3
4
5
$a = (Read-Host -Prompt "Enter servers (comma separated)").Split(',')Get-Clipboard, seeGet-Help Get-Clipboard. Your choice of tags is ambiguous, PSv2 usually excludes the other - hover of the tag labels to read the tag info..