I recently had a customer that required 90 Common Area Phones creating in Skype for Business. This is quite a tedious task so the easiest way is to populate a CSV and use a PowerShell script to do the import.
When creating a Common Area Phone in Lync/SfB it can take a few seconds before you’re able to assign Policies and Pin numbers to the objects. This slows the script down significantly if waiting 20 seconds between creating the object, then assigning Policies. So, I’ve actually made three ForEach loops, the first one creates the Common Area Phone objects, then it waits 20 seconds before assigning policies to every object, then it waits another 20 seconds before assigning the pins (I found that assigning Pins would fail if I didn’t wait longer).
Tip – To generate 90 pin numbers I used https://www.randomcodegenerator.com/en/generate-codes. Set Characters to “Digits” and Output Result to “Txt File”. You can then copy and paste into your CSV in Excel.
Here is an example CSV file (CommonAreaPhones.csv):
DisplayName,LineURI,Description,DisplayNumber,ConferencingPolicy,PinPolicy,VoicePolicy,DialPlan,Pin Test Phone1,tel:+44123456789,Test Phone1,+44123456789,Conf-CommonAreaHotDesk,Pin-CommonAreaHotDesk,UK National,SITEA,123987 Test Phone2,tel:+44123456780,Test Phone2,+44123456780,Conf-CommonAreaHotDesk,Pin-CommonAreaHotDesk,UK National,SITEB,123989
Here is the PowerShell script:
Note – If the script fails assigning policies / pins due to not pausing long enough, you can hash out the “New-CsCommonAreaPhone” line and re-run the script to re-assign the policies and pins. You can also use this method if you need to change any policies.
<# Author: Chris Hayward, chrishayward.co.uk Purpose: Script to bulk import Common Area Phones from CSV Version: 1.0 Changes: DATE - Change #> $filepath = "C:\temp\CommonAreaPhones.csv" #Specify path to CSV file $pool = "FEPOOL01.mydomain.local" #Specify Lync/Skype for Business Pool $ou = "ou=Common Area Phones,dc=mydomain,dc=local" #Specify OU CLS # First of all, lets create all of the Common Area Phone objects....... Import-CSV $filepath | Foreach-Object{ New-CsCommonAreaPhone -LineUri $_.LineURI -RegistrarPool $pool -OU $ou -Description $_.Description -DisplayName $_.DisplayName -DisplayNumber $_.DisplayNumber } # Next we wait 20 seconds before assigning policies Write-Output "Waiting 20 seconds" Start-Sleep -s 20 # Now lets assign policies to each Common Area Phone Import-CSV $filepath | Foreach-Object{ Grant-CsConferencingPolicy -PolicyName $_.ConferencingPolicy -Identity $_.DisplayName Grant-CsPINPolicy -PolicyName $_.PinPolicy -Identity $_.DisplayName Grant-CsVoicePolicy -PolicyName $_.VoicePolicy -Identity $_.DisplayName Grant-CsDialPlan -PolicyName $_.DialPlan -Identity $_.DisplayName } # Wait another 20 seconds for AD/Skype to catch up otherwise setting pin may fail Write-Output "Waiting 20 seconds" Start-Sleep -s 20 # Finally, set the pin numbers Import-CSV $filepath | Foreach-Object{ Set-CsClientPin –Identity $_.DisplayName -Pin $_.Pin }
Technical Architect at Symity
Pingback: Skype for Business – Import Common Area Phones from CSV | ChrisHayward.co.uk – JC's Blog-O-Gibberish
Pingback: Monthly IT Newsletter – January 2017 – Guy UC World
Hi Chris,
Can you do an article on how to change a welcome message on an IVR that is more than 2 levels or more than 4 levels deep? EG. only through the Shell. I have an issue trying to change the welcome message and the out of business hours message, I have looked everywhere but can’t find it.
Many thanks
David
Pingback: Cheat sheet - Skype for Business | ErwinBierens.com