Powershell script to restart services on multiple computers

Windows operating system runs many services in background and they all are managed through services.msc console. Few application issues can be fixed by restarting their respective service.

We can restart service of single computer by manually logging in to the computer using remote desktop connection, whereas if you experience issues with multiple computers then logging-in to each and every computer manually through remote desktop will consume more time.

To resolve this issue we use powershell scripts, using the powershell script we can restart windows service for bulk computers all at once and it saves huge amount of manual effort and time.

Powershell script to restart service on multiple computers:

We use get-content to get the list of computers and assigned it to the variable $Computers.

ForEach($Computer in $Computers)
<#Our Code Here#>

We use Get- Service followed by service name to find and fetch the service and passed the output to restart-service cmdlet using pipeline operator to restart the service. we used this script to restart BITS service on multiple computers