I have a script to which I pass server name(s) in $args.
This way I can do stuff to this (these) server(s) using foreach:
foreach
.\\script.ps1
I call a scheduled script who must connect to a list of Server this way:
Powershell.exe -File "YourScriptPath" "Par1,Par2,Par3"
Then inside the script:
param($list_of_servers) ... Connect-Viserver $list_of_servers.split(",")
The split operator returns an array of string