''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' 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