I tested the above script in my lab. There are 3 esxi hosts in my lab and SLPD service stopped for 2 hosts and running on 1 host. However, the output showing SLPD off only.
I've attached a screenshot for the host where SLPD running. Could you please have a look.