If I run the following command in a Poweshell script file ($cmd refers to some executable):
Start-Process -FilePath $cmd -Verb RunAs Powershell
Then it executes OK
But if I slightly modify it:
Start-Process -NoNewWindow -FilePath $cmd -Verb RunAs Powershell
Or like this:
Start-Process -FilePath $cmd -ArgumentList @("status") -Verb RunAs Powershell
... then the command fails with the following error message:
Start-Process : Parameter set cannot be resolved using the specified named parameters.
I wonder why this format is not accepted and how should I modify the command to both specify an argument list and option "-Verb RunAs..."
-NoNewWindow
and-Verb RunAs
cannot be combined since you can elevate the session currently used. Going to check and see if that is true. I read that they are incompatible – Arethaarethusa