Multiple parameter sets Parameter set requirements 顯示其他 2 個 PowerShell uses parameter sets to enable you to write a single cmdlet that can do different actions for different scenarios. Parameter sets enable you to expose different parameters to the user. And, to return different information bas...
定义了多个参数集时,CmdletBinding 属性的 DefaultParameterSetName 关键字将指定默认参数集。 当PowerShell 无法根据提供给命令的信息确定所要使用的参数集时,它会使用默认参数集。 有关 CmdletBinding 属性的详细信息,请参阅 about_Functions_CmdletBindingAttribute。 声明参数集 若要创建参数集,必须为参数集中的每个参数...
One of the great benefits of PowerShell V2 Advanced Functions is the ease in which you can support parametersets. ParameterSets are, well, different SETS of valid parameters. For instance you can say: Get-Process -id 0 Get-Process -Name *ss Those are 2 different parametersets for the Get...
When multiple parameter sets are defined, the cmdlet can indicate which parameter set to use if Windows PowerShell doesn't have enough information to make that determination. The parameter set that is used in this case is referred to as the default parameter set, and is specified using the ...
However, be sure to copy only one instance of a Parameter node, even if the parameter is specified in multiple parameter sets in the syntax. For each Parameter node, set the attribute values that define the characteristics of each parameter. These attributes include the following: required, ...
Set-SqlMaintenanceMode-Repository"myserver\myinstance1"-Instances"dbhost1\instance1"; Example 2: Set multiple instances. Set-SqlMaintenanceMode-Repository"myserver\myinstance1"-Instances"dbhost1\instance1","dbhost1\instance2","dbhost5\instance1","dbhost5\instance2"; Cheers, Lain...
TheKey/Valuepair sets theSend-MailMessage:SmtpServerkey to a custom default value ofServer123. PowerShell $PSDefaultParameterValues= @{"Send-MailMessage:SmtpServer"="Server123"} Set default values for multiple parameters To set default values for multiple parameters, separate eachKey/Valu...
The RemoveSharePointLocation parameter specifies the SharePoint Online sites to remove from the list of included sites when you aren't using the value All for the SharePointLocation parameter. You identify the site by its URL value. You can enter multiple values separated by commas. If the val...
Create an XML-based Help topic, such as the type that is typically created for cmdlets. XML-based Help is required if you are translating Help topics into multiple languages. To associate the script with the XML-based Help topic, use the.EXTERNALHELPHelp comment keyword. For more information...
This parameter uses the syntax Room/<Text> or Equipment/<Text> where the <Text> value doesn't contain spaces. For example, Room/Whiteboard or Equipment/Van. You can specify multiple values separated by commas. To enter multiple values and overwrite any existing entries, use the following ...