Hello, I’m trying to create a printer installation script with PSADT 4.0.4. I want to use custom parameters when launching the application, for example:
Invoke-AppDeployToolkit.exe -DeploymentType Install -DeployMode Interactive -PrinterVendor "Canon" -PortName "IP_10.10.1.34" -PrinterIP "10.1.1.34" -PrinterName "Canon - Test Printer" -DriverName "Canon Generic Plus PCL6" -INFFile "CNP60MA64.INF"
If I use these parameters with the Invoke-AppDeployToolkit.ps1 script, it works. But if I use the .exe, it doesn’t work. Does anyone have any ideas?
Here is an example of the additional parameters I define in the script:
[CmdletBinding()]
param
(
[Parameter(Mandatory = $true)]
[ValidateSet('Canon', 'HP', 'Kyocera', 'Lexmark', 'Ricoh', 'Xerox', 'Brother')]
[string]$PrinterVendor,
[Parameter(Mandatory = $true)]
[string]$PortName,
[Parameter(Mandatory = $true)]
[string]$PrinterIP,
[Parameter(Mandatory = $true)]
[string]$PrinterName,
[Parameter(Mandatory = $true)]
[string]$DriverName,
[Parameter(Mandatory = $true)]
[string]$INFFile,
[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,
[Parameter(Mandatory = $false)]
[switch]$TerminalServerMode,
[Parameter(Mandatory = $false)]
[switch]$DisableLogging
)
When you say “doesn’t work”, can you be more specific? There’s nothing stopping any parameters being passed along to the deployment script from the exe. Do you get an error at least?
Could it be a spacing issue? When using ServiceUI in front of the exe (if you’re doing so), params with spaces need a bit of massaging to work: [Bug] Invoke-AppDeployToolkit.exe is not able to pass custom parameters containing spaces · Issue #1180 · PSAppDeployToolkit/PSAppDeployToolkit · GitHub
1 Like
You’re absolutely right, I can pass parameters to Invoke-AppDeployToolkit.exe
, and I’ve found where my mistake lies, but I haven’t fixed it yet.
I’m trying to use the parameter -PrinterName
as the InstallTitle
to change the name of the window. However, as soon as there are spaces in the name, the program fails to execute.
Here are some examples I’ve tried:
.\Invoke-AppDeployToolkit.exe -PrinterVendor "HP" -PortName "IP_1.1.1.91" -PrinterIP "1.1.1.91" -PrinterName Test
.\Invoke-AppDeployToolkit.exe -PrinterVendor "HP" -PortName "IP_1.1.1.91" -PrinterIP "1.1.1.91" -PrinterName "Test"
.\Invoke-AppDeployToolkit.exe -PrinterVendor "HP" -PortName "IP_1.1.1.91" -PrinterIP "1.1.1.91" -PrinterName 'Test'
All of these work fine. But as soon as I add a space in the name, the script either breaks or only displays the first word before the space:
.\Invoke-AppDeployToolkit.exe -PrinterVendor "HP" -PortName "IP_1.1.1.91" -PrinterIP "1.1.1.91" -PrinterName 'Test 1 2 3 4'
I’ve tried using single quotes, double quotes, and even escaping characters, but none seem to work when there’s a space in the name. Any ideas on how I can pass a value with spaces correctly?
I tried
$InstallTitle = $PrinterName
$InstallTitle = “"$PrinterName
”"
$InstallTitle = ‘"’ + $PrinterName + ‘"’
$InstallTitle = $PrinterName -replace ’ ', '` ’
Are you using this via ServiceUI or just from the command line? If via ServiceUI, the example from the bottom of the ticket should be fine. If it’s just from the command line, I don’t think anything more than double quotes should be needed. You could try -Parameter \"Parameter With Spaces\"
and see if that works.
2 Likes
Hi,
I’ve been running some tests, and the command you provided doesn’t seem to work. In fact, I noticed that almost all commands work fine when using the .ps1
script, but when I try to use the .exe
, that’s where things start failing.
For my printer name, I added underscores (_
), and in my script, I remove them.
Example:
-PrinterName My_Printer_Name
Now, I’m working on a Winget universal script using the extension. It’s working great, but when I need to pass additional parameters, the .exe
does not seem to process them correctly.
For example, parameters like:
"/SP- /VERYSILENT /SUPPRESSMSGBOXES /NORESTART /TYPE=full /LANG='Français'"
are not being applied as expected.
Has anyone encountered a similar issue or found a workaround?
Thanks!
Hi @Marc-Andre_Brochu,
I’ve closed your GitHub issue for now so we can keep the discussion concentrated in the one location (i.e. here).
~26 days ago, I asked “Are you using this via ServiceUI or just from the command line?”, but never heard back and it wasn’t addressed in your last message either. It’s important because there’s a lot of things at play if you’re trying to pass through parameter values, with spaces, via the exe, via ServiceUI.
Once we know more about this, we can continue to help you. As mentioned on the now-closed GItHub issue, parameters with space are verified to work (Deploy-Application.exe Does Not Support Spaces In Parameters · Issue #335 · PSAppDeployToolkit/PSAppDeployToolkit · GitHub) and (Any way to pass arbitrary parameters to Deploy-Application.exe? · Issue #200 · PSAppDeployToolkit/PSAppDeployToolkit · GitHub).
If you are indeed using ServiceUI, the info in this issue should be relevant: [Bug] Invoke-AppDeployToolkit.exe is not able to pass custom parameters containing spaces · Issue #1180 · PSAppDeployToolkit/PSAppDeployToolkit · GitHub.
2 Likes