This line:
[ValidateScript({if (!(Test-Path $_) -and (!($_ -like "*.exe")))
{ Throw "Specify correct path to executable." }
else {$true}})]
[String]$installerPath
The Test-Path validation returns True/False.
However ! -like is not working as expected. Passing arguments with .txt, .msi etc file type does not validate correctly.