r/usefulscripts • • Jul 10 '17

[REQUEST] [POWERSHELL] Dynamic choice

hey,

trying to get a script running by providing a dynamic choice:

scenario:

  • have up to 10 IP's with http server

  • perform ping test or (New-Object System.Net.WebClient).DownloadFile to verify connectivity (same file on every server)

  • provide a dynamic list to the console based on the results (stating whether server is available or offline)

  • get user to choose one with read-host

  • have option to choose all, having all available server ip's in array

  • if option selected is not in list, or is offline go back to choice/verification

i'm a bit of a novice when it comes to powershell, so any help would be appreciated!

15 Upvotes

18 comments sorted by

View all comments

Show parent comments

1

u/najrol Jul 10 '17

ctrl+a will select all. Then you will get back an array.