Read Valid Input in PowerShell


Previously, any time I wanted to validate input in PowerShell, I’d write custom validation functionality per-script. It turns out that I reuse the same basic methods though, so I’ve created and shared a generalised function!

This prompts users to enter input that matches a displayed list, then returns their input if successful. This works from VM or object selection, to simple y/n acceptance restrictions.

The full details and code are here: https://github.com/GSGBen/powershell/blob/master/Read-ValidInput.psm1

To make it accessible to your code save it somewhere then use import-module <path to above file>

image

Videogames

Hey, do you like videogames? If so check out my game Grab n' Throw on Steam, and add it to your wishlist. One gamemode is like dodgeball crossed with soccer except instead of balls you throw stacks of your own teammates. Another is like golf but on a 16x16km landscape with huge throw power to match. And there's plenty of others to come!

See full gameplay on Steam!