Using powershell.exe, I want to emulate cmd.exe's runas command with the additional benefit of escalating privileges through UAC.
However, if I both supply both -Credential and -Verb Runas parameters to Start-Process, I get the error below:
Start-Process powershell.exe -Credential (New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList 'username',(ConvertTo-SecureString 'password' -AsPlainText -Force)) -ArgumentList '-NoProfile' -Verb RunAs
Start-Process : Parameter set cannot be resolved using the specified named parameters.
At line:1 char:1
+ Start-Process powershell.exe -Credential (New-Object -TypeName System ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Start-Process], ParameterBindingException
+ FullyQualifiedErrorId : AmbiguousParameterSet,Microsoft.PowerShell.Commands.StartProcessCommand
Using only one of these parameters yields no errors:
Start-Process -Verb RunAs powershell.exe -ArgumentList "-NoProfile"
Why is that? Both syntax forms of Start-Process accept [<CommonParameters>], which -Verb Runas belongs to?