Better console for PowerShell and VITK

The stock Windows command prompt (cmd.exe) is pretty limited–if you want to use a better font or copy text in lines instead of clunky rectangular blocks, you need something else. For Windows command-line utilities, PowerShell, and the VI Toolkit (for Windows), I have been using the open-source Console2 with much satisfaction.  The tabbed interface is pretty cool:

Console2 with VI Toolkit and PowerShell tabs.

If that looks interesting, here is what you do:

  • Download Console2 (current version is 2.00 Beta, build 142); extract on your system somewhere
  • Grab this file with icons and a replacement configuration file (console.xml); extract into the same location
  • Make a shortcut to console.exe
    • Multiple tabs can be opened during launch by adding -t to your shortcut target (e.g., -t Console2 -t “VI Toolkit”)
  • Optional: fix your prompts

My configuration file has a few changes to the mouse behavior:

  • Left – select + copy automatically
  • Right – paste
  • Middle – pop-up menu

If you prefer to not use my entire configuration file, just copy the applicable portions from the <tabs> element.

I hope you  have enjoyed this slight diversion from the regular VCritical programming lineup.  Thanks for reading.

Related posts:

  1. VI Toolkit (for Windows) 1.5 and the PowerShell prompt
  2. PowerShell Prevents Datastore Emergencies
  3. Automating VI Client login
  4. VI Toolkit (for Windows) 1.5 released
  5. Finding thin-provisioned virtual disks with PowerShell

Tags: , ,

  1. Justin’s avatar

    Eric,
    I really like Console2, but so far I’m having trouble connecting to a VIServer because Console2 doesn’t allow the credential window to popup. You must pass it the credentials at the command line via -user/-password or via a PSCredential store. Is there a workaround to this?

    Reply

  2. Eric Gray’s avatar

    Justin,

    That’s odd. On my system, I get the pop-up window and authenticate just fine. (Is it behind your Console2 window?) You might consider the ConsolePrompting option, described here: http://blogs.msdn.com/powershell/archive/2008/06/20/getting-credentials-from-the-command-line.aspx

    Eric

    Reply

  3. Justin’s avatar

    Eric,
    After minimizing all my windows, it does look like the credential window is popping up but it is not gaining focus. I will look at the other command-line solutions as well. Thanks for your help!
    Any idea why Console2 isn’t giving the window focus as it should? Does yours get focus correctly?

    Reply

  4. Eric Gray’s avatar

    I have seen it both ways — window in the foreground and behind Console2.

    Reply

  5. Duane Haas’s avatar

    cant seem to get console.exe to run after poping your .xml in. i have all the peices installed (vmware ps extension/powershell/cmd)???? just double click on it and nothing happens

    Reply

    1. Eric Gray’s avatar

      Duane, hard to say based on my visibility. I’d start back with a known-working config and add one section at a time to see.

      Reply

  6. Christian Mohn (h0bbel)’s avatar

    This looks great. I’m having similar problems that Duane has, and it seems like the problem is related to the VI Toolkit setup. I run this on Windows Server 2008 64bit, so the paths to the vim.psc1 file needs to be updated to also include “C:\Program Files (x86)” instead of plain old “C:\Program Files”.

    Sadly I can’t seem to get it working either way, as Console2 doesn’t seem to like it if I add a new console with :

    C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -PSConsoleFile "C:\Program Files (x86)\VMware\Infrastructure\VIToolkitForWindows\vim.psc1" -NoExit -Command ". \"C:\Program Files (x86)\VMware\Infrastructure\VIToolkitForWindows\Scripts\Initialize-VITo"
    as the parameter. It seems to just revert it to “C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe” and thats it.

    Reply

  7. Christian Mohn (h0bbel)’s avatar

    Forgot to mention that everything, but the VI Toolkit, seems to work just fine. :)

    Reply

  8. Eric Gray’s avatar

    It looks like 64-bit systems have trouble with the 32-bit build. There is a 64-bit build here:
    http://www.rblasch.org/projects/console/ (get the 142.1 with the extra patch)

    To get the VI Toolkit to work, you need to edit the console.xml file and add ” (x86) after all of the \Program Files references.

    Christian was on the right track. The problem is you can’t edit with the GUI because the command line length is limited in that dialog box. Close Console2 and edit the file.

    Thanks for the feedback, guys. I’m sure it will help other readers with the same issues.

    Reply

  9. Christian Mohn (h0bbel)’s avatar

    Excellent. I’ll try the 64bit build at work tomorrow and revert back.

    Reply

  10. Christian Mohn (h0bbel)’s avatar

    Yay, success! Got it working on 64bit, with the patched Console2 version and edits to the console.xml file! Great stuff!

    Reply

  11. Duane Haas’s avatar

    my issue was i had not downloaded the latest build, probably downloaded the oldest build. got the latest and now all is good

    Reply

    1. Eric Gray’s avatar

      Thanks for the updates, guys. Good to hear.

      Reply

  12. TimC’s avatar

    I realize this post is over a year old, but I found it very helpful. With vitk basically being deprecated in favor of powercli, the vi-toolkit line needs to change. Lines 102 and 103 should look like this:

    <tab title=”vSphere PowerCLI” icon=”vitk15.ico”>

    This should all be one line:

    <console shell=”C:\WINDOWS\system32\windowspowershell\v1.0\powershell.exe -PSConsoleFile "C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\vim.psc1" -NoExit -Command ". \"C:\Program Files (x86)\VMware\Infrastructure\vSphere PowerCLI\Scripts\Initialize-VIToolkitEnvironment.ps1\" "” init_dir=”c:\scripts”/>

    Hopefully someone else that stumbles upon this finds it helpful.

    Reply

  13. Tao Yue’s avatar

    The way that Console2 works is that it brings up a standard console window far off-screen, hiding it, then screen-scraping and sending keystrokes to the (real) console window.

    So if the authentication window sometimes pops up in the background, just be happy that it doesn’t pop-up offscreen!

    Reply

  14. buraq’s avatar

    What is this ‘VI Toolkit (for Windows)’ ???

    Is it what’s called now vSphere SDK for Perl (??) Or am I mixing it up with something else?

    TIA

    Reply

    1. Eric Gray’s avatar

      This is the PowerShell management interface that is now known as PowerCLI.

      Reply

  15. buraq’s avatar

    Thanks Eric.

    Reply

  16. Maximus’s avatar

    Have you tried ConEmu?
    Open source windows console emulator (like Console), but it has many enhacements )

    Initially, the program was designed to work with Far Manager (my favorite shell replacement – file and archive management, command history and completion, powerful editor). But ConEmu can be used with any other console application or simple GUI tools (like PuTTY for example). ConEmu is a live project, open to suggestions.

    User reviews:
    http://sourceforge.net/projects/conemu/reviews/
    http://stackoverflow.com/a/10904494/1405560

    Reply

  17. Augusto’s avatar

    Thanks a lot for sharing this Eric! I wanted to use powershell with console2, but I’ve never thought of using VITK with it :) .

    Reply

Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>