Okay this should be super simple but for some reason Googling and searching this site has not provided me with an answer to this question (or more likely I am not providing the correct search terms), so here goes.
Within a Powershell script I want to make sure the user passes a value for at LEAST one parameter out of a possible two when calling a particular Powershell script.
So this should produce an error:
However these should not:
.\scriptname -add john
.\scriptname -delete fred
.\scriptname -add john -delete fred
I've read fifty different things you can do with parameters (switches, dynamic parameters, parameter sets) but can't seem to figure out how to just make at least one OF two parameters mandatory. I know how to make single parameter mandatory or to make two parameters mandatory but NOT how to make it so the user has to pass either ONE or TWO parameters but NOT zero).
Any help is much appreciated. Thanks!