Getting Started with the Administration COM Objects

To start using the administration COM objects, set up your development environment using one of the following procedures, depending on whether you use Microsoft® Visual Basic®, C++, or C#. You must have, at a minimum, Forefront TMG Management installed for the procedures to work. Example code for creating administration scripts in Visual Basic Scripting Edition (VBScript), including step-by-step examples, is provided in Forefront TMG Administration Script Samples.

Using the Administration COM Objects with Visual Basic

To start using the administration COM objects with Visual Basic

  1. Open Microsoft Visual Studio 2008 or Visual Studio 2005.
  2. On the Start Page, next to Create, click Project.
  3. Under Project Types, click Visual Basic. (If Visual Basic is not your default language, you will need to expand Other Languages first.)
  4. Under Templates, click Console Application if you want to create a command-line application, or Windows Application if you want to create an application with a Windows user interface.
  5. In Name, provide a name for your project, in Location, modify the path to your project as desired, and then click OK.
  6. On the Project menu, click Add Reference.
  7. On the COM tab, select Microsoft Forefront Threat Management Gateway Administration Library from the dialog box that appears. This library is defined in Msfpccom.dll, which is a file included with Forefront TMG. Therefore, you need to have Forefront TMG installed for access to this library. Adding this library as a reference will make the administration COM objects available to your project.
  8. Create an instance of the root Forefront TMG object as described in Creating the Root Forefront TMG Object.
  9. Write your program. See Adding a Schedule Using Visual Basic for an introductory example.
  10. To apply your changes, you must call the Save method on an applicable object.

Note  Unless otherwise noted, the examples in this section are written in Visual Basic or Visual Basic Scripting Edition (VBScript), but you can use any language to script with the administration COM objects. If you script with VBScript, you do not need to set up a development environment, and you can use any text editor to create the scripts.

If you are using VBScript and would like to use enumerated types, see Using Enumerated Types in Scripts.

Using the Administration COM Objects with C++

To start using the administration COM objects with C++, include the file Msfpccom.dll by using the following line of code:

#import "%SystemDrive%\Program Files (x86)\Microsoft ISA Server\msfpccom.dll"

The file Msfpccom.idl contains the definitions of the Forefront TMG administration COM objects.

For an example of an administration task performed using C++ code, see Adding a Schedule Using C++.

Using the Administration COM Objects with C#

Forefront TMG provides a primary interop assembly named msfpccom.interop.dll that is installed in the Windows global assembly cache (GAC) on every Forefront TMG computer during setup. This primary interop assembly enables .NET Framework applications to use the Forefront TMG administration COM objects. The .NET classes defined in this assembly belong to the Microsoft.Isa.Interop namespace.

To start using the administration COM objects with C#

  1. Open Microsoft Visual Studio 2008 or Visual Studio 2005.
  2. On the Start Page, next to Create, click Project.
  3. Under Project Types, click Visual C#. (If C# is not your default language, you will need to expand Other Languages first.)
  4. Under Templates, click Console Application if you want to create a command-line application, or Windows Application if you want to create an application with a Windows user interface.
  5. In Name, provide a name for your project, in Location, modify the path to your project as desired, and then click OK.
  6. On the Project menu, click Add Reference and add a reference to mspfccom.interop.dll.
  7. Add the following using statement after the automatically created using statements.
    using Microsoft.Isa.Interop;
    
  8. In the class definition, declare private members for the root object and other objects that you will need. The following lines of code illustrate how to write these declarations.
    private static FPC m_Root;
    private static FPCArray m_Array;
    
  9. In the Main method, you can use the following lines of code to create an instance of the root object and get a reference to the array object.
    m_Root = new FPC();
    m_Array = m_Root.GetContainingArray();
    

For an example of an administration task performed using C# code, see Adding a Schedule Using C#.

Topics in This Section

This section contains the following topics:


Send comments about this topic to Microsoft

Build date: 11/30/2009

© 2008 Microsoft Corporation. All rights reserved.