Set-Service

Change the start mode/properties of a service.

Syntax
      Set-Service [-name] string[] [ -displayName string]
         [-description string] [-startupType {Automatic | Manual | Disabled}]
             [-whatIf] [-confirm] [CommonParameters]
key
   -name
       Service name(s) to change. Wildcards are permitted. 
   
   -displayName string
       A new display name for the Service. 

   -description string
       A new description for the service.
		
   -startupType ServiceStartMode
        Change the starting mode of the service: Automatic or Manual or Disabled

   -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, -OutVariable.

Examples

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"}

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

Related:

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



Back to the Top

© Copyright SS64.com 1999-2010
Some rights reserved