PowerShell doesn’t validate command line parameter names
Today, I came across a weird behavior by PowerShell that it doesn’t validate the parameter names 🙁 Below is the sample code that explains the behavior i am speaking about: PS C:> type .Test-Commandline-Parameters.ps1 param([switch]$Debug) Write-Host $Debug PS C:> .Test-Commandline-Parameters.ps1 -debug True PS C:> .Test-Commandline-Parameters.ps1 -debugging False PS C:> .Test-Commandline-Parameters.ps1 -debu True PS C:> .Test-Commandline-Parameters.ps1 -de True PS C:> .Test-Commandline-Parameters.ps1 -d True PS C:> .Test-Commandline-Parameters.ps1 -debeg False PS C:> .Test-Commandline-Parameters.ps1 -deer False PS C:> For more details read my article in MS PS TechNet Forums here.
Read more