I would like the second function call in this script to throw an error:
function Deploy
{
param(
[Parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]
[string]$BuildName
)
Write-Host "Build name is: $BuildName"
}
Deploy "Build123"
Deploy #Currently prompts for input
Prompting is great for using the script interactively, but this will also be executed by our build server.
Is my best bet just doing some custom validation with an if or something?
-NonInteractiveflag, missing mandatory parameters will cause an error and result in a non-zero exit code for the process.