Suspend-Service

Get the access control list for a file or object.

Syntax
      Suspend-Service { [-name] string[]
                      | [-displayName] string[]
                      | [-inputObject ServiceController[]] }
                           [-include string[]] [-exclude string[]]
                              [-passthru] [-whatIf]
                                 [-confirm] [CommonParameters]

Key
   -name string
       The service names to be suspended.

   -displayName string
       The display names to be suspended, wildcards are permitted.

   -inputObject ServiceController
       Suspend the services represented by ServiceController.
       Enter a command, expression or variable contains the objects.

   -include string
       Suspend only the specified services. Qualifies the -Name parameter.
       Wildcards , such as "s*" are permitted.

   -exclude string
       Omit the specified services e.g. "*SS64*"
       Qualifies the -Name parameter, Wildcards are permitted.

   -passThru 
       Pass the object created by Suspend-Service along the pipeline. 

   -whatIf
       Describe what would happen if you executed the command without
       actually executing the command.

   -confirm
       Prompt for confirmation before executing the command.

Examples

Suspend the Telnet service (Tlntsvr) service:

PS C:\> suspend-service -displayname "Telnet"

Use the pipeline operator to pass an object from Get-service to Suspend-service:

PS C:\> get-service schedule | suspend-service

Suspend all services that can be suspended, this is done by selecting only services with a value of "True" for the CanPauseAndContinue property:

PS C:\> get-service | where-object {$_.CanPauseAndContinue -eq "True"} | suspend-service -confirm

“If you've spoken to a non-geek recently, you may have noticed that they have no idea what the difference is between "sleep" and "hibernate” ~ Joel Spolsky

Related PowerShell Cmdlets:

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.
Set-Service
- Make and set changes to the properties of a service.
Start-Service
- Start a stopped service.
Stop-Service
- Stop a running service.
Equivalent Windows command: NET START / SC - Service Control.


 
Copyright © 1999-2020 SS64.com
Some rights reserved