25 September 2013

Find a specific TelURI assignment

At times you may lose track of who has been assigned which Tel URI. Although its easy enough to grab a csv of all csusers or even dump to an html file, that is a larger hammer than is required.

A simple Lync Management Shell Script does the job:


Get-CsUser | where {$_.LineURI -eq "tel:+649xxxxxxx" -or $_.PrivateLine -eq "tel:+649xxxxxxx"} | format-table -property DisplayName,LineURI,PrivateLine

The result:



Granted you can search and filter from Lync Control Panel for Tel Uri, there is no way of finding Private Line URI's from the Control Panel

5 September 2013

Switching RGS Audio files

This script was created to allow a customer to quickly change the audio file (MOH) used by the RGS workflow. The idea was for an IT Service Desk that would announce known outages etc by means of their queue music. They would have a list of pre-recorded audio files and by means of the script simply select the file they wanted to use. OF course the use case can be anything really, sales specials, marketing pitch etc.

Download

4 September 2013

Lync Prerequisite install Script

Although I have blogged this before, I decided it needs to live here with all the other PS related stuff. So here it is.

Installing all the Windows prerequisites can be time consuming if done from Server Manager, this is way faster and doesn't make any errors ;-)

#Windows 2008 R2
Import-Module ServerManager

Add-WindowsFeature RSAT-ADDS, Web-Server, Web-Static-Content, Web-Default-Doc, Web-Http-Errors, Web-Asp-Net, Web-Net-Ext, Web-ISAPI-Ext, Web-ISAPI-Filter, Web-Http-Logging, Web-Log-Libraries, Web-Request-Monitor, Web-Http-Tracing, Web-Basic-Auth, Web-Windows-Auth, Web-Client-Auth, Web-Filtering, Web-Stat-Compression, Web-Dyn-Compression, NET-HTTP-Activation, Web-Asp-Net, Web-Mgmt-Tools, Web-Scripting-Tools, Web-Mgmt-Compat, Telnet-Client, BITS, Desktop-Experience

#Windows 2012 -  Requires access to the ISO, below assumes Lync iso is on E:\

Install-WindowsFeature RSAT-ADDS,Web-Server,Web-Static-Content,Web-Default-Doc,Web-Http-Errors,Web-Asp-Net,Web-Net-Ext,Web-ISAPI-Ext,Web-ISAPI-Filter,Web-Http-Logging,Web-Log-Libraries,Web-Request-Monitor,Web-Http-Tracing,Web-Basic-Auth,Web-Windows-Auth,Web-Client-Auth,Web-Filtering,Web-Stat-Compression,Web-Dyn-Compression,NET-WCF-HTTP-Activation45,Web-Asp-Net45,Web-Mgmt-Tools,Web-Scripting-Tools,Web-Mgmt-Compat,NET-Framework-Core,NET-HTTP-Activation,Desktop-Experience,Windows-Identity-Foundation,Telnet-Client,BITS -Source E:\sources\sxs

Move All OCS Users Homed on a Specific Pool to Lync

The below example is really just a one liner, but useful enough to be awarded its own post.

It Move All OCS Users Homed on a Specific Pool to Lync as well as sets conferencing policy and external access policy to automatic, rather than the legacy migrated OCS policies. 

NOTE Replace items in bold with your details as required

get-csuser -OnOfficeCommunicationServer | Where {$_.HomeServer -eq "CN=Users,CN=Auckland,CN=OCSPoolName,CN=Pools,CN=RTC Service,CN=Services,CN=Configuration,DC=LyncLab,DC=co,DC=nz"} | Move-CsLegacyUser -Target LyncPoolFQDN -ExcludeConferencingPolicy -ExcludeExternalAccessPolicy -Confirm:$FALSE

Set TelURI from AD Office Phone

For this one you need to have RSAT (Remote Server Administration Tools) installed
You could install that with the following line:
Add-WindowsFeature RSAT-AD-Powershell

#Importing the AD Module

Import-Module ActiveDirectory

#Collect all the Lync users and store as a variable $users = Get-CSUser

#The foreach loop Foreach ($user in $users)
{
   $Tel = $user.LineURI
   $Tel = $Tel.Replace("tel:", "")
   If ($Tel -ne "")
   {
      Set-ADUser -Identity $user.SAMAccountName -OfficePhone $Tel
   }
}

Change SIP domain for all users

It isn't everyday that you come across this but since many make the mistake of using their AD Domain name as their SIP domain, it does certainly come up.

Just remember that you will already have added the new SIP domain to the topology, all certificates sorted etc.

# Collect all the users and store as a variable
$Users = Get-CsUser

#The foreach loop
#Edit the bold bits to match your requirements

foreach ($User in $Users)
{
   $oldSIPDomain = $User.SipAddress
   $newSIPDomain = $oldSIPDomain -replace "@oldsipdomain.com", "@newsipdomain.com"
   Set-CsUser -Identity $User.Identity -SipAddress $newAddress
}

Running Lync Server Management Shell Remotely

Based on http://blogs.technet.com/b/nexthop/archive/2010/06/16/qsremoteaccess.aspx
First you will need to create a powershell script, next we will create a shortcut that runs the powershell script.
I use the following details in my script:-
******************************************************************************************************

Lync 2013 Backup Script

I have to admit the Lasse' scripting talents (and his willingness to share) has delivered some awesome scripts. Todays blog is evidence of his skills...his work is found here http://tech.rundtomrundt.com/p/lync-scripts.html

Thanks buddy!

<#
.Synopsis
   This is a script to make a backup of your Lync 2013 Enterprise edition server environment.
   It should be run on a windows server 2012, and a 2013 Lync server.
.DESCRIPTION
    A script to backup vital components in a Lync Enterprise Edition deployment
    Created by Lasse Nordvik Wedø - All rights reserved
    Http://tech.rundtomrundt.com

    - This script is for a Enterprise Edition Server.
    - The script has only been tested in single site topology. I suspect adjustments must be made for deployments with more than one site (If anyone would do so, or let me have access to such a deployment, please let me know)
    - This script has been tested with a co location of all databeses. If you require it to backup your Monitoring/archiving databases from seperate SQL servers, you must add these sources to the script.
    - The script should be able to run without any modification or input, unless you want to use other paths than I have entered.
    - The script must be run on a server where Lync PS is available.
    - If the script must be run in a PS3 environment, and will load all nessecary modules automatically
    - My script creates a directory C:\lyncbackup\, this may be edited if you like.
    - Certificates will only be backed up if you allowed for this when requesting and creating certificates.
    - Certificate backup is only done on the machine where the script is run
    - The creation of the zipfile can take a while. The script finishes before the zipfile is finished (If anyone know how to wait for this task before quitting the script, please let me know).
    - I highly recommend you test the script in your Lab, before running in your production environment

Show Assigned Users, Numbers and Policies in html

This one is a beauty!
My customer simply fires the Assigned_numbers.ps1 and gets an HTML file they can use to quickly spot DDI's, Policies etc. Since its HTML a ctrl-F assist nicely to find users and numbers

Original Script created by
Lasse Nordvik Wedø at http://tech.rundtomrundt.com/<#
.Synopsis
   A script to list all used numbers in a Lync deployment
.DESCRIPTION
    A script to list all used numbers in a Lync deployment
    Created by Lasse Nordvik Wedø

    V 1.1 - April 2012 - Added a function to count the number of users as well
    V 1.2 - June 2012 - Added a function to count and the number of users not enabled for EVas well
    V 1.3 - March 2013 - BugFIX + changing folder and filepath to a static value. Run this script without interaction.
    V1.3.1 -  Slightly Modified for my own use..by ME
                 Added additional columns to quickly see assigned policies
.EXAMPLE
   Assigned_numbers.ps1
#>

Data Collection for As Built dumped to CSV

This is really a data collection exercise I use to collect the Lync config and ship off site to include into the AsBuilt documentation.

########################################################################
# Author: Paul B
# Purpose: Script to Dump Lync Config for As Build Documentation
# Version: 1.0
# 02/01/2013 - Release 1.0
#Change
# Instructions
# Edit the below variables to match your requirements
#
########################################################################

Get-CsDialPlan | Export-Csv c:\PB\DialPlan.csv
Get-CsVoiceNormalizationRule | Export-Csv c:\PB\normalrules.csv
Get-CsRoutingConfiguration | Export-Csv c:\PB\routes.csv
Get-CsVoicePolicy | Export-Csv c:\PB\voicepolicy.csv
Get-CsTrunkConfiguration | Export-Csv c:\PB\Trunkconf.csv
Get-CsPstnUsage | Export-Csv c:\PB\PSTNUsage.csv
Get-CsUnassignedNumber | Export-Csv c:\PB\UnAssignedNumbers.csv
Get-CsAnnouncement | Export-Csv c:\PB\UnAssignedAnnouncement.csv
Get-CsConferencingPolicy | Export-csv c:\PB\confpol.csv
Get-CsExternalAccessPolicy| export-csv c:\PB\externalpol.csv
Get-CsClientPolicy | export-csv c:\PB\clientpol.csv
Get-CsRgsAgentGroup | export-csv c:\PB\RGSAgentGroup.csv
Get-CsRgsQueue | export-csv c:\PB\RGSQueue.csv
Get-CsRgsWorkflow | export-csv c:\PB\RGSWorkFlow.csv
Get-CsRgsWorkflow | select-object Identity | Export-Csv c:\PB\RGSConfiguration.csv
Get-CsRgsHolidaySet | export-csv c:\PB\RGSHolidayset.csv
Get-CsRgsHoursOfBusiness | export-csv c:\PB\RGSHoursOfBusiness.csv
Get-CsAccessEdgeConfiguration | export-csv c:\PB\AccessEdgeConfig.csv
Get-CsAllowedDomain | export-csv c:\PB\FederationAllowedDomains.csv
Get-CsBlockedDomain | export-csv c:\PB\FederationBlockedDomains.csv
Get-CsCallParkOrbit | export-csv c:\PB\CallPark.csv
Get-CsCdrConfiguration | export-csv c:\PB\CDRConfig.csv

AD Health Check

I have been using this from before my blogging days so cant remember who the original author was, but a big thanks to you anyway

AD Health Check
Dumps results in c:\adHealth.txt

Lync Data Collection in xml

########################################################################
# Author: Paul B
# Purpose: Script to Collect Lync Data
# Version: 1.0
# 03/02/2013 - Release 1.0
#Change
# Instructions
# Edit the below variables to match your requirements
#Purpose
#Collects Lync Config Data and Dumps in c:\Backup\LyncData
########################################################################