I have lab and in that ,collection of Linux computer are connected in LAN. i want how to writ e shell script to shut down all PC when we run that shell script.
I apologize I am not allowed to add a comment (not high enough rep?) so unfortunately have to post this as an answer
I'm curious too why answer was voted down too. There are a lot of merits in what @Cristian is answering and I agree that if OP doesn't have SSH daemon he would either state he needs a workaround OR he would realize maybe he needs it installed. Considering most of the answers for this type of thing would use SSH daemon I think it's a good answer.
That being said, I also agree that you should use root to do this and use ssh key authentication. That's the best and most secure answer. Of course you do not use a password in an ssh script - harder to do (probably would need to use expect) and less secure.
I don't know about using a non-root user to do a poweroff/reboot. Using the link you sent, you realize that the sudo user is configured to have no password and then poweroff the machine. That means any user that knows the username can sudo to that user and poweroff. Is that what you really want?
Apologies again that this is posted as a separate answer - I want to add it as a comment to @Cristian's answer as his answer is one I would vote for