Is there a way to find out the IP addresses of all the computers on the subnet my script is running on?

Look here for some discussion and examples on the topic. You would have to try each node one at a time, but that's what computers are for...

Of course your computer may have multiple NICs and therefore multiple subnets to talk to.