Testing for Remoting Enabled in a script?

Is there any way to test if Remoting is enabled within a script? I’m looping over a collection of computers to get event log entries from each computer. I’m testing if the computer is available using
Test-Connection $c -quiet
But I can’t seem to find a similar method that will tell me if Remoting is running before I try to use Get-EventLog $c. I’ve tried using Test-WSMan but even wrapping that in a Try/Catch block doesn’t prevent the command from throwing an error.

Someone in StackOverflow posted this function:

Function Test-PSRemoting
{
Param($Computer)

$ErrorActionPreference = “Stop”
Try
{
if ((Invoke-Command -ComputerName $Computer -ScriptBlock {1}) -eq “1”)
{
return $true
}

        else
        {
        return $false
        }
}

Catch
{
return $false
}

}

Use it like:
Test-PSRemoting MyComputer
True

Someone also suggested adding “-ErrorAction SilentlyContinue” to the Test-WSMan command. Works great. Much more elegant than including another function in my module.