I am familiar with how to accept parameters or arguments from the command line and pass them to PowerShell:
powershell.exe -file myscript.ps1 -COMPUTER server1 -DATA abcd
[CmdletBinding()]
Param(
[Parameter(Mandatory=$True)]
[string]$computer,
[Parameter(Mandatory=$True)]
[string]$data
)
That’s fine, but what if the $computer argument is more than one item and of an unknown number of items? For example:
Powershell.exe -file myscript.ps1 -COMPUTER server1, server2, server3 -DATA abcd
Here we do not know how many $computer items there will be. There will always be one, but there could be 2, 3, 4, etc. How is something like this best achieved?