Following script will start the service "Browser"
$sb={
$service=get-service browser
if ($Service.status -eq "Stopped") {
write-Host "Starting service on $env:Computername" -foreground Green
$service | Start-service -PassThru
}
else {
$service
}
}
To run the above script type following command:
invoke-command $sb -comp remotecomputername
Result will be as follows: