Set-Activesetup Stubpath quotes

Hi I am looking to use Set-ActiveSetup function with quotes for the stubpath but it keeps erroring out during the install and does not create an active setup entry. I need the double quotes due to spaces in the folder names like C:\Program Files (x86). I tried -StubExePath "$envProgramFilesX86\xyz" which does not show up any quotes when installed. ""$envProgramFilesX86\xyz"" and "`"$envProgramFilesX86\xyz`"" errors out and does not create any reg entry. So is there a way to have the quotes show up in the registry when the package is installed?

What error does this cause in the log file?

When -StubExepath is ""Path2exe""

[Post-Installation] :: Error Record:
-------------At C:\Temp\MicrosoftApp_1.0\Deploy-Application.ps1:171 char:38
+         Set-ActiveSetup -StubExePath ""$envProgramFilesX86\Apps Inst ...
+                                      ~~
Error Inner Exception(s):
-------------------------

When -StubExepath is "`"Path2exe`"" or it is '"Path2exe"'

[Post-Installation] :: Failed to set Active Setup registry entry. 
Error Record:
-------------At C:\Temp\MicrosoftApp_1.0\AppDeployToolkit\AppDeployToolkitMain.ps1:10673 char:4
+             [string]$StubExeExt = [IO.Path]::GetExtension($StubExePat ...
+             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Error Inner Exception(s):
-------------------------

[MOD: Added triple back-ticks to show log properly]

And what does it say when you don’t escape Path2exe?
Like:
-StubExepath "Path2exe"
or
-StubExepath $Path2exe

Using “Path2exe” or $Path2exe works without errors however there is no quotes in the registry string after the install. So the gaps between the folders cause an error when it runs. Ex C:\Program Files (x86)\App Installer\App.exe. Need to see how it can get the quotes in the registry after the install. “C:\Program Files (x86)\App Installer\App.exe”

I believe, like you, that this should be possible.

Please report it as a bug at Issues · PSAppDeployToolkit/PSAppDeployToolkit (github.com)

There are 2 workarounds:
1-change -StubExePath to a path without spaces
2-modify Set-ActiveSetup to check if the StubPath contains spaces and add double quotes just before it creates the value in the registry.

If you want workaround #2, I’ll need to know the version of PSADT and I’ll try to post a fix here (it will be untested though)

UPDATE: I’ve looked in PSADT 3.9.4 beta (PSADT 3.9.3 should be the same) and it does add the double quotes to the StubPath:
[String]$StubPath = "`"$CUStubExePath`""

I am using v3.8.4. #1 means I have to 8.3 folder names. #2 would be great if you could get a fix in. We are not ready for v3.9.3 yet, so thats out of the option for now. Thank you!!!

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