Mixing Parameter Sets

by Jan 21, 2010

You will find that some cmdlet parameters belong to different parameter sets. Any cmdlet can use only parameters from one parameter set. You will get an error when you try and mix parameters belonging to different parameter sets.. This is why this command will fail:

Get-Random -Minimum 1 -Maximum 50 -Count 7

As it turns out, -Count belongs to a different parameter set than -Minimum and -Maximum. You should call Get-Help and look at the SYNTAX section to see the different parameter sets. This will show you all the different ways you can safely call that cmdlet and the parameters that belong to each call:

Get-Help Get-Random

Twitter This Tip! ReTweet this Tip!