The Microsoft Windows PowerShell script below will request the hostname of a server as well as the service to be queried then provide the status of the service.

<#
.SYNOPSIS
This script will request the hostname of a server, the name of the service, then provide it’s status.
.DESCRIPTION
This script will request the hostname of a server, the name of the service, then provide it’s status.
.EXAMPLE
N/A.
.AUTHOR
Written by Noel Enrique Alvarez on Thursday, November 11, 2018.
#>

#Request the hostname of the server
$HOSTNAME = Read-Host “What is the hostname of the server?”

#Request the name of the service
$SERVICE = Read-Host “What is the name of the service?”

#Provide the status of the service
Get-Service -Name $SERVICE -ComputerName $HOSTNAME

#End of script