Use PowerShell to Bulk Create New Conference Rooms

Doctor Scripto

Summary: Guest blogger, Tim Bolton, discusses how he used Windows PowerShell to create a bunch of new conference rooms. Microsoft Scripting Guy, Ed Wilson, is here. Today we have another guest blog post by Tim Bolton. In one way, today’s post is a continuation of the post we published on Friday about adding carriage returns to .csv files. It would be a good idea to review that post before reading today’s:

CSV: Add a Carriage Return for PowerShell Import Now, without further ado, take it away Tim… Due to a recent physical site relocation, I was tasked with creating new conference rooms at our new location. By using Windows PowerShell, I initially created the common area phones in Microsoft Lync and assigned the applicable numbers to each. Here are the steps I followed:



            Creating a Single New Lync Common Area Phone

            You MUST run this on a Microsoft Lync server

.Description To create a new Lync common area phone, you need the Number, Display Name, and Description, as shown in the following example:


            PS C:> .New-CommonAreaPhone.ps1 When you enter in phone number, such as  (972) 555-0185, it will be converted for LineURI and DisplayNumber:

            Enter Display Name

            Enter Description


            NAME: New-CommonAreaPhone.ps1

            VERSION: 3.1

            AUTHOR: Tim Bolton / Brian Peacock

            LASTEDIT: 09/18/2013




# Create new common area phone, Enter new phone number, display name, and description.

Do {

            $Phone=Read-Host “What is the New 10 digit Phone Number? – Example (972) 555-0185 “

            } while ($Phone -match “^ddd-ddd-dddd$” -ne “True” )

Do {

            $DisplayName=Read-Host “What is the Display Name – Example Phone – BigDog – Executive Conf. Room 197 “

            } while ($DisplayName.Length -le 5 )

Do {

            $Description=Read-Host “What is the Description – Example Something for the BigDog AD team “

            } while ($Description.Length -le 5 )

# Converts the number for LineURI & DisplayNumber

            $LineURI= “tel:+1” + $Phone.Replace(“-“, “”)

            [long]$Display=$Phone.Replace(“-“, “”)

            $DisplayNumber=”{0:(###) ###-####}” -f $Display


# That generates the contact object in Active Directory. Give this about 60 seconds to bake before you run the following script against it.

New-CsCommonAreaPhone -LineUri $LineURI -RegistrarPool “BD-lyncpool.Big.Dog.Com” -DisplayName $DisplayName -DisplayNumber $DisplayNumber -Description $Description -OU “OU=Contacts,OU=Users,DC=Big,DC=Dog,DC=com”


# Pause 60 Seconds for Lync Changes

write-host -foregroundcolor Green “Waiting for 60 Seconds Lync Changes to propogate”

Start-Sleep -s 60


# Then apply the PIN number and  policies in order.

Write-Host -foregroundcolor Yellow “Configuring Lync Policies for $DisplayName “

Grant-CSPINPolicy -identity $DisplayName -PolicyName “commonareapin”

Grant-CsVoicePolicy -Identity $DisplayName -PolicyName “BigDog-National”

Grant-CsDialPlan -Identity $DisplayName -PolicyName “BigDogPlace”

Grant-CsConferencingPolicy  -Identity $DisplayName -PolicyName “commonareaconferencing”

Grant-CsClientPolicy -Identity $DisplayName -PolicyName “commonareaclient-nohotdesking”


# Pause 60 Seconds for Lync Policies

write-host -foregroundcolor Green “Waiting 30 Seconds Lync Policies to propogate”

Start-Sleep -s 30

Write-Host -foregroundcolor Yellow “Configuring Lync PIN for $DisplayName “

Set-CSClientPIN -identity $LineURI -pin 123456


#Verify the application of the Policies.

write-host -foregroundcolor Green “Completeing Tasks”

Start-Sleep -s 10


Get-CsCommonAreaPhone –Identity $DisplayName


Exit The complete script is available in the Script Center Repository: New Lync Common Area Phone. After I created all of the phone numbers, I used a .csv file and Windows PowerShell to create the new conference rooms.  This must be completed on an Exchange Server with proper Admin credentials or by remotely using PSSession to connect to an Exchange Server. The .csv file headers consist of these known values:

Name, Alias, UserPrincipalName, Database, DisplayName, OrganizationalUnit, SamAccountName, RetentionPolicy, Notes, Description, Phone Initially, we wanted the rooms to be hidden so that users would not start booking the new conference rooms prior to them being available. To set the room to Hidden, I used the following script:

Write-Host -foregroundcolor Green “Waiting 30 seconds for Replication Then will set Hidden From Exchange to $True!”

Set-Mailbox -Identity $Entry.Alias -HiddenFromAddressListsEnabled $True After all of the conference rooms were created, we unhid them. The default setting for the HiddenFromAddressListsEnabled property is $False, which is what I used when all of the rooms were available:

Set-Mailbox -Identity $Entry.Alias -HiddenFromAddressListsEnabled $False ~Tim Thank you, Tim, for another interesting and useful post. Join me tomorrow when I will talk about creating virtual adapters on Hyper-V. It will be cool. I invite you to follow me on Twitter and Facebook. If you have any questions, send email to me at, or post your questions on the Official Scripting Guys Forum. See you tomorrow. Until then, peace. Ed Wilson, Microsoft Scripting Guy 


Discussion is closed.

Feedback usabilla icon