Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I set a Windows Service to start automatically in PowerShell?

If I know a service name, and have enough permission, how do I set a Windows Service to be auto-restart in PowerShell?

I am using PowerShell 1.0, and the OS is Windows Server 2003.

like image 302
George2 Avatar asked Aug 02 '09 13:08

George2


People also ask

How do I set PowerShell to automatic services?

Set-Service uses the Name parameter to specify the service's name, BITS. The StartupType parameter sets the service to Automatic. Get-Service uses the Name parameter to specify the BITS service and sends the object down the pipeline. Select-Object uses the Property parameter to display the BITS service's status.

How do I force a service to Start in PowerShell?

To start or stop a service through PowerShell, you can use the Start-Service or the Stop Service cmdlet, followed by the name of the service that you want to start or stop. For instance, you might enter Stop-Service DHCP or Start-Service DHCP.

How do you set up an automatic service?

To change a service startup behavior, select the General tab, then click in the “Startup type:” list box then choose one of the four available options: Automatic (delayed) – Service start after Windows 10 is completely booted. Automatic – Service will start when Windows 10 starts.


1 Answers

You may be asking for:

Set-Service [service name] -startuptype automatic

See:

> get-help set-service

NAME
    Set-Service

SYNOPSIS
    Starts, stops, and suspends a service, and changes its properties.


SYNTAX
    Set-Service [-StartupType {Automatic | Manual | Disabled}] [-DisplayName <string>] [-PassThru] [-Status <string>] [
    -InputObject <ServiceController>] [-Description <string>] [-ComputerName <string[]>] [-confirm] [-whatif] [<CommonP
    arameters>]

    Set-Service [-Status <string>] [-StartupType {Automatic | Manual | Disabled}] [-Description <string>] [-Name] <stri
    ng> [-PassThru] [-DisplayName <string>] [-ComputerName <string[]>] [-confirm] [-whatif] [<CommonParameters>]
like image 190
Steve Gilham Avatar answered Nov 02 '22 10:11

Steve Gilham