DCToolbox
DCToolbox copied to clipboard
SuffixFilter parameter
Hi
I worked with your DCToolbox module and today I came across the PrefixFilter parameter which I really like.
I assume that lots of folks would also appreciate a SuffixFilter parameter.
I had a glance at the code and I think I could manage to create a pull request on that.
One "struggle" that I can think of is that most probably this would result in different Parameter Sets, so that you can only choose either PrefixFilter or SuffixFilter.
Maybe the DefaultParameterSetName with PrefixFilter, the additional SuffixFilter.
[CmdletBinding(DefaultParameterSetName = 'PrefixFilter')]
param (
[parameter(Mandatory = $true)]
[string]$ClientID,
[parameter(Mandatory = $true)]
[string]$ClientSecret,
[parameter(Mandatory = $false)]
[string]$FilePath = "$((Get-Location).Path)\Conditional Access Backup $(Get-Date -Format 'yyyy-MM-dd').json",
[parameter(Mandatory = $false,
ParameterSetName = 'PrefixFilter')]
[string]$PrefixFilter,
[parameter(Mandatory = $false,
ParameterSetName = 'SuffixFilter')]
[string]$SuffixFilter
)
See also: Adding Multiple Parameter Sets to a PowerShell Function by Mike F. Robbins for further reference.
function Test-MrMultiParamSet {
[CmdletBinding(DefaultParameterSetName = 'Name')]
param (
[Parameter(Mandatory,
ParameterSetName = 'Name',
Position = 0)]
[string[]]$Name,
[Parameter(Mandatory,
ParameterSetName = 'Module')]
[string[]]$Module,
[Parameter(Mandatory,
ValueFromPipeline,
ValueFromPipelineByPropertyName,
Position = 1)]
[string]$Path
)
$PSCmdlet.ParameterSetName
}