0

I have a powershell instance that has admin rights.

In it I run the following command:

start-process MyProgram.exe

Powershell then tries to run MyProgram with admin privileges (because Powershell has them itself). I don't want this to happen, I want MyProgram to not have admin rights, as if I ran this command in a PowerShell instance without admin rights. How can I accomplish this?


Duplicate with How to run exe with/without elevated privileges from PowerShell

However, I wasn't able to find a solution over there which uses the start-process commandlet, which makes it more difficult / impossible to open a file with an .exe as start-process MyProgram.exe -file MyFile.txt would do.

Bassie-c
  • 198
  • 16
  • 1
    Consider passing the argument `-Verb Open` to `Start-Process` or `-Verb RunAsUser` – Maximilian Burszley Apr 24 '19 at 14:58
  • 2
    https://stackoverflow.com/questions/29266622/how-to-run-exe-with-without-elevated-privileges-from-powershell – coinbird Apr 24 '19 at 14:59
  • @TheIncorrigible1 , `-Verb Open` does not appear to change the behaviour, `-Verb RunAsUser` gives me a log in prompt, without even suggesting my currently logged in profile, so this isn't an ideal solution either, but entering my log in details did give me a program without admin privileges. – Bassie-c Apr 24 '19 at 15:07
  • 2
    Possible duplicate of [How to run exe with/without elevated privileges from PowerShell](https://stackoverflow.com/questions/29266622/how-to-run-exe-with-without-elevated-privileges-from-powershell) – Matthew Apr 24 '19 at 15:19
  • 1
    To be clear: You DO want the full instance of the PowerShell call to utilize administrative rights, but specifically NOT when it instantiates a line (or other code) such as `Start-Process`? If not, why not instantiate the PowerShell script fully as the non-elevated user? – gravity Apr 24 '19 at 15:29
  • @gravitymixes , well, I open the shell by default with admin rights, just so I don't have to worry about which type of shell I have open. But any other program I open with it (for example downloaded software etc.) I don't want to give these admin rights as well. So that would indeed mean that the `start-process` would run in admin mode, but just the opened process not. I would like to be able to type something in my shell to open some program (and give it normal rights), and I prefer to have my shell have admin rights. But I guess that's just not the designed workflow of Windows. – Bassie-c Apr 24 '19 at 15:39
  • 1
    @Bassie-c Then the marked duplicate is, in fact, exactly your answer. – gravity Apr 24 '19 at 16:29

0 Answers0