PowerShell CheatSheet – Console Customization

Want to make the PS Console your own?

  1. Colors
    Turns the console’s background


    Turns the characters color


    Gets back the default colors parameters

    [console]::ResetColor() ; cls
  2. Layout
    Increases the buffer’s height


    Increases the buffer’s width


    Gets back the default Buffer parameters


    Increases the console’s windows height


    Increases the console’s windows width


    Gets back the default console’s windows parameters

  3. Fonts
    Use ‘Consolas’ font in your console

    $key = "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Console\TrueTypeFont"
    ## Find out if Consolas is installed on the system
    if(!(test-path (join-path $env:windir "Fonts\CONSOLA.TTF")))
            write-host "The Consolas font is not installed on the system."
            write-host "Install Microsoft Office 2007 Beta to obtain the font."
    ## Determine if Consolas is already installed as a command window font
    $installed = get-itemproperty $key |
                 get-member |
                 where-object { $_.Name -match "^0+$" } |
                 where-object { $_.Definition -match "Consolas" }
    if($installed -ne $null)
            write-host "The Consolas font is already installed as a command window font."
    ## Find out what the largest string of zeros is
    $zeros = (get-itemproperty $key |
             get-member |
             where-object { $_.Name -match "^0+$" } |
    ## Install the font
    new-itemproperty $key -Name ("0" * ($zeros + 1)) -Type string -Value "Consolas"
    write-host "Consolas font installed successfully as a command window font."

    Needs at least a logoff/logon to be effective.

  4. Misc.
    Modifies the console’s title

    [console]::Title="My custom PowerShell console"

    Modifies the cursor’s size


    Hides the cursor


    Makes her shout!


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top