Parameter cannot be processed because the parameter name 'p' is ambigious

Parameter cannot be processed because the parameter name 'p' is ambigious

where am I going wrong please?

In command prompt, you can see the following parameters can be used: enter image description here

This is the PSADT error:
enter image description here

the following is my PSADT code:

Execute-Process -Path 'Secrutiny_Guardicore_5.42.22165.14118_EN_01.exe' -Parameters ‘/a 10.0.0.0' '/offline' -installation-profile default -p kjlz6wm -WindowStyle 'Hidden'

答案1

To start, I believe your password is incorrectly formatted and its location should also be changed.

The way you have it with the -p kjlz6wm, you are setting the password in Powershell itself. But you are using Execute-Process which sends the string out to a CMD shell call, so the password is not getting included. To fix it you need to set the password within the CMD shell call instead so you will also need to use the slash that the executable expects /p kjlz6wm. Lastly, it is a parameter, so add it to the list of -parameters.

This might* work (* See the two notes below):

Execute-Process -Path 'Secrutiny_Guardicore_5.42.22165.14118_EN_01.exe' -Parameters '/p kjlz6wm' '/a 10.0.0.0' '/offline' -installation-profile default -WindowStyle 'Hidden'

Note 1: The Execute-Process command appears to be part of the PSAppDeployToolkit and after looking at their documentation I am not sure how they want multiple parameters separated. Powershell's Start-Process cmdlet separates each parameter by a comma, so your command may need to do that as well, maybe not.

Note 2: From their documentation PSAppDeployToolkit's Execute-Process, I do not see the -installation and -profile switches, so you may need to drop those.

I suspect the correct command should look similar to this:

Execute-Process -Path 'Secrutiny_Guardicore_5.42.22165.14118_EN_01.exe' -Parameters '/p kjlz6wm', '/a 10.0.0.0', '/offline' -WindowStyle 'Hidden'

We limit 3rd party cmdlets where I work, so we would write it like this:

$par = '/p kjlz6wm', '/a 10.0.0.0', '/offline'
$exe = 'Secrutiny_Guardicore_5.42.22165.14118_EN_01.exe'
Start-Process -Path $exe -Parameters $par -WindowStyle 'Hidden'

相关内容