Some Eye Candy for PowerShell

With the introduction of PowerShell as a modern replacement for the good old CMD, it became quickly the standard command line for Windows based systems . These days PowerShell commands Windows Server, Databases and even the Cloud. However, it still looks like the good old MsDos console from Windows 95.

In order to give the default PowerShell console some charm I created a little helper tool that allows to set the transparency of a Window. Actually it sets transparency for all Windows of a given process name. My little tool WinStyler uses the Win32 API to modify styling of existing Windows. Are you surprised that Windows allows transparent Windows? Don’t be. It had the ability since Windows 2000 but was never exposed to the end user. In order to modify a Window, we have to specify the process name and the new alpha value for the Window. In the case of PowerShell the call is  WinStyler –p PowerShell –a 200. Values between 1 and 255 are valid as alpha value. This also works for other programs. E.g. cmd.exe

And this is what PowerShell looks like on top of a nice Desktop Wallpaper.

imageIf you like it more minimalistic then call WinStyler with parameter –n (WinStyler -p PowerShell -n). This will remove the Border and Caption. While that looks pretty nice, you will loose the ability to resize the Windows and to call the Property Window. You can restore the chrome with the parameter –r (WinStyler -p PowerShell -r). Unfortunately it also causes some artefacts while scrolling.

image

PowerShell Profile Integration

If you like the transparent PowerShell Windows and want them to look like that by default then you can call WinStyler via your PowerShell profile. If a folder called WindowsPowerShell  does not already exists within your Documents folder then create it. Now add a file called Microsoft.PowerShell_profile.ps with the content below.  Also copy the WinStyler.exe into the folder. 

Microsoft.PowerShell_profile.p
  1. $env:Path += ";$Env:HOMEPATH\Documents\WindowsPowerShell"
  2. WinStyler.exe -p PowerShell -a 180 -n
  3. cls
  4. "Welcome master " + $env:Username

If your profile script fails then you probably have to lift the execution policy. The code below will change the execution policy. (Warning: This will also allow to run any other script on your machine. Including malware. Just saying.)

Code Snippet
  1. Set-ExecutionPolicy Unrestricted -Scope CurrentUser

Download the WinStyler binary here http://sdrv.ms/1mvgxEH.

If you would rather see what will be executed on your machine and want to compile it yourself then the C# source code can be found here http://sdrv.ms/1mvgAAj .

7 thoughts on “Some Eye Candy for PowerShell

  1. Tried it out and it worked like a charm. Thanks for your efforts and the thorough, clear setup explanation (all too rare!).
    One small question: Do you know if it’s possible (using winstyler) to make the powershell box transparent but keep the top border (with the menu and min/max buttons) solid? Just wondering.

  2. nice article there , i find my self using powershell a lot as scripting tool and for automating my task but ad like to know where it works on win8.1 pro

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s