Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Create a script that meets these requirements. Includes appropriate comments (se

ID: 3538252 • Letter: C

Question

Create a script that meets these requirements.


Includes appropriate comments (see comment document within the course shell).

Clears the screen

Creates the menu displayed below with any additional formatting you may desire



Prompts the user to choose a menu option

Assigns the value chosen by the user to the variable $choice

Prints "You chose option X" to the screen. Where X is the actual key that they pressed.

Requirements for "Show Services" menu item

Displays services sorted by status

Creates a csv file named services.csv with the same content and the data displayed on screen


Requirements for "Show Processes" menu item

Displays Process name and amount of Virtual Memory used

Display is sorted by amount of Virtual memory

The output is displayed in a web browser

Name the web page file processes.htm


Requirements for the "Show System Information" menu item

Displays output from systeminfo.ps1 script


Save the script as menu.ps1

Explanation / Answer

$title = "System Utilities"
$message = "Select which utility you would like to view."

$A = New-Object System.Management.Automation.Host.ChoiceDescription "&A", ` "Show Services."

$B = New-Object System.Management.Automation.Host.ChoiceDescription "&B", ` "Show Processes."

$C = New-Object System.Management.Automation.Host.ChoiceDescription "&C", ' "Displays systeminfo.ps1"

$options = [System.Management.Automation.Host.ChoiceDescription[]]($A, $B, $C)

$result = $host.ui.PromptForChoice($title, $message, $options, 0)

switch ($result)
    {
        0 {
           "** Option A **";
           Get-Service
          }
        1 {
           "** Option B **";
           Get-Process
           }
        2 {
           "** Option C **";
            }
    }

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote