I had to modify line 28 and add '-Identity SERVERNAME' to get it to work for me. There may be an easier way to do this, but this may be of use to someone:
$HealthSetResult = (get-serverhealth -Identity SERVERNAME | Where-Object {$_.HealthSetName -eq $HealthSet})