2
$cs = New-PSSession -ComputerName MACHINE -Credential DOMAIN\admin
Copy-Item -Path C:\Scripts\smart -Destination C:\smart -ToSession $cs
msiexec /i "C:\Smart\SMART.msi" NB_PROD_KEY=NC-2ADA2-F9RKE-AKAIA-BBB ACTIVATE_LICENSE=1 INSTALL_INK="" LAT_CONTENT="" PRINT_CAPTURE="" INSTALL_DOCCAM_DRIVERS="" CUSTOMER_LOGGING=1 /qnT="" INSTALL_SPU=2 CUSTOMER_LOGGING=0 /qn

Hi,

I'm struggling to get the syntax that runs with the MSI working above - I've worked with switches inside script blocks which invoke commands beforfe successfully but, not with those parameters which are from the program vendors help file.

I also tried:

Start-Process "msiexec.exe" -Argumentlist "/i "C:\smartmsi\SMART.msi" `
NB_PROD_KEY=NC-2ADA2-F9RKE-AKAIA-BBB ACTIVATE_LICENSE=1 INSTALL_INK="" LAT_CONTENT="" PRINT_CAPTURE="" INSTALL_DOCCAM_DRIVERS="" CUSTOMER_LOGGING=1 /qn

Totally confused how to install using the vendors commands within POwerShell, how can i nest each argument if it's not a switch?

I also tried using Splatter:

$params = '/i', "C:\smartmsi\SMART.msi",
          'NB_PROD_KEY=NC-2ADA2-CEAM7-F9RKE', 'ACTIVATE_LICENSE=1',
          '/qn'
& msiexec.exe @params
$LastExitCode

No joy - this app will install remotely as a regular install.

Thanks in advance

UPDATE:

Now, i've also tried this:

invoke-command -Session $session -ScriptBlock {
Start-Process -FilePath C:\windows\system32\msiexec.exe `
-ArgumentList "/i `"C:\smart\SMARTSuite.msi`" `"NB_PROD_KEY=NC-2ADA2`" ACTIVATE_LICENSE=1 INSTALL_INK=`"`" LAT_CONTENT=`"`" PRINT_CAPTURE=`"`" INSTALL_DOCCAM_DRIVERS=`"`" CUSTOMER_LOGGING=1 /qn"

}

Still not working. Installer appears for a second then drops off.

1
  • Can you turn on MSI logging? The log file should indicate what the install sees for a command line. To turn on logging in the registry see this article: support.microsoft.com/en-us/help/223300/… Commented Nov 2, 2017 at 14:28

1 Answer 1

3

You have to escape `" if you want them to be interpreted inside a string which already uses double quotes else you break the string chaining :

Start-Process -FilePath msiexec -ArgumentList "/i `"C:\smartmsi\SMART.msi`" NB_PROD_KEY=NC-2ADA2-F9RKE-AKAIA-BBB ACTIVATE_LICENSE=1 INSTALL_INK=`"`" LAT_CONTENT=`"`" PRINT_CAPTURE=`"`" INSTALL_DOCCAM_DRIVERS=`"`" CUSTOMER_LOGGING=1 /qn"

You don't have to escape double quotes if the string is surrounded by simple quotes

Sign up to request clarification or add additional context in comments.

4 Comments

is that a backtick on the left side of the number 1 keyboard button?
Yes that’s a backtick
OK, thanks for confirming. is there any reason why the last double quote is not back-ticked? /qn"
@SeniorSystemsEngineer It's the closing quote for -ArgumentList parameter

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.