Added some error checking when trying to execute commands on non SSH
sessions.