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.

Royston
  • 433
  • 2
  • 9
  • 25
  • 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: https://support.microsoft.com/en-us/help/223300/how-to-enable-windows-installer-logging – Daniel Lee Nov 02 '17 at 14:28

1 Answers1

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

Manu
  • 1,685
  • 11
  • 27