Thursday, March 15, 2012

Script to compare an Enterprise Voice number to the assigned one in AD


Import-Module activedirectory
Import-Module lync

Get-csUser | where  {$_.EnterpriseVoiceEnabled -eq 'true'} | foreach{
$u = get-aduser -Properties telephoneNumber -Identity $_.Identity.tostring()
If ($u -ne $null)
{
#strip out all non numerical values
$rawdigits = $u.telephonenumber -replace '\.',''
$rawdigits = $rawdigits -replace '\s',''
$rawdigits = $rawdigits -replace '\(',''
$rawdigits = $rawdigits -replace '\)',''
$rawdigits = $rawdigits -replace '-',''
$rawdigits = $rawdigits.trim()

$LyncLineuri = $_.lineuri

$LyncLineuri = $LyncLineuri -replace 'tel:\+1',''

If($rawdigits -eq $LyncLineuri)
{
write-host $u.distinguishedname  " telephoneNumber attribute - "  $rawdigits  " matches the LineUri "  $LyncLineuri
}
else
{
write-host $u.distinguishedname  " telephoneNumber attribute - "  $rawdigits  " does not match the LineUri " $LyncLineuri
}
}
else
{
write-host $_.Identity.tostring() " no user match found"

}
}

1 comment:

  1. A very nice post, the unified communication solutions
    is very must in nowdays and this type of communication companies make the services better. One of same kind or Conferencing is Global UC . You Should go through it and check its services.

    ReplyDelete