Change the start mode/properties/status of a service.
Syntax
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]
key
-Name
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.
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-CimInstance win32_service | Format-Table Name, StartMode -autosize
Display the start type of the telnet service on the computer:
PS C:\> Get-CimInstance 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-CimInstance win32_service -computername Server64 | where-object {$_.Name -eq "Schedule"} | Format-List Name, Description
Set multiple services to a manual startup:
$services = @(
"XblAuthManager"
"XblGameSave"
)
ForEach ($service in $services) {
# -ErrorAction SilentlyContinue in case the service doesn’t exist
Get-Service -Name $service -ErrorAction SilentlyContinue |
Set-Service -StartupType Manual
}
“The best way to find yourself is to lose yourself in the service of others” ~ Mahatma Gandhi
Get-Service - Get a list of services.
New-Service - Create a new service.
Restart-Service - Restart a stopped service.
Resume-Service - Resume a suspended service.
Start-Service - Start a stopped service.
Stop-Service - Stop a running service.
Suspend-Service - Suspend a running service.
Equivalent Windows commands: NET START / SC - Start/Stop Service.