Use a Powershell Scriptblock

 

You can use a powershell scriptblok to execute a command on multiple computers.

If you use the invoke-command code you have to re-open the connection every time you execute a command to the remote computer. There are more ways to perform this task. This is just one of them.

This script uses credentials and some servers and pretents to stop a service. You can replace this however with every other command you choose naturally.

 

Leave a Reply

Your email address will not be published. Required fields are marked *