I'm trying a to make this PowerShell script that would ask for the user to input a service name, run through Get-Service
, and show the result to the user.
For example, if the user was to enter vmtools
it would show:
Status Name DisplayName
------ ---- -----------
Running vmtools VMware Tools
This is my code:
Write-host "Enter Service name"
$ServiceName = read-host
$Result = get-service $ServiceName
Write-Output "$Result"
However, it only outputs: System.ServiceProcess.ServiceController