Starting PowerShell Automatically – Revisited
September 11th, 2016 by Charlie Russel and tagged $Profile, PowerShell v5
A few months ago, I posted a quick blog on how I set PowerShell to start automatically when I log in. Well, it occurred to me that I should extend that to show you how I set the console window parameters so that my PowerShell windows are the right size and font, since on all my systems I use the same basic settings (except for my Surface Book with the 4K addon monitor — my old eyes need a bit bigger on that, so I adjusted the values accordingly.)
The function I use to set the console size, font and font weight is: (FontSize here translates to 18 point on my FullHD systems)
Function Set-myDefaultFont () { $64bit = "HKCU:\Console\%SystemRoot%_System32_WindowsPowerShell_v1.0_powershell.exe" $Default = "HKCU:\Console" Set-ItemProperty -Path $Default -Name FaceName -Value "Consolas" Set-ItemProperty -Path $Default -Name FontSize -Type DWord -Value 0x00120000 Set-ItemProperty -Path $Default -Name FontWeight -Type DWord -Value 0x000002bc Set-ItemProperty -Path $Default -Name FontFamily -Type DWord -Value 0x00000036 Set-ItemProperty -Path $Default -Name QuickEdit -Type DWord -Value 0x00000001 Set-ItemProperty -Path $64bit -Name FaceName -Value "Consolas" Set-ItemProperty -Path $64bit -Name FontSize -Type DWord -Value 0x00120000 Set-ItemProperty -Path $64bit -Name FontWeight -Type DWord -Value 0x000002bc Set-ItemProperty -Path $64bit -Name FontFamily -Type DWord -Value 0x00000036 Set-ItemProperty -Path $64bit -Name QuickEdit -Type DWord -Value 0x00000001 }
That’s all there is to it. I’ve added this function to the Set-myPowerShellStart.ps1 script, and I call that whenever I create or log onto a new system. If you prefer different sizes or a different font, simply change the values to match what you need. For example, if you want a 16 point font, try a value of 0x00100000.
ETA: Fixed value of FontSize.
Posted in $Profile, Annoyances, PowerShell | Comments Off on Starting PowerShell Automatically – Revisited