21

Is there a way to run a Powershell Prompt with Elevated privileges from a command linein Server 2012?

Problem is this is 'Minimal Server Interface' mode without full server-gui installed so I can run powershell from only either the command prompt or from ServerManager.

I am actually trying to run the command: Enable-ServerManagerStandardUserRemoting but although this appears to work it does not add the user in question to the various groups as it is supposed to do. I suspect it is not working properly because I am not running it from a fully elevated powershell prompt, just a standard prompt but as Administrator.

Thanks, Nick

25

Sure... works on Windows 7+, too.

Open Powershell first:

Type PowerShell to enter a PowerShell session.

Once in the session:

Type Start-Process PowerShell -Verb RunAs and press Enter.

That will open a new Powershell process as Administrator.

------- OR -------

To do it all with only one line from the command prompt, just type:

powershell -Command "Start-Process PowerShell -Verb RunAs"

  • Thanks, that probably worked. Enable-ServerManagerStandardUserRemoting still doesn't add the user to the groups but at least that rules out any lack of elevation problem. – NickC Jan 8 '13 at 16:15
  • I've never messed with that command...but I'm guessing you already looked here for details? technet.microsoft.com/library/jj205470 – TheCleaner Jan 8 '13 at 17:14
1

An alternative method is to do the following:

  1. type: runas /user:admin username powershell
  2. enter the appropriate password when prompted

You're done!

  • 2
    if you're going to use runas.exe, the first step is unnecessary, just run it from cmd.exe – Mathias R. Jessen Feb 18 '15 at 15:08
  • 1
    The difference here is mine was simply to run it elevated, not to run it as a different user. If you try mine out you'll see that you aren't prompted for additional credentials, it simply creates a new elevated shell. Yours is more for running Powershell as someone else. – TheCleaner Feb 18 '15 at 17:28
  • Mathias - thank you for correcting me, I'm by no means an expert! TheCleaner - Please don't misunderstand, your method is very good. I couldn't get it to work in my Core 2012 server setup but I'm sure it was my fault! So this was the alternative method, I'll edit the answer. – Opera512 Feb 18 '15 at 18:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.