I want to Start windows service from stopped state

D Vijayakumar VLR 126 Reputation points

Hi All,

I want to start windows service on remote servers through powershell, how to i start windows service from stopped or not running on multiple remote server via powershell script

Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,274 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Andreas Baumgarten 91,921 Reputation points MVP

    Hi @D Vijayakumar VLR ,

    maybe this his helpful:

    $serviceName = "bits"  
    $serverName = "Server01"  
    Get-Service -Name $serviceName -ComputerName $serverName | Set-Service -Status Running  


    (If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

    Andreas Baumgarten

  2. MotoX80 30,831 Reputation points

    I agree with Andreas's comment: "Please don't expect a ready to go script based on your individual requirements."

    Having said that, I have a script that I believe that I already shared with another user, that you might be able to use. I have not been able to find that forum thread, so here is the script.

    Note that in my testing on Win10 machines, I have found that KB5001649 appears to greatly affect the processing time of $service.StartType when run against remote machines. If you experience the same problem, then you may need to modify the script to do an Invoke-Command instead of specifying the computer name on the Get-Service cmdlet. You may also need to modify the testing of service status and starttype to suit your needs.

    # Script to start services that are set to start automatically, but are not running. 
    # Author: Dave K. (MotoX80 on MS forums) @GenuineMadware
    # KB5001649 appears to greatly affect the processing time of  $service.StartType 
    $AllServers = Get-Content c:\temp\serverlist.txt
    $Report = @() 
    "All services on all servers"
    foreach ($server in $AllServers) {
        "Analyzing {0}" -f $server
        $AllServices = $null 
        $AllServices = Get-Service -ComputerName $server
        "Found {0} services." -f $AllServices.count
        foreach ($service in $AllServices) {
            $report +=     [PSCustomObject]@{
                ComputerName = $server
                ServiceName  = $service.name
                Start        = $service.StartType
                Status       = $service.Status  
    "Total service count is {0}" -f $report.Count
    $report | Format-Table
    $failures = $report | Where-Object -Property start -eq Automatic | Where-Object -Property Status -eq Stopped
    "These services set to start automatically but are not running."
    $failures | Format-Table
    "Restarting non-excluded failed services."
    $exclude = @('MapsBroker','debugregsvc','sppsvc','isahelpersvc','gpsvc','gupdate','lltdsvc','edgeupdate')
    foreach ($service in $failures) {
        if ($exclude -notContains $service.ServiceName) {
            "Starting {0} on {1}" -f $service.ServiceName , $service.ComputerName
            Set-Service -Name $service.ServiceName -computername $service.ComputerName -Status Running
    0 comments No comments