This area describes common mistakes that can be made during application package creation.
Use single quotes instead of double quotes
Wrong
[Parameter(Mandatory)]
[ValidateSer("Splunk","Elasticsearch")]
[string]$Backend,
Correct
[Parameter(Mandatory)]
[ValidateSer('Splunk','Elasticsearch')]
[string]$Backend,
Space between Validation Options
Wrong
[Parameter(Mandatory)]
[ValidateSer('TCP', 'HTTP', 'Console')]
[string]$Protocol,
Correct
[Parameter(Mandatory)]
[ValidateSer('TCP','HTTP','Console')]
[string]$Protocol,
Set comma after the last parameter
Wrong
Param (
[Parameter(Mandatory=$false)]
[ValidateSet('Install','Uninstall')]
[string]$DeploymentType = 'Install',
[Parameter(Mandatory=$false)]
[ValidateSet('Interactive','Silent','NonInteractive')]
[string]$DeployMode = 'Interactive',
[Parameter(Mandatory=$false)]
[switch]$AllowRebootPassThru = $false,
[Parameter(Mandatory=$false)]
[switch]$TerminalServerMode = $false,
[Parameter(Mandatory=$false)]
[switch]$DisableLogging = $false,
)
Correct
Param (
[Parameter(Mandatory=$false)]
[ValidateSet('Install','Uninstall')]
[string]$DeploymentType = 'Install',
[Parameter(Mandatory=$false)]
[ValidateSet('Interactive','Silent','NonInteractive')]
[string]$DeployMode = 'Interactive',
[Parameter(Mandatory=$false)]
[switch]$AllowRebootPassThru = $false,
[Parameter(Mandatory=$false)]
[switch]$TerminalServerMode = $false,
[Parameter(Mandatory=$false)]
[switch]$DisableLogging = $false
)