1

I have used following command for my automation task. But it is throwing exception like below,

parameter set cannot be resolved

Command I used:

Start-Process -FilePath powershell.exe -NoNewWindow -ArgumentList $code -verb RunAs 

How to run the powershell commands in same command prompt ? and how to track that logs.

1
  • 1
    -Verb is not compatible with -NoNewWindow. Commented Aug 30, 2017 at 16:16

1 Answer 1

0

Each -Verb and -NoNewWindow parameters belong to different parameter sets of Start-Process cmdlet. For more information about parameter sets, read

Get-Help about_Functions_Advanced_Parameters 

and see Cmdlet Parameter Sets in the Cmdlet Parameters MSDN article.

Observe the following self-explicating results:

PS D:\PShell> $y=(Get-Command Start-Process).ParameterSets PS D:\PShell> $y.Count 2 PS D:\PShell> $y.Name Default UseShellExecute PS D:\PShell> Compare-Object $y[0].Name $y[1].Name InputObject SideIndicator ----------- ------------- UseShellExecute => Default <= PS D:\PShell> Compare-Object $y[0].Parameters.Name $y[1].Parameters.Name InputObject SideIndicator ----------- ------------- Verb => Credential <= LoadUserProfile <= NoNewWindow <= RedirectStandardError <= RedirectStandardInput <= RedirectStandardOutput <= UseNewEnvironment <= PS D:\PShell> 

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.