79602220

Date: 2025-05-01 16:51:17
Score: 0.5
Natty:
Report link

Please note:

    $YourString = '"/X' $id1 '/QN KLPASSWD=randompass'""

See @dennis's answer for better understanding.

If randompass contains spaces, you must enclose it in quotes, see @maximilian-burszley's comment.

The simplest way to use the ArgumentList parameter is to treat it as an array and not as a string. This makes it easier to debug any exceptions.

    $ParameterArgumentList =
        '/X',
        $id1,
        '/QN',
        'KLPASSWD=randompass'

The code excerpt would be:

    (Start-Process msiexec.exe -ArgumentList $ParameterArgumentList -Wait).ExitCode  

To display your array:

    Write-Output -InputObject $ParameterArgumentList
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • User mentioned (1): @dennis's
  • User mentioned (0): @maximilian-burszley's
  • Low reputation (0.5):
Posted by: João Mac