Saturday 8 September 2012

How to add a UPN suffix with VBScript VBS


'----------Script configuration

Const ADS_PROPERTY_APPEND=3
strNewSuffix="test.com"
strDomain="domain.com"    'This must be the domain you're working with. If it is single domain - this is its name here

'----------End Script configuration

set objRootDSE =GetObject("LDAP://"&strDomain & "/RootDSE")
set objPartitions=GetObject("LDAP://cn=Partitions,"& _
                              objRootDSE.Get("ConfigurationNamingContext"))
objPartitions.PutEx ADS_PROPERTY_APPEND, "uPNSuffixes", Array(strNewSuffix)
objPartitions.SetInfo

No comments:

Post a Comment