Mixing Parameter Sets

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!


Posted Jan 21 2010, 08:00 AM by ps1

Comments

Twitter Trackbacks for Mixing Parameter Sets - Power Tips - PowerShell.com [powershell.com] on Topsy.com wrote Twitter Trackbacks for Mixing Parameter Sets - Power Tips - PowerShell.com [powershell.com] on Topsy.com
on 01-21-2010 10:36 AM

Pingback from  Twitter Trackbacks for                 Mixing Parameter Sets - Power Tips - PowerShell.com         [powershell.com]        on Topsy.com

Concentrated Tech NSoftware Dell Compellent Sponsored by Idera and Concentrated Tech and NSoftware and Dell Compellent
Copyright 2011 PowerShell.com. All rights reserved.