Change the start mode/properties/status of a service.

      Set-Service [-name] string[] [ -displayName string ]
         [-description string] [-startupType { Automatic | Manual | Disabled }]
              [-Status string] [-ComputerName string[]] [-PassThru]
                 [-whatIf] [-confirm] [CommonParameters]

      Set-Service [-InputObject ServiceController] [ -displayName string ]
         [-description string] [-startupType { Automatic | Manual | Disabled }]
              [-Status string] [-ComputerName string[]] [-PassThru]
                 [-whatIf] [-confirm] [CommonParameters]
       Service name(s) to change. Wildcards are not permitted. 
       The service name may be piped.

   -DisplayName string
       A new display name for the Service. 

   -Description string
       A new description for the service.

   -ComputerName string[]
       Specify one or more computers. The default is the local computer. 
       Type the NetBIOS name, an IP address, or a fully qualified domain name
       of a remote computer.
       To specify the local computer, type the computer name, a dot (.), or "localhost".

       This parameter does not rely on PowerShell remoting.

   -InputObject ServiceController
       A ServiceController object that represents the service to be changed.
       Enter a variable that contains the object, or type a command or
       expression that gets the object, such as a Get-Service command.
       May be piped.

   -StartupType ServiceStartMode
       Change the starting mode of the service: Automatic or Manual or Disabled

   -Status string
Start, stop, or suspend (pause) the service. Valid values are:

Running Start the service.
Stopped Stop the service.
Paused Suspend the service. -PassThru Return objects that represent the services changed. -WhatIf Describe what would happen if you executed the command without actually executing the command. -Confirm Prompt for confirmation before executing the command. CommonParameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -WarningAction, -WarningVariable, -OutBuffer -OutVariable.


Set the start type of the sysmonlog service to automatic:

PS C:\> set-service sysmonlog -startuptype automatic

Display the start type of all services on the computer:

PS C:\> get-wmiobject win32_service | format-table Name, StartMode -autosize

Display the start type of the telnet service on the computer:

PS C:\> get-wmiobject win32_service | where {$_.Name -eq "tlntsvr"}

Change the display name of the lanmanworkstation service to "LanMan Workstation". (The default is "Workstation".):

PS C:\> set-service -name lanmanworkstation -DisplayName "LanMan Workstation"

Change the description of the Task Scheduler service on the machine Server64:

PS C:\> set-service -name Schedule -computername Server64 -description "Configures and schedules tasks."
PS C:\> get-wmiobject win32_service -computername Server64 | where-object {$_.Name -eq "Schedule"} | format-list Name, Description

“The best way to find yourself is to lose yourself in the service of others” ~ Mahatma Gandhi

Related PowerShell Commands:

Get-Service - Get a list of services
New-Service - Create a new service
- Restart a stopped service
- Resume a suspended service
- Start a stopped service
- Stop a running service
- Suspend a running service
Equivalent Windows commands: NET START / SC - Start/Stop Service

Copyright © 1999-2018
Some rights reserved