This article is part of the Microsoft Lync Server 2010 Administration Guide: PowerShell Supplement .
View a List of Computers Running Lync Server 2010
- To view a list of computers running Lync Server
Although not quite a perfect match, the following script largely replicates the information found on the TopologyStatus tab in the Lync Server Control Panel:
$errorPref = $errorActionPreference
$errorActionPreference = "SilentlyContinue"
$arrObjects = @()
$computers = Get-CsComputer | Sort-Object Identity
foreach ($objComputer in $computers)
{
$objSite = Get-CsPool -Identity $objComputer.pool | Select-Object Site
$objReplication = $Null
$objReplication = Get-CsManagementStoreReplicationStatus -ReplicaFqdn `
$objComputer.Identity | Select-Object UpToDate
$strReplication = $objSite.site -replace("Site:","")
$objDisplayObject = New-Object PSObject
Add-Member -InputObject $objDisplayObject -memberType NoteProperty `
-Name Identity -Value $objComputer.Identity
Add-Member -InputObject $objDisplayObject -memberType NoteProperty `
-Name Pool -Value $objComputer.Pool
Add-Member -InputObject $objDisplayObject -memberType NoteProperty `
-Name Site -Value $strReplication
Add-Member -InputObject $objDisplayObject -memberType NoteProperty `
-Name UpToDate -Value $objReplication.UpToDate
$arrObjects += $objDisplayObject
}
$labels = @{Expression={$_.Identity};Label="Computer"}, `
@{Expression={$_.Pool};Label="Pool"}, `
@{Expression={$_.Site};Label="Site"}, `
@{Expression={$_.UpToDate};Label="Replication"}
$arrObjects | Format-Table $labels
$errorActionPreference = $errorPref
To use this script, copy the code, paste it into a text editor, and then save the file using a .ps1 file extension (for example, C:ScriptsStatus.ps1). From there all you have to do is run the script from within the Lync Server Management Shell. For example:
C:ScriptsStatus.ps1
For more information
- Haiku # 81: The CsPool Cmdlets
- Haiku #67: The CsManagementStoreReplicationStatus Cmdlets
- Get-CsComputer
View the Status of Services Running on a Computer
- To view the status of services running on a computer
To view the status of all the Lync Server services running on all your computers, use the following command:
Get-CsService | Select-Object Role, PoolFqdn | Sort-Object PoolFqdn, Role
To view the services running on a specific computer, use this command, replacing atl-cs-001.litwareinc.com with the fully qualified domain name of the computer to be checked:
Get-CsService | Where-Object {$_.PoolFqdn –eq "atl-cs-001.litwareinc.com"} | Select-Object Role, PoolFqdn | Sort-Object PoolFqdn, Role
For more information
View Details About a Service
- To view details for a service
To view detailed information for a particular Lync Server service or server role, use the Get-CsService cmdlet followed by the service Identity:
Get-CsService –Identity service:Registrar:atl-cs-001.litwareinc.com
To view detailed information for all your Lync Server services or server roles, call Get-CsService without any parameters:
Get-CsService
For more information
Start or Stop Lync Server 2010 Services
- To start or stop all Lync Server services on a computer
To start all the Lync Server services on a computer, use the Start-CsWindowsService cmdlet:
Start-CsWindowsService -ComputerName atl-cs-001.litwareinc.com
Note that the ComputerName parameter is not required if you are starting the Lync Server services on the local computer.
To stop all the Lync Server services on a computer, use the Stop-CsWindowsService cmdlet:
Stop-CsWindowsService -ComputerName atl-cs-001.litwareinc.com
- To start or stop a specific service
To start a specific service, use the Start-CsWindowsService cmdlet along with the Name parameter:
Start-CsWindowsService –Name "RTCRGS" -ComputerName atl-cs-001.litwareinc.com
Use the Stop-CsWindowsService cmdlet to stop a specified service:
Stop-CsWindowsService –Name "RTCRGS" -ComputerName atl-cs-001.litwareinc.com
For more information
Prevent Sessions for Services
- To prevent new sessions for all Lync Server services on a computer
To prevent new sessions for all the Lync Server services on a computer use the following command:
Get-CsWindowsService | Stop-CsWindowsService -ComputerName atl-cs-001.litwareinc.com –Graceful
The Graceful parameter used with the Stop-CsWindowsService cmdlet ensures that all existing sessions will be honored but no new sessions will be allowed.
- To prevent new sessions for a specific service
To prevent new sessions for a specific Lync Server service, use the following command:
Stop-CsWindowsService -Name "RTCRGS" -ComputerName atl-cs-001.litwareinc.com -Graceful
For more information