Hello,
I want to add a optional parameter to my ADT package.
It should work like that:
Deploy-Application.exe -configonly
So my custom parameter is called configonly and the user can add the parameter if he needs it.
I added the parameter to the Param block of Deploy-Application.ps1 :
[CmdletBinding()]
Param (
[Parameter(Mandatory=$false)]
[ValidateSet(‘Install’,‘Uninstall’,‘Repair’)]
[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,
Parameter]
[string]$ConfigOnly
)
And if the user uses this parameter, I want to do X. So I I also added in the Pre-Install:
If ($PSBoundParameters.ContainsKey(“ConfigOnly”) {action x}
But that does not work. Do I have to add the parameter to AppEployToolkitMain.ps1?
What am I doing wrong?
Thanks!