Share via


Get-CsWindowsService

 

Topic Last Modified: 2012-03-23

Get-CsWindowsService returns detailed information about Microsoft Lync Server 2010 components that run as Windows services.

Syntax

Get-CsWindowsService [-Name <String>] [-ComputerName <String>] [-ExcludeActivityLevel <SwitchParameter>] [-Report <String>]

Detailed Description

Many Lync Server 2010 components run as standard Windows services; for example, the Lync Server Conferencing Attendant application is actually a service named RTCCAA. The Get-CsWindowsService cmdlet enables you to retrieve detailed information about these Lync Server services and only these services. That’s because the cmdlet has been designed to ignore any service that is not part of Lync Server.

The fact that Get-CsWindowsService automatically filters out non-Lync Server services is one advantage the cmdlet offers over the generic Get-Service cmdlet that ships as part of Windows PowerShell. In addition to that, there is another reason to use Get-CsWindowsService if you need to retrieve information for a Lync Server service: Get-CsWindowsService returns useful data that Get-Service does not return. For example, when returning information about the Lync Server Conferencing Attendant service, Get-CsWindowsService reports back the number of concurrent calls being handled by the service (the service activity level). Get-Service does not.

By default Get-CsWindowsService runs against the local computer. However, by including the ComputerName parameter you can return information about the Lync Server services running on a remote computer.

Who can run this cmdlet: By default, members of the following groups are authorized to run the Get-CsWindowsService cmdlet locally: RTCUniversalServerAdmins. In addition, you must also be a member of the Performance Monitor Users group 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 "Get-CsWindowsService"}

Parameters

Parameter Required Type Description

Name

Optional

String

Name of the service you want to return information for. 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; in addition you cannot use wildcards in the service name.

Note, too that Get-CsWindowsService can only return information for Lync Server services; you cannot use this cmdlet to return information for other Windows services. For those services, you might be able to use the Windows PowerShell Get-Service cmdlet.

If you do not include this parameter, Get-CsWindowsService will return information about all your Lync Server services.

ComputerName

Optional

String

Name of the remote computer from which service information is to be retrieved; if this parameter is not included, Get-CsWindowsService will return information about the Lync Server services running on the local computer. The remote computer should be referenced by using its fully qualified domain name (FQDN); for example, atl-mcs-001.litwareinc.com.

ExcludeActivityLevel

Optional

Switch Parameter

If included, this parameter causes Get-CsWindowsService to return only the service status and not the service activity level.

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).

Input Types

None. Get-CsWindowsService does not accept pipelined input.

Return Types

Get-CsWindowsService returns instances of the Microsoft.Rtc.Management.Deployment.Core.NTService object.

Example

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

Get-CsWindowsService

The command shown in Example 1 returns information about all the Lync Server services installed on the local computer. This is done by calling Get-CsWindowsService without any parameters.

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

Get-CsWindowsService | Format-List

Example 2 also returns information about the Lync Server services on the local computer; in this case, however, the data is displayed in list format. (Among other things, this enables you to view all the property values for each service. In the default, tabular view, only a subset of property values is displayed.) To carry out this task, Get-CsWindowsService is first called, then the resulting information is piped to the Format-List cmdlet.

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

Get-CsWindowsService -Name "RTCSrv"

Example 3 returns information for a single Lync Server service: the service with the name RTCSrv.

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

Get-CsWindowsService -Name "RTCSrv" | Select-Object -ExpandProperty RoleName

In Example 4, detailed information is displayed for all the service roles handled by the RTCSrv service. To perform this task, Get-CsWindowsService is first used to return information about the RTCSrv service. This information is then piped to the Select-Object cmdlet, which uses the ExpandProperty parameter to display all the roles handled by the RTCSrv service. Note that this command will return an error message if a service does not have a role name.

-------------------------- Example 5 ------------------------

Get-CsWindowsService -Computer atl-cs-001.litwareinc.com

The command shown in Example 5 returns information about the Lync Server services installed on the remote computer atl-cs-001.litwareinc.com. This is done by including the ComputerName parameter followed by the FQDN of the remote computer.

-------------------------- Example 6 ------------------------

Get-CsWindowsService -Report C:\Logs\Services.html

The preceding command returns information about all the Lync Server services installed on the local computer. In addition, the Report parameter is included in order to save error information to a file named C:\Logs\Services.html. If Get-CsWindowsService encounters any problems in retrieving service data, information about that problem will be recorded in Services.html.

-------------------------- Example 7 ------------------------

Get-CsWindowsService | Where-Object {$_.Status -eq "Running"}

In Example 7, information is returned only for the Lync Server services on the local computer that are currently running. To accomplish this, the command first calls Get-CsWindowsService to return a collection of all the Lync Server services, running or not running. This collection is then piped to the Where-Object cmdlet, which picks out only those services where the Status property is equal to Running.

-------------------------- Example 8 ------------------------

Get-CsWindowsService | Where-Object {$_.DisplayName -like "*Application Sharing*"}

Example 8 shows how you can retrieve information for a particular service even if you do not know the actual name of that service (in this case, RTCASMCU). To perform this task, Get-CsWindowsService is first called without any parameters; that returns a collection of all the Lync Server services on the local computer. This collection is then piped to the Where-Object cmdlet, which selects the one service where the DisplayName property includes (-like) the string value "Application Sharing". The end result: information is displayed for the Lync Server Application Sharing Conferencing service.

-------------------------- Example 9 ------------------------

Get-CsWindowsService | Where-Object {$_.RoleName -contains "ApplicationServer"}

Example 9 returns information about any services that host the Application Server role. To do this, the command first calls Get-CsWindowsService to return a collection of all the Lync Server services on the local computer. This collection is then piped to the Where-Object cmdlet, which selects those services where the RoleName property includes (-contains) ApplicationServer.