Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I would like to get console2 to work nicely with UAC

Particular problems I would like to tackle:

  • If I start non-elevated, have a way to elevate while running. It'd be especially nice if I could elevate individual tabs
  • I would like to get different coloring for admin/non-admin, similar to: this link. Basically, if I can get the console to execute a command on startup (similar to the HKLM\Software\Microsoft\Command Processor\AutoRun registry value), that's all I need

How do I get this working? Would I have to modify source code to get this to work, or can I use different tab settings/do hacks w/ shell executables?

I am using Windows 7, although I would imagine any working solution would also work on Vista.

share|improve this question
6  
@harry - If you want to be entirely pedantic: This Q&A site is not a forum. And there's nothing wrong with self answering if you have a valid answer, which I personally think the OP does, because he's fixed part of the problem. –  DMA57361 Sep 1 '10 at 10:53
1  
@harrymc: which part of my usage do you disagree with? "How do I get this working? Would I have to modify source code to get this to work, or can I use different tab settings/do hacks w/ shell executables?" is the question. The answer I gave is what I found out while searching myself, which as harry says, is a valid usage of the site. –  Merlyn Morgan-Graham Sep 1 '10 at 16:23
3  
@harrymc: and if you read superuser.com/about, it absolutely is intended as a blog. Not that I used it in that manner –  Merlyn Morgan-Graham Sep 1 '10 at 16:24

3 Answers 3

Do you want to try ConEmu? I'm an author of this console emulator. You may run selected tabs elevated, or under specified credentials. And you may specify different palette for elevated consoles (or specified applications).

New tab parameters

share|improve this answer
    
Not sure if this qualifies as an answer for this question, but I'm interested in software like this in general. I'll give it a shot :) –  Merlyn Morgan-Graham Jun 11 '12 at 16:41
    
I think should be considered as an answer. It's much easier to setup to run as administrator and just as easy to change behavior(ie color) when running "elevated" –  Eric L Apr 14 '13 at 13:27
    
The trouble is, this option hasn't got the same feel as Console2. –  Umber Ferrule Jun 6 at 13:59
    
@UmberFerrule Trouble? Feel? It's different and more powerful. –  Maximus Jun 6 at 17:20

I solved part of it.

I would like to get different coloring for admin/non-admin

For some reason, bcdedit.exe is not showing up in the system32 directory when running within Console2 (Not sure why?). So, I had to find another command instead of using the one I found at the link in my question. I found another "do-nothing" command that would allow me to differentiate between admin/non-admin, that is visible in Console2.

In Console2, I set the shell option to:

%ComSpec% /k secedit /validate %ComSpec:cmd.exe=%ieuinit.inf >nul 2>nul && (color FC && title ADMIN) || (color 07 && title NONADMIN)

As far as this question...

If I start non-elevated, have a way to elevate while running. It'd be especially nice if I could elevate individual tabs

There are already a planned feature and related feature requests.

You can't work around this at this point. You can't start the app as LUA, and simply elevate specific prompts, because Console2 can't subsume applications w/ higher level access. It will only work the other way around. I think it would require the program to run elevated, but start via a non-elevated process, so it can shim in and start a non-elevated process. This is sometimes called a bootstrap.

I have tried PsExec, and it didn't work quite right. It stripped some admin rights out, but was still using an elevated token.

Basically, it won't be possible to get both elevated and LUA consoles in tabs of the same Console2 session, without a source change. But you can simply click the taskbar icon or shortcut with Ctrl + Shift + Click to launch as admin in a separate session.

Edit: I found that if you're using ansicon along with a command line tool that outputs color (like git), then this will be slightly broken. Try this command instead:

%ComSpec:cmd.exe=%secedit.exe /validate %ComSpec:cmd.exe=%ieuinit.inf >nul 2>nul && (color FC && title ADMIN) || (color && title NONADMIN)

If you're in admin mode, the red color will override the colors the command outputs, but there isn't an easy way to fix this. However I find that you shouldn't be doing a lot of work in admin mode anyhow. Hence UAC and hence the special colors we're adding.

share|improve this answer
    
It's possible with the latest versions of Console2, as you surely know. –  paradroid May 5 '11 at 20:11
    
@paradroid: I didn't know that since I haven't used it in a while :) Can you post this as an answer, and provide some extra details as to what it enables? If you do, and it gives good info, I will accept it. –  Merlyn Morgan-Graham May 5 '11 at 20:14
    
@Merlyn: Well Console2 enables you to open tabs as different users now, but I am not sure how it handles UAC, as I only use domain admin accounts usually, so I cannot give you a complete enough answer at the moment. –  paradroid May 5 '11 at 20:18
    
BTW, your profile said that you had not been on the site for around a month, so how did you get any notification of my comment so quickly, out of curiosity? RSS? –  paradroid May 5 '11 at 20:20
1  
@MerlynMorgan-Graham for anyone else who tries using "as user" in Console2, I found that Console2 kinda freaks out when you do this. I tried it to get PowerShell scripting to work with RemoteSigned execution. When I started the Powershell tab as an admin user, Console2 turned into a window that was 40px wide and 80px tall and couldn't be resized. So it was weird. –  jcollum Mar 29 '12 at 15:34

If you are willing to deal with a few popups (evereytime you create a tab) then you could go to edit > settings > tabs then in the shell section check the run as user then put in a user nme now a popup will appear and you can change the name and if you are a admin and login it will be admin if you are standard and login it will be standard :) hope it helps

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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