Start-process with Credential argument

Hi.

I'm trying to start a process with different credential. I type my password in the dialog box, and after, I got this error :

Start-process : This command cannot be run due to the error: Incorrect parameter.

When I run this simple command, it work (but with wrong credentials) :

Start-process C:\Windows\regedit.exe

But, as soon I add the parameter "-credential Mydomain\adminuser" I have this error...

I tried a lot and lot things and else... like :

$Credential = "Mydomain\useradmin"
$Prog   = "C:/Windows/Regedit.exe"

$argList = @('-noprofile', "-command `"&{ & '$Prog' }`" ")
Start-Process powershell -verb runas -ArgumentList $argList
$Credential = get-credential
Start-process C:\Windows\regedit.exe -Credential $credential
And most other thing, but I always got this fucking error... I'm very disapointed, because I really don't understand why It refuse to run.

I'm tryied with only the "-verb runas" parameter, but it do not work too.

If someone have a solution for me, or any alternative command... :) I really need to do that in my office...

Thank's a lot

August 28th, 2015 3:17am

you must be logged in as an admin to run regedit. Just run it by typing "regedit"  It will prompt you for elevation.  No other way to d it.

The easiest way to run regedit is [windows key]+R and enter regedit.

Free Windows Admin Tool Kit Click here and download it now
August 28th, 2015 3:31am

I have to run regedit via a script. When I run it without any argument, it tell me "this functionnaly was desactivated by your administrator".

For info, I have the same issu for any program located on the "C:\windows" folder (as notepad, regedit, mstsc, active directory, etc...), but the only one i need to run it's regedit.

I'm sure there is a way to run theses programs anyway.

August 28th, 2015 3:44am

if it is blocked by your administrator then there is no way you can run it.

Free Windows Admin Tool Kit Click here and download it now
August 28th, 2015 3:47am

Right click on PowerShell icon and select "Run As Administrator" if you have admin credentials to use.

To runregedit from powershell and force prompt for credentials type:

Start-Process regedit -verb runas

August 28th, 2015 3:54am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics