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>