powershell ParameterSet解析 自定义PowerShell函数,在设置参数的时候中,可以将参数设置为某些情况下可选,某些条件下又设置为必选。 示例代码从网站复制的。 1functionConnect-Somewhere2{3[CmdletBinding(DefaultParameterSetName='A')]4param5(6[Parameter(ParameterSetName='A',Mandatory=$false)]7[Parameter(Paramete...
Examples of parameter sets Unique parameter Multiple parameter sets Parameter set requirements Show 2 more 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...
1.ParameterSetName可以设置成任何字符,但当你使用了其中某一个ParameterSetName的参数时,只有相同的ParameterSetName的参数或是没有设置ParameterSetName的参数(相当于是共用的参数)可以使用,其他的ParameterSetName的参数就会被互斥给排除掉. 2.当两个ParameterSetName的参数都被设定为强制(Mandatory)时,不会因为互斥而...
TheGet-Helpcmdlet returns various details about the command, including a description, the command syntax, information about the parameters, and examples showing how to use the parameters in a command. You can also use the Parameter parameter of theGet-Helpcmdlet to find information about a particu...
類型:SwitchParameter Position:Named 預設值:None 必要:False 接受管線輸入:False 接受萬用字元:False -HideInTaskScheduler 請勿在工作排程器中顯示工作。 這個值只會影響作業執行所在的計算機。 根據預設,排程工作會出現在 [工作排程器] 中。 即使工作已隱藏,使用者也可以選取[工作排程器] 中的 [顯示隱藏的工作...
The Get-Help cmdlet returns various details about the command, including a description, the command syntax, information about the parameters, and examples showing how to use the parameters in a command. You can also use the Parameter parameter of the Get-Help cmdlet to find information about a...
Set-ScheduledJob [-InputObject] <ScheduledJobDefinition> [-ClearExecutionHistory] [-PassThru] [<CommonParameters>]说明Set-ScheduledJob cmdlet 更改计划作业的属性,例如作业运行的命令或运行该作业时所需的凭据。 它还可用于清除计划作业的执行历史记录。 若要使用此 cmdlet,请首先使用 Get-ScheduledJob cmdlet ...
Set-PSReadLineOption-Colors@{ Command ='Magenta'Number ='DarkGray'Member ='DarkGray'Operator ='DarkGray'Type ='DarkGray'Variable ='DarkGreen'Parameter ='DarkGreen'ContinuationPrompt ='DarkGray'Default ='DarkGray'} 示例5:设置多种类型的颜色值 ...
Set-ComplianceSearch [-Identity] <ComplianceSearchIdParameter> [-AddExchangeLocation <String[]>] [-AddExchangeLocationExclusion <String[]>] [-AddSharePointLocation <String[]>] [-AddSharePointLocationExclusion <String[]>] [-AllowNotFoundExchangeLocationsEnabled <Boolean>] [-Confirm] [-ContentMatchQuer...
function help { <# .FORWARDHELPTARGETNAME Get-Help .FORWARDHELPCATEGORY Cmdlet #> [CmdletBinding(DefaultParameterSetName='AllUsersView')] param( [Parameter(Position=0, ValueFromPipelineByPropertyName=$true)] [System.String] ${Name}, ... } The following command uses this feature. When a user...