Thursday, July 27, 2006

Correcting SIP Addresses

If a user changes his email address then he may well not be able to log into LCS anymore due to that not matching his logon.

This script cycles AD and checks for mismatches. If you specify /commit it will write the changes back to AD.

' NAME: SIPFix.vbs
' AUTHOR: Stuart Bennett
' DATE : 26-05-2006
' Usage: sipfix.vbs
' e.g. sipfix.vbs out.csv /write
' COMMENT: Update all those pesky sip addresses to primary SMTP.

On Error Resume Next
' Change the xx throughout to your domain name..
OUMasterPath = "LDAP://OU=User,OU=Accounts,DC=emea,DC=xx,DC=com
Dim filename : filename = LCase(Trim(WScript.Arguments(0)))
Dim commit : commit = LCase(Trim(WScript.Arguments(1)))
Dim oFS : Set oFS = CreateObject("Scripting.FileSystemObject")
Dim fout : set fout = oFS.OpenTextFile(filename, 2, True, -2)
On Error GoTo 0

Set objTOPOU = GetObject(OUMasterPath)
For Each objOU In objTOPOU
wscript.echo("Processing Site : " &
Call SubOU(objOU.Name)

Sub SubOU(theOU)
strOUPath = "LDAP://" & theOU & ",OU=User,OU=Accounts,DC=emea,DC=xx,DC=com"
Set objTestOU = GetObject(strOUPath)
For Each objUser in objTestOU
GetSIPContact fout, objUser
End Sub

Sub GetSIPContact(fout, objUser)
On Error Resume Next
if (Err.Number = 0) Then
If trim(SIPNAME) <> trim(PrEmail) Then
wscript.echo(objUser.DisplayName & ";" & SIPName & ";" & prEmail)
fout.WriteLine(objUser.DisplayName & ";" & SIPName & ";" & prEmail)
If lcase(commit)="/write" Then
realSIP="sip:" & prEmail
wscript.echo ("Changing " &
objuser.PUT "msRTCSIP-PrimaryUserAddress",realSIP
End If
End If
End If
On Error Goto 0
end Sub


Dennis Lundtoft Thomsen said...

Correcting SIP address to match SMTP address

Anonymous said...

You said you will love me wow gold the whole life, but WoW Gold you marry her. You said you will wow power leveling,come to marry me, but this will not be carried out forever.WoW Gold I am trying my best to forget you and do not love you anymore. wow leveling But I failed and I still love you. Maybe wow leveling she needs you more compared wow leveling with me. So I tell you that world of warcraft power leveling you should love world of warcraft power leveling her and take good world of warcraft leveling care of her. You said I was so of warcraft leveling Yes, because I love you,world of warcraft leveling I hope you will be power leveling happy forever.

cialis said...

In principle, a good happen, support the views of the author

hawaii hotel honolulu said...

Best of luck. I have no words for this great post such an awe-some information i got gathered. Thank you very much for posting this article.

Olivia Princess said...

It is extremely helpful and interesting and very much looking forward to reading more of your work..
see here