Display System.Management.Automation.Host.ChoiceDescription as a list?

If I have the code as shown below, I get the output as shown in the attached picture. How do I get the options to display in a list mode that looks like the following?

[A] Option A
[B] Option B
[C] Option C
# Clears the Screen
# Define Main Level Title and Message Variables
$main_title = "PowerShell Network Management Console v1.0"
$main_message = "What management tasks would you like to perform?"
# Define Main Level Menu Options
$main_activedirectory = New-Object System.Management.Automation.Host.ChoiceDescription "&Active Directory Related", "Performs tasks related to Active Directory management."
$main_computer = New-Object System.Management.Automation.Host.ChoiceDescription "&Computer Related", "Performs tasks on and retrieves information from the specified computer or computers."
$main_exchange = New-Object System.Management.Automation.Host.ChoiceDescription "&Exchange Related", "Performs tasks related to Exchange management."
$main_quit = New-Object System.Management.Automation.Host.ChoiceDescription "&Quit", "Quits the PowerShell Network Management Console."
# Display Main Level Menu Options
$main_options = [System.Management.Automation.Host.ChoiceDescription[]] ($main_activedirectory, $main_computer, $main_exchange, $main_quit)
# Prompt for Main Level Menu Choice
$main_result = $Host.UI.PromptForChoice($main_title, $main_message, $main_options, 3)
# Handle Main Level Menu Choices
switch ($main_result)
		0 {ActiveDirectory_Menu}
		1 {Computer_Menu}
		2 {Exchange_Menu}
		3 {Quit_Menu}

Open in new window

LVL 14
Who is Participating?
dfxdeimosAuthor Commented:
Figured it out, I had to do something like what you see in the code example.
# Prompt for Main Level Menu Choice
$Main_Prompt = '
[1] Active Directory Menu
[2] Computer Menu
[3] Exchange Menu
[4] Quit
# Handle Main Level Menu Choices
switch (Read-Host $Main_Prompt)
		1 {ActiveDirectory_Menu}
		2 {Computer_Menu}
		3 {Exchange_Menu}
		4 {Quit_Menu}

Open in new window

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.