Set SIP Address For AD Users – PowerShell

I had a requirement to assign a SIP address to each AD account on my domain, this is to facilitate a rollout of Skype for Business. The lack of a SIP address stops Skpe (Lync) from autodiscovering the users address. The SIP value is stored in the ProxyAddresses attribute, however you can store it in the msRTCSIP-PriamryUserAddress attribute as long as you have extended your AD Schema.

Without the SIP present, users will see the following when launching SFB (Skype for Business)

After running the script, your attribute should look something like this:

Script:

<#
.SYNOPSIS
Sets UPN to ProxyAddresses AD field for SIP entry
.DESCRIPTION
Script will search through active directory and set all users with NO SIP address to have a SIP matching the users UPN
.PARAMETER $OU
Enter full distinguised name of OU you wish to limit search to
.NOTES
Version: 1.0
Author: dpadgett
Creation Date: 07/02/17
Purpose/Change: Initial script development
.EXAMPLE
Set-SIP.ps1 -OU "OU=Development,OU=Users,DC=company,DC=Group"
#>
[CmdletBinding()]
Param(
[Parameter(Mandatory=$True,Position=1)]
[ValidateScript({Get-ADOrganizationalUnit $_})]
[string]$OU
)
$results = Get-ADUser Filter * Properties DisplayName, SamAccountName , UserPrincipalName , proxyaddresses SearchBase $OU |
Select DisplayName , SamAccountName , UserPrincipalName , @{Name='SIPproxyaddresses';Expression={($_.proxyaddresses | Select-String Pattern "SIP:")}} |
Where-Object {$_.SIPproxyaddresses -eq $null}
ForEach($user in $results)
{
$samAccount = $user.SamAccountName
$SIP = "SIP:$($user.UserPrincipalName)"
Write-Host "Setting $samAccount – SIP; $sip "
Set-ADUser Identity $samAccount Add @{proxyAddresses=$SIP}
}

view raw
Set-SIP.ps1
hosted with ❤ by GitHub

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s