G
Guest
Hello !
I have found the following script that adds a GPO link for a policy named
"SitePolicy" defined in "Default-first -site-name" to a second site in
Windows 2000 infrastructure.
I have multiple sites and I don't know how to modify this script - for
adding this "Site Policy" link to EVERY SITE in
cn=sites,cn=configuration,dc=test,dc=com whithout applying again this GPO
link for the original "Default first site name" where is defined the
original "Site Policy" and also without applying for the objects cn=Subnets
and cn=Inter-Site-Transports in the cn=sites,cn=configuration,dc=test,dc=com
..This two objects are objects which are not sites .
Please if you could help me,,,
Thank You in advance
On Error Resume Next
Set objContainer = GetObject _
("LDAP://cn=secondsite,cn=sites,cn=configuration,dc=test,dc=com ")
strExistingGPLink = objContainer.Get("gPLink")
strGPODisplayName = "SitePolicy"
strGPOLinkOptions = 2
strNewGPLink = "[" & GetGPOADsPath & ";" & strGPOLinkOptions & "]"
objContainer.Put "gPLink", strExistingGPLink & strNewGPLink
objContainer.Put "gPOptions", "0"
objContainer.SetInfo
Function GetGPOADsPath
Set objConnection = CreateObject("ADODB.Connection")
objConnection.Open "Provider=ADsDSOObject;"
Set objCommand = CreateObject("ADODB.Command")
objCommand.ActiveConnection = objConnection
objCommand.CommandText = _
"<LDAP://cn=Policies,cn=System,dc=test,dc=com>;;" & _
"distinguishedName,displayName;onelevel"
Set objRecordSet = objCommand.Execute
While Not objRecordSet.EOF
If objRecordSet.Fields("displayName") = strGPODisplayName Then
GetGPOADsPath = "LDAP://" & objRecordSet.Fields("distinguishedName")
objConnection.Close
Exit Function
End If
objRecordSet.MoveNext
Wend
objConnection.Close
End Function
I have found the following script that adds a GPO link for a policy named
"SitePolicy" defined in "Default-first -site-name" to a second site in
Windows 2000 infrastructure.
I have multiple sites and I don't know how to modify this script - for
adding this "Site Policy" link to EVERY SITE in
cn=sites,cn=configuration,dc=test,dc=com whithout applying again this GPO
link for the original "Default first site name" where is defined the
original "Site Policy" and also without applying for the objects cn=Subnets
and cn=Inter-Site-Transports in the cn=sites,cn=configuration,dc=test,dc=com
..This two objects are objects which are not sites .
Please if you could help me,,,
Thank You in advance
On Error Resume Next
Set objContainer = GetObject _
("LDAP://cn=secondsite,cn=sites,cn=configuration,dc=test,dc=com ")
strExistingGPLink = objContainer.Get("gPLink")
strGPODisplayName = "SitePolicy"
strGPOLinkOptions = 2
strNewGPLink = "[" & GetGPOADsPath & ";" & strGPOLinkOptions & "]"
objContainer.Put "gPLink", strExistingGPLink & strNewGPLink
objContainer.Put "gPOptions", "0"
objContainer.SetInfo
Function GetGPOADsPath
Set objConnection = CreateObject("ADODB.Connection")
objConnection.Open "Provider=ADsDSOObject;"
Set objCommand = CreateObject("ADODB.Command")
objCommand.ActiveConnection = objConnection
objCommand.CommandText = _
"<LDAP://cn=Policies,cn=System,dc=test,dc=com>;;" & _
"distinguishedName,displayName;onelevel"
Set objRecordSet = objCommand.Execute
While Not objRecordSet.EOF
If objRecordSet.Fields("displayName") = strGPODisplayName Then
GetGPOADsPath = "LDAP://" & objRecordSet.Fields("distinguishedName")
objConnection.Close
Exit Function
End If
objRecordSet.MoveNext
Wend
objConnection.Close
End Function