スクリプトの先頭に次のParamブロックがあります。
Param
(
[Parameter(Mandatory = $true)]
[ValidateScript({Test-Path $_ -PathType Leaf})]
[string]$Config,
[switch]$OverThresholdOnly,
[switch]$SendEmail,
[switch]$Debug
)
スクリプトを実行すると、次のエラーが発生します。
"A parameter with the name 'Debug' was defined multiple times for this command. At line:1 char:1"
Line:1 and char:1 is the start of the Param block.
$Debugを$Verboseに変更すると、Verboseについて同じエラーが発生します。同じエラーでParamブロックの先頭に$debugを配置しようとしました。
[ValidateScript]セクションを削除すると、正常に機能します。
なぜこれを行うのか誰か教えてもらえますか?[ValidateScript]が$Debugを使用している理由と、変数の名前を変更せずにこれを回避する方法を教えてください。