Question: 8. Write a switch statement that will do the following: Test the status property of an object of type System Service Process Service Controller If

8. Write a switch statement that will do the following: Test the status property of an object of type System Service Process Service Controller If the status is stopped, write the service name followed by" is stopped". An example of the output is: wuauservis stopped If the status is running, write the service name followed by " is running". An example of the output is: wuauservis running If the status is anything else, use Write-Host to write the service name followed by " is not running or stopped". An example of the output is: wuauser is not running or stopped In order to test your code, use the following code and put the switch statement inside the foreach loop: $services = Get Service foreach ($service in $services) { ******* put switch statement here ********* PowerShell command: 8. Write a switch statement that will do the following: Test the status property of an object of type System Service Process Service Controller If the status is stopped, write the service name followed by" is stopped". An example of the output is: wuauservis stopped If the status is running, write the service name followed by " is running". An example of the output is: wuauservis running If the status is anything else, use Write-Host to write the service name followed by " is not running or stopped". An example of the output is: wuauser is not running or stopped In order to test your code, use the following code and put the switch statement inside the foreach loop: $services = Get Service foreach ($service in $services) { ******* put switch statement here ********* PowerShell command
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
