user208160
user208160

Reputation: 1

Passing a variable to msiexec in argumentlist doesn't work

So I've got this super simple script that uses msiexec to install a MSI, but it doesn't take the one of the flags. This is the the format that installs correctly:

msiexec /qn /i "C:\temp\DNS_Agent_Setup.msi" NKEY="1234567890"

This script block fails because the NKEY likely isn't accepted:

param(
  [String]$SITESECRETKEY
  )
$key = "NKEY=`"$SITESECRETKEY`""
$msiPath = "C:\temp\DNS_Agent_Setup.msi"

Invoke-WebRequest -Uri "https://download.dnsfilter.com/User_Agent/Windows/DNS_Agent_Setup.msi" -OutFile $msiPath
msiexec /qn /i $msiPath $key

Am I just dense?

When I replaced $key with NKEY="123457890" in: msiexec /qn /i $msiPath $key

It works

Upvotes: 0

Views: 46

Answers (0)

Related Questions