If you are installing an Enterprise License server and your environment includes multiple trusted Active Directory sites, each of which hosts a terminal server, you can use a script based upon this sample to publish a single license server across all of these sites. Doing this can greatly simplify deployment because it eliminates the need to deploy a separate license server in each site, and it eliminates the need to distribute CALs to license servers across multiple sites.

Visual Basic
Edit|Remove
Const ADS_PROPERTY_APPEND = 3 
 
Set objRootDSE = GetObject("LDAP://RootDSE")
strConfigContainer = objRootDSE.Get("configurationNamingContext")

Set objSysInfo = CreateObject("ADSystemInfo")
strSite = objSysInfo.SiteName 
strComputerName = objSysInfo.ComputerName
   
Set adsLS = GetObject("LDAP://CN=TS-Enterprise-License-Server,CN=" & strSite &_ 
",CN=sites," & strConfigContainer)
Set adsContainer = GetObject("LDAP://CN=" & strSite & ",CN=sites," & strConfigContainer)
Set adsLS = adsContainer.Create("LicensingSiteSettings" , "CN=TS-Enterprise-License-Server")

adsLS.PutEx ADS_PROPERTY_APPEND, "siteServer", Array(strComputerName)
adsLS.SetInfo