Adding a Simple Colorful Menu to PowerShell Script

Let’s consider an example of making a simple colored menu for PowerShell allowing a user to easily select one of the available options of the script being executed. The script provides a user with several options to choose, control the selected option and perform the further actions depending on the choice.

Let’s assume that our simple script allows a user to start or stop a certain Windows service (wuauserv).

Everything works well. The only thing is that the menu appearance leaves much to be desired. We would like to see something more elegant and convenient.

You can try to create a nicer menu with a colored heading, items and a frame manually but it is very time-consuming, as you will have to calculate table frame size manually depending on the length of text boxes. It is much easier to use a ready script. In Technet gallery, there is ready Create colorful PowerShell Menu Function (https://gallery.technet.microsoft.com/scriptcenter/Create-colorful-PowerShell-8689c5b2), with all necessary features. Save the function code to a file named color_menu.psm1 and import it into PoSh session:Import-Module C:\PS\color_menu.psm1