Используйте два набора параметров для $ A и $ B:
[CmdLetbinding(DefaultParameterSetName='ParamSet1')]
Param(
[Parameter(Mandatory=$true,ParameterSetName='By_A')][String]$A,
[Parameter(Mandatory=$true,ParameterSetName='By_B')][System.Net.IPAddress[]]$B,
# Rest of the Param
)
<#
In the function's code, you can either test for whether $A and/or $B are null, or check $PSBoundParameters.ContainsKey('A'), or check $PSCmdlet.ParameterSetName to see whether it
is set to 'By_A' or 'By_B'
#>
Если вы не хотите использовать наборы параметров для A и B:
Param(
# Param block, specifying both A and B mandatory=$false
)
If($A -ne $null){
# A is not null, like this you can check if B is null. If B is not null then you can throw an exception
}
If($B -be $null){
# B is not null, like this you can check if A is null. If A is not null then you can throw an exception
}