Choose from list of server names


I want my PowerShell script to choose dynamically from a list of servers to send a request. I want PowerShell to decide where the request goes to, rather than a user prompt.

Any ideas on how this can be achieved? I’ve not been successful on my google searching so far!


Put your servers into a list called $Servers, then do $Servers | Get-Random, and you’ll get a random server from the list to send the request.

Choose dynamically based on what? Logic? A random list? Zodiac sign of the user? Provide specifics and code that you have tried, current result, expected result, etc.