[This is preliminary documentation and is subject to change. Blank topics are included as placeholders.]

Stop-CsWindowsService enables you to stop a Microsoft Communications Server service.

Syntax

Stop-CsWindowsService [-Name <String>] [-ComputerName <String>] [-Confirm [<SwitchParameter>]] [-Force <SwitchParameter>] [-Graceful <SwitchParameter>] [-NoWait <SwitchParameter>] [-Report <String>] [-WhatIf [<SwitchParameter>]]
Stop-CsWindowsService [-Confirm [<SwitchParameter>]] [-Force <SwitchParameter>] [-Graceful <SwitchParameter>] [-InputObject <NTService>] [-NoWait <SwitchParameter>] [-Report <String>] [-WhatIf [<SwitchParameter>]]

Parameters

Parameter Required Type Description

Name

Optional

String

Name of the Microsoft Communications Server service you want to stop. Note that you must use the service name (e.g., RTCCAA) and not the service display name (e.g., Microsoft Communications Server Conferencing Attendant). You can only pass a single service name to the -Name parameter, and you cannot use wildcards in the service name.

Note, too that Stop-CsWindowsService can only stop Microsoft Communications Server services; you cannot use this cmdlet to stop other Windows services. For those services, you might be able to use Windows PowerShell’s Stop-Service cmdlet.

ComputerName

Optional

String

Name of the remote computer running the service to be stopped; if this parameter is not included, then Stop-CsWindowsService will stop the specified service (or services) on the local computer. The remote computer should be referenced using its fully qualified domain name; for example, atl-mcs-001.litwareinc.com.

InputObject

Optional

NTService object

Enables you to stop a service using an object reference rather than a service name. For example, if you use Get-CsWindowsService to return information about a service, and if you store the returned object in a variable named $x, you can then stop the service using this command:

Stop-CsWindowsService -InputObject $x.Name

Report

Optional

String

Path to an HTML file where error information can be written. If this parameter is included, any errors that occur during the running of this cmdlet will be logged to the specified file (e.g., C:\Logs\Service_report.html).

Graceful

Optional

Switch Parameter

Prevents a service from stopping if the service has dependent services (that is, services that cannot run unless the service in question is running). If this parameter is not included, then Stop-CsWindowsService will stop the specified service as well as all of the target service’s dependents.

Force

Optional

Switch Parameter

Suppresses the display of any non-fatal error message that might arise when running the command.

NoWait

Optional

Switch Parameter

When present, causes the command to execute and then immediately return control to the Windows PowerShell prompt. If not present, control will not be returned until the command has completed and a status report has been written to the screen.

WhatIf

Optional

Switch Parameter

Describes what would happen if you executed the command without actually executing the command.

Confirm

Optional

Switch Parameter

Prompts you for confirmation before executing the command.

Detailed Description

Many Microsoft Communications Server component run as standard Windows services; for example, the Communications Server Conferencing Attendant component is actually a service named RTCCAA. If you need to stop a Communications Server service you can do so using the Stop-CsWindowsService cmdlet.

Keep in mind that Stop-CsWindowsService can only stop Microsoft Communications Server services; an error will occur if you attempt to stop a non-Communications Server service (such as the print spooler) using this cmdlet. Functionally, Stop-CsWindowsService is very similar to the generic Windows PowerShell cmdlet Stop-Service. However, Stop-CsWindowsService includes a -ComputerName parameter that makes it easy to stop a service on a remote computer: you simply include the -ComputerName parameter followed by the fully qualified name of the remote computer. In addition, the -Report parameter enables you to keep a log of any errors that might occur when calling Stop-CsWindowsService.

Stop-CsWindowsService does exactly what the name implies: it stops any service it asks you to stop. This includes services that have dependent services: services that can only run if the service you are attempting to stop is running. By default, if you try to stop a service that has dependent services Stop-CsWindowsService will not only stop the service in question, but will stop all those dependent services as well. Because that could result in unexpected consequences, you can include the -Graceful parameter when calling Stop-CsWindowsService. When you include the -Graceful parameter Stop-CsWindowsService will stop a service only if that service has no dependent services that are currently running. If the service does have dependent services (and if at least one of those services is currently running) then Stop-CsWindowsService will not do anything at all. Instead, it will allow the service and its dependents to continue running.

Return Types

Stop-CsWindowsService stops instances of the Microsoft.Rtc.Management.Deployment.Core.NTService object.

Examples

-------------------------- Example 1 ------------------------

Copy Code
Stop-CsWindowsService -Name "RTCRGS"

The command shown in Example 1 stops the Response Group service on the local computer. The Response Group service is identified by including the -Name parameter and the name of that service: RTCRGS.

-------------------------- Example 2 ------------------------

Copy Code
Stop-CsWindowsService -Name "RTCRGS" -ComputerName atl-cs-001.litwareinc.com

Example 2 also stops the Response Group service; in this example, however, that service is located on the remote computer atl-cs-001.litwareinc.com. To stop a service on a remote computer, include the -ComputerName parameter followed by the fully qualified domain name of the remote computer.

-------------------------- Example 3 ------------------------

Copy Code
Get-CsWindowsService | Where-Object {$_.DisplayName -like "*Call Park*" | Stop-CsWindowsService

Example 3 demonstrates how you can stop a service even if you do not know the service name (in this example, RTCCPS). To do this, the command first calls Get-CsWindowsService (without any parameters) in order to return a collection of all the Microsoft Communications Server services on the local computer. This complete collection is then piped to the Where-Object cmdlet, which selects only those services where the DisplayName property includes (-like) the string value "Call Park". The filtered collection is then piped to Stop-CsWindowsService, which stops the Communications Server Call Park service.

-------------------------- Example 4 ------------------------

Copy Code
Get-CsWindowsService | Where-Object {$_.DependentServices.Count -eq 0} | Stop-CsWindowsService

The preceding command stops all the Microsoft Communications Server services that do not have any dependent services. To carry out this task, the command first calls Get-CsWindowsService without any parameters; that returns a collection of all the Microsoft Communications Server services on the local computer. This collection is then piped to the Where-Object cmdlet, which picks out those services where the Count (number of) dependent services is equal to (-eq) 0; if the Count property is equal to 0 that means that the service has no dependents. Finally, the filtered collection is piped to Stop-CsWindowsService, which stops each service that has no dependent services.