Microsoft Internet Security and Acceleration Server 2000 |
ISA administration COM objects also permit programmatic modification of existing destination sets. The following portion of Visual Basic code modifies the destination set from the previous topic, adding the sites "www.mysports.microsoft.com", "www.mysport.microsoft.com", and "www.sport.microsoft.com" to the destination set "Sports Sites":
Dim objFPC As New FPCLib.FPC ' declare the destination sets collection Dim MyFPCDestinationSets As FPCDestinationSets ' declare the destination set collection Dim MyFPCDestinationSet As FPCDestinationSet ' declare the destination object Dim MyFPCDestination As FPCDestination ' set the destination sets to current array Set MyFPCDestinationSets = objFPC.Arrays.GetContainingArray.PolicyElements.DestinationSets ' find set "Sports Destinations" Set MyFPCDestinationSet = MyFPCDestinationSets.Item("Sports Sites") 'make adjustments to destination here Set MyFPCDestination = MyFPCDestinationSet.Add("www.mysports.microsoft.com") Set MyFPCDestination = MyFPCDestinationSet.Add("www.mysport.microsoft.com") Set MyFPCDestination = MyFPCDestinationSet.Add("www.sport.microsoft.com") 'save changes MyFPCDestinationSets.Save
The preceding code can be used in the context of a program or script that runs every day and adds new forbidden destinations to existing forbidden destination sets. If, for example, an administrator receives a daily list of forbidden sites from an outside service, this use of the objects automates the task of importing the new forbidden destinations.
The topic, Restricting Site Access, shows how to restrict site access by using a new site and content rule. The rule applies both to the forbidden sites added in the preceding example, and to the schedule added in the topic Add a Schedule.
FPCDestinationSet, Add a Destination Set