Start-CsWindowsService
Topic Last Modified: 2012-03-27
Start-CsWindowsService enables you to start a Microsoft Lync Server 2010 service.
Syntax
Start-CsWindowsService [-Name <String>] [-ComputerName <String>] [-Confirm [<SwitchParameter>]] [-Force <SwitchParameter>] [-NoWait <SwitchParameter>] [-Report <String>] [-WhatIf [<SwitchParameter>]]
Start-CsWindowsService [-Confirm [<SwitchParameter>]] [-Force <SwitchParameter>] [-InputObject <NTService>] [-NoWait <SwitchParameter>] [-Report <String>] [-WhatIf [<SwitchParameter>]]
Detailed Description
Many Lync Server 2010 components run as standard Windows services; for example, the Conferencing Attendant application is actually a service named RTCCAA. If one of your Lync Server services is currently stopped, you can restart that service by using the Start-CsWindowsService cmdlet.
Note, however, that Start-CsWindowsService can only start Lync Server services; an error will occur if you attempt to start a non-Lync Server service (such as the print spooler) using this cmdlet.
Functionally, Start-CsWindowsService is very similar to the generic Windows PowerShell cmdlet Start-Service; if you want, you could also use Start-Service to start a Lync Server service. On the other hand, Start-CsWindowsService includes a ComputerName parameter that makes it easy to start a service on a remote computer: you simply include the ComputerName parameter followed by the fully qualified domain name (FQDN) of the remote computer. Stop-Service does not have a comparable parameter. In addition, the cmdlet’s Report parameter enables you to keep a log of any errors that might occur when calling Start-CsWindowsService.
Like other Windows services, some Lync Server services have a dependency on another service; for example, the Lync Server Conferencing Attendant service cannot run unless the Application service is already running. If you try to start a service that depends on another service, Start-CsWindowsService will start both of those services. That means that, if you try to start the Conferencing Attendant service, the cmdlet will first start the Application service and then start the Conferencing Attendant service. However, Start-CsWindowsService will not automatically start any dependent services of a service: if you start the Application service, the command will not automatically start the Conferencing Attendant service as well.
Who can run this cmdlet: By default, members of the following groups are authorized to run the Start-CsWindows cmdlet locally: RTCUniversalServerAdmins. In addition, you must also have local administrator rights on the destination computer in order to run this cmdlet. To return a list of all the role-based access control (RBAC) roles this cmdlet has been assigned to (including any custom RBAC roles you have created yourself), run the following command from the Windows PowerShell prompt:
Get-CsAdminRole | Where-Object {$_.Cmdlets –match "Start-CsWindowsService"}
Parameters
Parameter | Required | Type | Description |
---|---|---|---|
Name |
Optional |
String |
Name of the Lync Server service you want to start. Note that you must use the service name (for example, RTCCAA) and not the service display name. You can only pass a single service name to the Name parameter, and you cannot use wildcards in the service name. Service names can be retrieved using the Get-CsWindowsService cmdlet. Keep in mind that Start-CsWindowsService can only start Lync Server services; you cannot use this cmdlet to start other Windows services. For those services, you might be able to use the Windows PowerShell Start-Service cmdlet. |
ComputerName |
Optional |
String |
Name of the remote computer hosting the service to be started; if this parameter is not included, then Start-CsWindowsService will start the specified service (or services) on the local computer. The remote computer should be referenced using its FQDN; for example, atl-cs-001.litwareinc.com. |
InputObject |
Optional |
NTService object |
Enables you to start 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 start the service using this command: $x = Get-CsWindowsService -Name "RTCCPS" Start-CsWindowsService -InputObject $x.Name |
NoWait |
Optional |
Switch Parameter |
When present, causes the command to run 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. |
Force |
Optional |
Switch Parameter |
Suppresses the display of any non-fatal error message that might occur when running the command. |
Report |
Optional |
String |
Path to an HTML file where error information can be stored. If this parameter is included, any errors that occur during the running of this cmdlet will be logged to the specified file (for example, C:\Logs\Service_report.html). |
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. |
Input Types
Microsoft.Rtc.Management.Deployment.Core.NTService object. Start-CsWindowsService accepts pipelined instances of the Windows service object.
Return Types
None. Instead, Start-CsWindowsService starts instances of the Microsoft.Rtc.Management.Deployment.Core.NTService object.
Example
-------------------------- Example 1 ------------------------
Start-CsWindowsService
The command shown in Example 1 starts all the Lync Server services on the local computer. This is done by calling Start-CsWindowsService without any parameters. Note that you will not receive an error if you try to start a service that has already been started.
-------------------------- Example 2 ------------------------
Start-CsWindowsService -Name "RTCRGS"
The preceding command starts the Response Group application service on the local computer. To do this, the command uses the Name parameter followed by the service name: RTCRGS.
-------------------------- Example 3 ------------------------
Start-CsWindowsService -Name "RTCRGS" -ComputerName atl-cs-001.litwareinc.com
The command shown in Example 3 also starts the Response Group application service; in this case, however, the service is started on the remote computer atl-cs-001.litwareinc.com. To start a service on a remote computer, include the ComputerName parameter followed by the FQDN of the remote computer.
-------------------------- Example 4 ------------------------
Get-CsWindowsService | Where-Object {$_.Status -ne "Running"} | Start-CsWindowsService
In Example 4, the command searches the local computer for all the Lync Server services that are not currently running, then starts each of these inactive services. To do this, the command first calls Get-CsWindowsService to return a collection of all the Lync Server services. This collection is then piped to the Where-Object cmdlet, which selects only those services where the Status property is not equal to Running. This filtered collection is then piped to Start-CsWindowsService, which starts each service in the collection.