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.

Shankar
  • 219
  • 1
  • 4
  • 14

1 Answers1

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>
JosefZ
  • 1,564
  • 1
  • 10
  • 18