Powershell scripts to manage windows services

Below are powershell scripts to perform Start , Stop and Get Status of the windows services remotely

“Start” the Service :
Get-Service -Name servicename -ComputerName machine1,machine2 | Set-Service -Status Running
“Stop” the Service
Get-Service -Name servicename -ComputerName machine1,machine2 | Set-Service -Status Stopped
“Status” of the Service
Get-Service -Name servicename -ComputerName machine1,machine2

Other options

  • Regular expression can be used in the switch -Name like if collection of service starts with a name is “Application” then we can use -Name Application*
  • A particular service can be excluded while using regular expression using the switch -Exclude ApplicationName

Author: Raghull Sethuraman

Performance Architect

Leave a comment