Execute-MSI not accepting Parameters

I have been trying for the past 2 days and i cant figure this out.

I if run the MSI manually it will work as it should accepting the parameters.

if i run the same parameters in PSADT it doesnt work, and i cant figure out why.

Execute-MSI -Action ‘Install’ -Path “TeamViewer_Host.msi” -Parameters ‘CUSTOMCONFIGID=xxxxxx DESKTOPSHORTCUTS=0 IMPORTREGFILE=1 /QN’

The program installs itself normally, it just simply ignores the Parameters…

this is the only line in the script right now for testing purposes.

So can the problem be the MSI file?, or the script, im uncertain as to which…

no quotes around install??

using single quotes ‘Install’, but the install is working, its running the msi file, its just not running the msi file with the parameters.

not sure. I added the single quotes around ‘install’ on one of my scripts and changed my -Parameters to the same as yours and they pass through fine.

Do they show up in the logs?

They dont, the logfile doesnt show any indication that there is any parameters at all. so is there any chance that is a problem with the msi file, i have never experienced this type of problem before…

been using psadt the last 2 years, but cant figure this one out.

I would recommend using -AddParameters as this will append instead of replace the standard MSI parameters.

Or just create a blank .mst and add your properties to that.
Of course this dosnt fix the whole .msi not getting the paramaters - but gets you moving onto the next installation :slight_smile:

ps: isnt the /qn already handled ( in a config file by PSAD ) so you dont need to add that…maybe take that out and test again…

I have tested with both just a single parameters, and tried with each parameter alone, but i got a few pointers here i will test tomorrow.

Ye, /qn is already handled i belive, as the predefined parameters is added in the logfile…

but ill test both ideas tomorrow, and fix/bypass doesnt matter, as long its done:)

Put those parameters in variable and try again.
Something like this would work
$variable = “CUSTOMCONFIGID=xxxxxx DESKTOPSHORTCUTS=0 IMPORTREGFILE=1 /QN”

Execute-MSI -Action ‘Install’ -Path “TeamViewer_Host.msi” -Parameters ‘’$variable"

Play around with variable, i also faced similar issues and this method worked just fine.

Tried all 3 different suggestion and no go. still ignores everything about parameters except the default predefined ones.

-AddParameters had no effect.
$variable had no effect.

[Installation] :: Executing [C:\WINDOWS\system32\msiexec.exe /i “C:\WINDOWS\ccmcache\1a\Files\TeamViewer_Host.msi” REBOOT=ReallySuppress /QB-! /L*v “C:\WINDOWS\Logs\Software\TeamViewer_Host_Install.log”]…

This is what the logfile says. No xtra Parameters added. Almost like the file is anti-powershell designed…

I have many other psadt software controlled deployments and they all work fine, just not this one.

The interesting part is, if i go into AppDeployToolkitConfig.xml and add them to the InstallParams line.

<MSI_InstallParams>CUSTOMCONFIGID=xxxx DESKTOPSHORTCUTS=0 IMPORTREGFILE=1 REBOOT=ReallySuppress /QB-!</MSI_InstallParams>

then it works…

As TheTechGuy mentioned, use -AddParameters. Do not combine it with -Parameters. These parameters will be overridden by the default defined in the XML. You also won’t need to use the /QN either, the PSADT will determine this by default.

One of the coolest things about the PSADT is the Zero-Config MSI Install and I have modified my script template to provide this capability while using AddParameters. It is a very simple change.

Below is an example of how it can be implemented:

	## Handle Zero-Config MSI Installations
	If ($useDefaultMsi) {
		[hashtable]$ExecuteDefaultMSISplat =  @{ Action = 'Install'; Path = $defaultMsiFile; AddParameters = 'PRODUCT_KEY=”XX-XXXX-XX-X-XXX” RIBBON_OPTION=“MicrosystemsTab.xml”'; }; If ($defaultMstFile) { $ExecuteDefaultMSISplat.Add('Transform', $defaultMstFile) }
		Execute-MSI @ExecuteDefaultMSISplat; If ($defaultMspFiles) { $defaultMspFiles | ForEach-Object { Execute-MSI -Action 'Patch' -Path $_ } }
	}		

When there are no parameters to pass then you can remove AddParameters from the splat or use a space for the string so it won’t throw errors:

AddParameters = ' '

If you use single quotes, there is no need to escape the double quotes by using multiple double quotes (as suggested below) or the PowerShell escape character ‘ (backtick).

Hopefully this helps you.

@thomas_forde I had a similar issue with using -AddParameter in order to get mine to work I had to do something like this:

-AddParameters "CUSTOMCONFIGID=""xxxxxx"" DESKTOPSHORTCUTS=""0"" IMPORTREGFILE=""1"""

There are 3 "s after the last parameter of 1, closing the first " before CUSTOMCONFIGID

I am uncertain if the /QN will work with that or not, but you’re welcome to omit it to start to see if this syntax works for you. It definitely fixed my issues so hopefully it helps you! (make sure to type these out as copy/paste sometimes uses incorrect characters)

-Kyle

2 Likes

have you tried to remark out the Zero-Config MSI lines? maybe it’s not getting to your code at all??

1 Like

yes, its remarked out, from long time ago. Kyle’s suggestion seems to work pretty good.

And we are in business. the Triple quotation mark seems to do the trick… finally can lay this sucker to rest:)

1 Like

Fantastic news @thomas_forde! Glad that worked for you and thanks for the update!

Cheers!
Kyle