In this blog post, I will provide a Powershell menu choice script for adding functionality to your scripts.

If you are creating a script and want the user to be able to select between different choices, you can either have a pop-up or use a menu selection in the console. I prefer a menu selection in the console.

You can add more choices than two if you have the need to.

The Powershell menu script

$Title = "Select OS" 
$Message = "What OS is your favorite?" 
$WindowsME = New-Object System.Management.Automation.Host.ChoiceDescription "&Windows ME", `     "Windows ME" 
$MacOSX = New-Object System.Management.Automation.Host.ChoiceDescription "&MacOSX", `     "MacOSX" 
$Options = [System.Management.Automation.Host.ChoiceDescription[]]($WindowsME, $MacOSX) 
$SelectOS = $host.ui.PromptForChoice($title, $message, $options, 0)      
switch($SelectOS) {         
    0 {Write-Host "You love Windows ME!"}         1 
    {Write-Host "You must be an Apple fan boy"}     


Creating a Powershell menu script can be useful in many cases!

Related posts


  1. awesome script. however, I added some options and for a couple of my menu options it puts them on the same line.

    Is there any way to add line breaks between menu choices? Thanks in advance.


Please enter your comment!
Please enter your name here