When making a PowerShell script to do multiple, optional tasks, it is practical to use a menu to let user to select what to do.
There are several methods to create a PS menu. In this tutorial, I will show how to create a simple menu using a so called Do - While loop, which performs tasks until user selects to quit script. In this sample, I will create a menu to either export (backup), delete, start or stop (shut down) one or more virtual machines using grid view table selection (see tutorial).
You can view and download the sample script on my OneDrive. Line numbers used in this tutorial refer to line numbers shown in OneDrive Preview.
View and Download: SampleMenu.ps1
1. To start with, we create a menu, and store it to variable...