-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
active directory site link.vbs
30 lines (21 loc) · 1.11 KB
/
active directory site link.vbs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
' Create an Active Directory Site Link
strSite1Name = "Ga-Atl-Sales"
strSite2Name = "Wa-Red-Sales"
strSiteLinkRDN = "cn=[" & strSite1Name & "][" & strSite2Name & "]"
intCost = 100
intReplInterval = 60
strDescription = "[" & strSite1Name & "][" & strSite2Name & "]"
Const ADS_PROPERTY_UPDATE = 2
Set objRootDSE = GetObject("LDAP://RootDSE")
strConfigurationNC = objRootDSE.Get("configurationNamingContext")
strSite1DN = "cn=" & strSite1Name & ",cn=Sites," & strConfigurationNC
strSite2DN = "cn=" & strSite2Name & ",cn=Sites," & strConfigurationNC
Set objInterSiteTransports = GetObject("LDAP://" & _
"cn=IP,cn=Inter-Site Transports,cn=Sites," & strConfigurationNC)
Set objSiteLink = objInterSiteTransports.Create("siteLink", strSiteLinkRDN)
objSiteLink.Put "cost", intCost
objSiteLink.Put "replInterval", intReplInterval
objSiteLink.Put "description", strDescription
objSiteLink.PutEx ADS_PROPERTY_UPDATE, "siteList", _
Array(strSite1DN, strSite2DN)
objSiteLink.SetInfo