Share via


Forefront TMG Administration Script Samples

The following script samples, which were developed using the Forefront TMG administration COM objects, are provided in the Samples\Admin folder of the Forefront TMG Software Development Kit (SDK):

Name Description
ActiveSessions.vbs A script that creates and executes a query on the FPCSessionsMonitor collection for the active sessions of the Microsoft Firewall service and displays the active sessions that existed when the query started.
AddAdmin.vbs A script that adds a specific user as an administrator with permissions to monitor the Forefront TMG computer and network activity, for example, to view logs and reports, but not to configure any specific monitoring functionality.
AddCacheRule.vbs A script that creates a new URL set in the URL sets collection of the proxy server, adds URLs to the URL set, and creates two new cache rules for caching content with a fixed Time to Live (TTL) range from all sites on the External network except the sites in the new URL set.
AddConnectivityVerifier.vbs A script that creates a new connectivity verifier.
AddRuleAndUrlSet.vbs A script that creates a new URL set in the URL sets collection, adds sites to the URL set, creates a new access rule, and adds the new URL set to the objects referenced in the URLSets property of the access rule.
ConfigureAlerts.vbs A script that retrieves the collection of alerts defined in the containing array, iterates through the collection, and sets the email address associated with each alert definition.
ConnectToCSS.vbs A script that connects to the Configuration Storage server specified by the user using the credentials of the logged-on user, the credentials of a specified enterprise administrator with read-write permissions for accessing the stored enterprise configuration, or the credentials of a specified enterprise auditor with read-only permissions for accessing the stored enterprise configuration. The script then displays the name of the enterprise and disconnects from the Configuration Storage server (for Enterprise Edition only).
ControlAccessByScheduleAndUserSet.vbs A script that creates the access rules, user set, and URL set needed to allow a specific group of workers in an organization restricted access to the Internet. The group is allowed to access only the sites listed in the URL set and only during the hours specified in the Work hours schedule supplied with Forefront TMG. All other workers using computers that belong to the Internal network are granted unlimited access to the Internet.
CreateEnterprisePolicy.vbs A script that connects to the Configuration Storage server specified by the user using the credentials of the logged-on user or the credentials of a specified user that has the permissions needed to modify the stored enterprise configuration, and creates a new enterprise policy with the name specified by the user (for Enterprise Edition only).
HttpFilterConfig.vbs A script that exports the configuration for the HTTP Filter Web filter from the corresponding vendor parameters set of the specified policy rule to the specified file, or imports the configuration for the HTTP Filter Web filter from the specified file to a new vendor parameters set of the specified policy rule.
ImportExport.vbs A script that exports the configuration of the array for a Forefront TMG computer to a specified XML file or imports the configuration in a specified XML file to the array object of the Forefront TMG computer.
SetNetworkRelation.vbs A script that creates a new network rule that defines a NAT relationship between any network belonging to the predefined All Protected Networks network set and the External network. This rule will apply to any new perimeter network created in the future because such a network will be included automatically in the All Protected Networks network set.
ShowICMPSystemPolicy.vbs A script that retrieves the collection of system policy rules defined for an Forefront TMG computer and then implicitly uses the _NewEnum property to iterate through the collection and display the names of the system policy rules for ICMP along with the user sets to which each rule applies.

 

This section contains the following topics with code examples taken from the samples to help you write Forefront TMG administration scripts in Microsoft® Visual Basic® Scripting Edition (VBScript):

 

 

Build date: 7/12/2010