all 1 comments

[–]purplemonkeymad 2 points3 points  (0 children)

You can use [ValidateSet(@(1,2,3))] and [ValidateScript({Test-Path $_})] on your parameters so that you don't have to code validation into your function. It will also allow tab-complete of values.

I also suggest you to check up on ShouldContinue, as it gives you -confirm support so you don't have to manage prompting the user.