Determining the ISA Server Components Installed

Different components of Microsoft Internet Security and Acceleration (ISA) Server 2004 can be installed on a single computer. In both ISA Server 2004 Standard Edition and ISA Server 2004 Enterprise Edition, a user may choose to install only the administration components of ISA Server on a particular computer, thereby creating a remote management computer for ISA Server. That computer will provide the administrator with ISA Server Management for performing administration tasks manually and the ISA Server 2004 Administration Library (Msfpccom.dll) for performing administration tasks programmatically, but will not include the ISA Server service components, such as the Microsoft Firewall service.

Administration code that will be run from a remote management computer must first create an instance of the FPC COM object, which is known as the root object. In ISA Server Standard Edition, only the Arrays property can be accessed from the root object for calling the Connect method to connect to a specified ISA Server computer with the Firewall service installed. After this call succeeds, your application or script can access any property or method in the hierarchy of ISA Server administration COM objects under the FPCArray object retrieved by this method.

In ISA Server Enterprise Edition, an administrator can call the ConnectToConfigurationStorageServer method on the root object to access a Configuration Storage server from a remote management computer. After this call succeeds, an application or script can access any property or method in the administration COM hierarchy of objects.

In ISA Server Enterprise Edition, a user may choose to install various combinations of the following components:

  • Configuration Storage server
  • ISA Server services needed to create an array member
  • Administration components

The Microsoft Visual Basic Scripting Edition (VBScript) code in WhatIsIt.vbs (listed later in this document) determines whether ISA Server 2004 Standard Edition or ISA Server 2004 Enterprise Edition is installed on the local computer and whether the local computer is an ISA Server computer with the Firewall service installed, a Standard Edition remote management computer, an Enterprise Edition computer that is not connected to a Configuration Storage server, or a Configuration storage server in an enterprise in which no arrays are configured. The code in this script can be useful for writing scripts that can be run on ISA Server computers with different components installed to retrieve properties of objects in the hierarchy of ISA Server administration COM objects.

Usage:[CScript] WhatIsIt.vbs

To determine the ISA Server components installed on a computer

  1. Declare an FPC administration COM object and an FPCArray object.

  2. Create an instance of the FPC COM object, which is known as the root object and provides access to the other ISA Server administration COM objects.

  3. Try to determine the number of arrays by getting the value of the Count property of the FPCArrays collection:

    • If this attempt fails with the error code 0xC00403A6, which is returned by an ISA Server 2004 Enterprise Edition computer that is not connected to a Configuration Storage server, call the GetContainingServer method of the root object. This call will fail with the error code 0x80070002 if the local computer is a remote management computer. Then ask the user to supply the name of a Configuration Storage server and call the ConnectToConfigurationStorageServer method of the root object with the server name supplied and the credentials of the user who is currently logged on. If a connection to the Configuration Storage server is established, retrieve the FPCArray object that represents the first array in the enterprise from the FPCArrays collection, and inform the user that an Enterprise Edition array was found.
    • If the number of arrays is found to be 0, the Microsoft Firewall service is not installed on the local computer, which may be an Enterprise Edition Configuration Storage server or a Standard Edition remote management computer. If the local computer is a Configuration storage server, a call to the Connect method of the arrays collection with a null server name will fail with the error code 0xC00403A0. If this call succeeds, ask the user to supply the name of an ISA Server Standard Edition computer, and call the Connect method of the arrays collection again with the computer name supplied. This call will succeed if the Firewall service is installed on the computer specified.
    • If the error code 0xC00403A6 is not returned and the number of arrays is not 0, the local computer can be an ISA Server Standard Edition computer with the Firewall service installed, a Configuration Storage server, or an ISA Server Enterprise Edition array member that connected automatically to a Configuration Storage server. In Standard Edition, the arrays collection must contain exactly one array. In Enterprise Edition, the FPCArrays collection must contain one or more arrays. To distinguish between these two possibilities, retrieve the FPCArray object that represents the first array from the arrays collection and obtain the value of the Type property of the array object. For a Standard Edition computer, the value of this property will be fpcTypeStandardEdition, which is equal to 0. For an Enterprise Edition computer, call the GetContainingServer method of the root object. This call will fail with the error code 0x80070002 if the local computer is a Configuration Storage server that is not also an array member. If this call succeeds, retrieve the name of the Configuration Storage server for the local computer from the ConfigurationStorageServer property of the root object. If the local computer is defined as a server with the same computer name as its Configuration Storage server in the stored configuration, the local computer is a Configuration Storage server and an array member. Otherwise, it is an Enterprise Edition array member.

Script Listing: WhatIsIt.vbs

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

' Copyright (c) Microsoft Corporation. All rights reserved.

' THIS CODE IS MADE AVAILABLE AS IS, WITHOUT WARRANTY OF ANY KIND. THE ENTIRE

' RISK OF THE USE OR THE RESULTS FROM THE USE OF THIS CODE REMAINS WITH THE

' USER. USE AND REDISTRIBUTION OF THIS CODE, WITH OR WITHOUT MODIFICATION, IS

' HEREBY PERMITTED.

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

' This script determines whether ISA Server 2004 Standard Edition or ISA Server

' 2004 Enterprise Edition is installed on the local computer and whether the

' local computer is an ISA Server computer with the Firewall service installed,

' a remote management computer, or a Configuration Storage server.

' If the local computer connects to an ISA Server computer with the Firewall

' service installed or to a the Configuration Storage server, it uses the

' credentials of the logged-on user.

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

Option Explicit

' Define the constants needed.

Const Error_FileNotFound = &H80070002

Const Error_ConfigurationStorageServer = &HC00403A0

Const Error_NotConnectedToCSS = &HC00403A6

Const fpcTypeStandardEdition = 0

Main

Sub Main()

' Declare the objects needed.

Dim root ' The FPCLib.FPC root object

Dim isaArray ' An FPCArray object

Dim server ' An FPCServer object

Dim serverName ' A String

Dim cssName ' An Array

Dim num ' An Integer

' Create the root object.

Set root = CreateObject("FPC.Root")

' Try to get the number of arrays.

On Error Resume Next

num = root.Arrays.Count

If Err.Number = Error_NotConnectedToCSS Then

WScript.Echo "The local computer is not connected to a Configuration" _

& " Storage server."

Set server = root.GetContainingServer()

If Err.Number = Error_FileNotFound Then

WScript.Echo "This computer is an ISA Server Enterprise Edition " _

& "remote management computer."

End If

Err.Clear

serverName = _

InputBox("Enter the name of a Configuration Storage Server.")

' Connect to the specified Configuration Storage server.

Err.Clear

root.ConnectToConfigurationStorageServer serverName

CheckError

Set isaArray = root.Arrays.Item(1)

CheckError

WScript.Echo "This computer connected to the Configuration Storage " _

& "server specified, and an array was found in the enterprise."

ElseIf num = 0 Then

serverName = ""

Set isaArray = root.Arrays.Connect(serverName)

If Err.Number = Error_ConfigurationStorageServer Then

WScript.Echo "This computer is a Configuration Storage server, " _

& "but no arrays are configured in the enterprise."

WScript.Quit

End If

Err.Clear

WScript.Echo "The local computer is a Standard Edition " _

& "remote management computer."

serverName _

= InputBox("Enter the name of an ISA Server computer.")

Err.Clear

Set isaArray = root.Arrays.Connect(serverName)

If Err.Number <> 0 Then

WScript.Echo "The computer specified is not a Standard " _

& "Edition computer with the Firewall service installed."

Else

WScript.Echo "This computer connected to the ISA Server computer " _

& "specified."

End If

Else

Set isaArray = root.Arrays.Item(1)

CheckError

If isaArray.Type = fpcTypeStandardEdition Then

WScript.Echo "This is an ISA Server Standard Edition computer " _

& "with the Firewall service installed."

Else

Set server = root.GetContainingServer()

If Err.Number = Error_FileNotFound Then

WScript.Echo "This computer is a Configuration Storage server."

Else

cssName = Split(root.ConfigurationStorageServer, ".")

If UCase(cssName(0)) = UCase(server.Name) Then

WScript.Echo "This computer is a Configuration Storage " _

& "server and an array member."

Else

WScript.Echo "This computer is an ISA Server Enterprise " _

& "Edition array member."

End If

End If

End If

End If

End Sub

Sub CheckError()

If Err.Number <> 0 Then

WScript.Echo "An error occurred: 0x" & Hex(Err.Number) & ". " _

& Err.Description

Err.Clear

WScript.Quit

End If

End Sub