Hello,
I am in school and am looking for some help. This is my assignment:
Unit 2 Lab Assignment 2
For this assignment, you will create a script that meets the following requirements:
This is the code I have so far:
$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 = [New-Object System.Management.Automation.Host.ChoiceDescription[]] ($A, $B, $C)
$result = $host.ui.PromptForChoice($title, $message, $options, 0)
switch ($result) { 0 {"You selected A." Get-Service} 1 {"You selected B." Get-Process} 2 {"You selected C." h:\ist321\systeminfo.ps1} }
I am getting an error message that says .\menu is not a recognized cmdlet.....
I am not expecting y'all to do my homework but my teacher is not helping with this. Any help would be greatly appreciated.
change this line
to
$options = [System.Management.Automation.Host.ChoiceDescription[]]($A, $B, $C)
then amend the CASE senario to:
switch ($result) { 0 { "** Option A **"; Get-Service } 1 { "** Option B **"; Get-Process } 2 { "** Option C **"; } }
This works great from ISE but is there any way to have the user menus look just as good when the script is being called from a desktop shortcut?