Listing03_Create_UPNSuffix (VBScript)

This code can be found in Chapter 7 of Managing Enterprise Active Directory Services

Purchase XP Cookbook or Networking Recipes for only $25 plus shipping! While supplies last.

Find out how to download all of the VBScript code from this site.

'# From the book "Managing Enterprise Active Directory Services"
'# ISBN: 0-672-32125-4

ON ERROR RESUME NEXT

Dim ADsPath, user, passwd, server
server = "dc1"
user   = "administrator@xyz.com"
passwd = "password"

Dim rootDSE
Set rootDSE = GetObject("LDAP://" & server & "/RootDSE")
ADsPath =  "LDAP://" & server & "/" & "cn=Partitions," _
              & rootDSE.Get("ConfigurationNamingContext")
Dim ldapObj
Set ldapObj = GetObject("LDAP:")
Dim partObj
Set partObj = ldapObj.OpenDsObject(ADsPath,user,passwd,1)
partObj.GetInfo
partObj.PutEx 3, "uPNSuffixes", Array("test.com")
partObj.SetInfo
If Err.Number then
    Wscript.Echo "Could not update upnsuffixes: " _
                 & Err.Description
Else
    Wscript.Echo "Successfully updated upnsuffixes"
End If

This code has been viewed 772 times.

New from the creators of TechTasks.com: StatSheet.com