简体   繁体   中英

Powershell Installing MSI Quiet Install with Features (ADDLOCAL)

I am trying to install an msi. I have written a Powershell script for automating the installation process. But when I try to set which features I want to install the installation fails. See the script I have written to do this below. The script works if I remove the ADDLOCAL section. But I need to set which features to install.

 #Start-Process -FilePath "C:\Windows\system32\msiexec.exe" -ArgumentList "/i", `"$MSIDirectoryPathAndFolderName`", "/qn", "/l*v", "`"L:\Log\InstallLog.log`"", "SQLSERVER=`"XXXXXX`"", "DBAUTOBACKUP=`"0`"", "APPPOOLDOMAIN=`"XXXXX`"", "APPPOOLUSER=`"XXX_XXXX`"", "APPPOOLPASSWD=`"XXXX`"", "ADQUERY=`"XXX-XXXX.com`"", "ADDLOCAL=`"AirportMap`"" -NoNewWindow -Wait

So the problem is with the ADDLOCAL section. I hope somebody could tell me what the problem is. The log file does not tell me what the problem is.

The problem is earlier in your command with your variable:

`"$MSIDirectoryPathAndFolderName`"

You're escaping the quotes by using backticks but this doesn't parse correctly as your not enclosing the argument within quotes to signify it's a string.

It either needs to be just the variable name:

$MSIDirectoryPathAndFolderName

or if you need quotes around the argument (likely if you've folder names with spaces in):

"`"$MSIDirectoryPathAndFolderName`""

It is ok I found out what the problem was. I was not installing some features that I should have been. It works now.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM