Use a custom parameter


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 :

Param (
[string]$DeploymentType = ‘Install’,
[string]$DeployMode = ‘Interactive’,
[switch]$AllowRebootPassThru = $false,
[switch]$TerminalServerMode = $false,
[switch]$DisableLogging = $false,

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?


Try :

If you use -ConfigOnly in the commandline then $ConfigOnly will be $true

And to use the parameter:
If ($ConfigOnly) {action x}

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.