Lync Server PowerShell One-Liners
Address Book Sync
Update-CsAddressBook – Writes changes in backend DB to the address book files.
Update-CsUserDatabase – Synchronizes data between AD and Lync backend DB (rtcab).
Services
Get-CsWindowsService – Service Activity Level e.g number of current calls
Stop-CsWindowsService – Graceful – Stops service without terminating current activities
Central Management Store
1 2 3 |
Get-CsManagementStoreReplicationStatus –CentralManagementStoreStatus Get-CsManagementStoreReplicationStatus Invoke-CsManagementStoreReplication |
Topology
Export-CsConfiguration -FileName C:LyncConfig.zip – Exports topogoly to zip file
Announcement Service
New Announcement to SIP Address
1 |
New-CsAnnouncement -Parent service:ApplicationServer:<lync-pool001.domain.com> -Name "<Name>" -TargetUri sip:<sip address> |
New Announcement to Number
1 |
New-CsAnnouncement -Parent service:ApplicationServer:<lync-pool001.domain.com> -Name "<Name>" -TargetUri "sip:+6491234567@<sip address>;user=phone" |
New Announcement to Play Audio File
1 2 3 |
Import-CsAnnouncementFile -Parent "service:ApplicationServer:<lync-pool001.domain.com>" -FileName "<AudioFile.wav>" -Content (Get-Content "<path to audio file>" -ReadCount 0 -Encoding Byte) New-CsAnnouncement -Identity "service:ApplicationServer:<lync-pool001.domain.com>" -Name "<Name>" -AudioFilePrompt "<AudioFile.wav>" |
Remove Announcement
1 |
Remove-CsAnnouncement -Identity "Service:ApplicationServer:<lync-pool001.domain.com>/<identiy e.g. 656c46cf-12dd-45f2-9fa0-146531d83ac7>" |
Unassigned Numbers
1 |
New-CsUnassignedNumber -Identity "<Name for unassigned number range" -NumberRangeStart tel:<number start> -NumberRangeEnd "tel:<number end>" -AnnouncementName "<name of existing announcment>" -AnnouncementService Service:ApplicationServer:<pool where the announcement resides> |
Response Groups Hours of Business
1 2 3 4 5 6 7 8 |
$mon = New-CsRgsTimeRange -Name "Weekday Hours" -OpenTime "7:00" -CloseTime "23:59" $tue = New-CsRgsTimeRange -Name "Weekday Hours" -OpenTime "00:00" -CloseTime "23:59" $wed = New-CsRgsTimeRange -Name "Weekday Hours" -OpenTime "00:00" -CloseTime "23:59" $thu = New-CsRgsTimeRange -Name "Weekday Hours" -OpenTime "00:00" -CloseTime "23:59" $fri = New-CsRgsTimeRange -Name "Weekday Hours" -OpenTime "00:00" -CloseTime "23:59" $sat = New-CsRgsTimeRange -Name "Weekday Hours" -OpenTime "00:00" -CloseTime "07:30" New-CsRgsHoursOfBusiness -Parent "service:ApplicationServer:lync.domain.com" -Name "Mon7am-Sat730" -MondayHours1 $mon -TuesdayHours1 $tue -WednesdayHours1 $wed -ThursdayHours1 $thu -FridayHours1 $fri -SaturdayHours1 $sat |