0

Fairly simple line in my Powershell script to run an install. The line works- the installer comes up and completed successfully. Yet this error persists.

Start-Process -Wait (msiexec.exe /I “C:\Temp\MBAM 2.5\Installers\x64\MBAMClient.msi”)

The error:

Start-Process : A positional parameter cannot be found that accepts argument ‘C:\Temp\MBAM 2.5\Installers\x64\MBAMClient.msi’
At line:1 char:1

Even though it works it’s important not to have errors in my console not only for obvious reasons but also for approval.

George Barron
  • 99
  • 2
  • 3
  • 10
  • Use **straight** quotes, not the curly thingies you get when copying from internet, MS Word, Outlook, etc. – Theo Feb 09 '21 at 15:35
  • They’re actually straight quotes, I typed this on my phone real quick as I’m not logged in on this test PC. Thanks though. – George Barron Feb 09 '21 at 15:39
  • What if you use the Call operator (`&`) as in `& msiexec.exe /I 'C:\Temp\MBAM 2.5\Installers\x64\MBAMClient.msi'` ?. P.S. The error shows an extra leading space in front of the path. Is that also a typo? – Theo Feb 09 '21 at 15:43
  • 1
    That was a typing error. I’ll try the operator now. – George Barron Feb 09 '21 at 15:47
  • Same exact issue using &. – George Barron Feb 09 '21 at 15:51
  • For the record: [there is a Powershell module for MSI](https://stackoverflow.com/a/53436779/129130). I have just tested it briefly, but it is from [Heath Stewart](https://twitter.com/mrhestew) of Microsoft. – Stein Åsmul Feb 09 '21 at 15:51
  • 1
    You removed the `Start-Process` right? `& msiexec.exe /I 'C:\Temp\MBAM 2.5\Installers\x64\MBAMClient.msi'` is the whole command – Theo Feb 09 '21 at 15:54
  • Or try `Start-Process msiexec.exe -Wait -ArgumentList '/I "C:\Temp\MBAM 2.5\Installers\x64\MBAMClient.msi"'` – Theo Feb 09 '21 at 16:04
  • [Seen this answer](https://stackoverflow.com/a/53442842/129130)? (I don't use Powershell much). – Stein Åsmul Feb 09 '21 at 16:20
  • @theo my final solution was simply ‘Start-Process -Wait ‘C:\Path...\’ works flawlessly and it’s simpler. Still no idea why I was getting the original error. – George Barron Feb 09 '21 at 17:17

1 Answers1

0

I fixed it by simplifying the command to:

‘Start-Process -Wait ‘C:\Temp\MBAM 2.5\Installers\x64\MBAMClient.msi’‘

That’s all it took. Installs, waits, and no error.

George Barron
  • 99
  • 2
  • 3
  • 10