Below is my code to configure required services wherein I see error as Parameter set cannot be resolved using the specified named parameters. One or more parameters issued cannot be used together or an insufficient number of parameters were provided. when executed.
Code should work if either of the parameters is passed else should throw error message.
param (
[Parameter(Position=0,Mandatory=$false,ParameterSetName="checks")]
[ValidateSet("srv")]
[switch]$service,
[Parameter(Position=1,Mandatory=$false,ParameterSetName="checks")]
[ValidateSet("dsk")]
[switch]$disk,
[Parameter(Position=2,Mandatory=$false,ParameterSetName="details")]
[ValidateSet("nme")]
[switch]$name)
function check_types ($service,$disk,$name) {
if ($disk -or $service -or $name) {
Write-Host "Argument" $name $service $disk "Provided" -ForegroundColor Green
} else {
Write-Host "No arguments provided" -ForegroundColor Red
}
}
check_types -service srv -disk dsk -name nme