Start a stopped service on multiple devices using Powershell

powershell

Following on from our recent guide about restarting a service on multiple devices, we were also asked about starting a stopped service using a similar method.

This is pretty simple and can be carried out in almost exactly the same way.

Powershell Script

So to carry this out, you should create a txt file with the list of device names in it and then run the below Powershell script as an administrator:

$Servers = Get-Content C:\TGH\serverlist.txt
Invoke-Command -ComputerName $Servers -ScriptBlock 
 {       
    if ((Get-Service -Name spooler).Status -ne "Running") 
 {
    Start-Service -Name spooler
 }
}

Variables

The variables you will be most interested in changing are:

  • C:\TGH\serverlist.txt – this is the file location and filename of the text file that you have created with all the device names in where you want to start the service. You can manually fill this in or use an Active Directory export or gather it from Configuration Manager data. The only information in there is the NETBIOS name of each device.
  • Spooler – this is the name of the service that you wish to restart. For this guides purpose we have used the Print Spooler – with the service name being Spooler:

Spooler Service

Remember not to use the Display Name of Print Spooler.

Then go ahead and run the Powershell script and it will go through your full list of devices from the txt file that you created and restart the single service on each of the devices.

Feedback

If you have any questions or feedback on this guide, then please feel free to leave us a message below in our comments section. Don’t forget that you can also download this guide as a free PDF eBook.

Free Subscription!Subscribe to our site to receive updates via email!

Enter your email address below and click the Subscribe button to receive email notifications about new and exciting downloads available through our website at https://www.techygeekshome.com

You will also receive notifications about new technical guides, latest news and MSI installer downloads that are available through our blog here at https://blog.techygeekshome.info 

We will not spam you and we will not pass on any of your details to anyone else. We tend to post new content once or twice a week.

Join 155 other subscribers

You can unsubscribe any time you like.

About A.J. Armstrong

Founder of TechyGeeksHome and Head Editor for over eight years! IT expert in multiple areas for over 20 years. Sharing experience and knowledge whenever possible! Making IT Happen.

View all posts by A.J. Armstrong

Leave us a message...

This site uses Akismet to reduce spam. Learn how your comment data is processed.