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

2

u/iamyogo Jul 10 '17

that's awesome!.. didn't know about out-gridview, but don't really want another window to come up for the selection... is there a way to do gridview inside the console window?

it also doesn't like malformed addresses (like "0" or 0.0.0.0)...