Managing temporary storage settings

Updated: February 1, 2011

Applies To: Forefront Threat Management Gateway (TMG)

Web traffic may contain malware (such as worms, viruses, and spyware). Forefront TMG includes malware inspection for scanning, cleaning, and blocking harmful HTTP content and files. When malware inspection is enabled, downloaded Web pages and files allowed by access rules may be inspected for malware.

Forefront TMG temporarily stores downloaded content in physical memory or on disk during malware inspection.

By default, Forefront TMG uses the %SystemRoot%\Temp folder to temporarily accumulate and store files on disk during malware inspection. You can change the location for temporarily storing files for malware inspection in Forefront TMG Management.

In addition, several advanced settings that determine how downloaded content is stored during malware inspection can be configured programmatically. These settings are summarized in the following table.

Setting Description

Disk storage threshold

Specifies the amount of memory used, in kilobytes, at which temporary storage will switch to disk. Its default value is 64 kilobytes, and its range of permissible values is from 4 through 256.

Maximum total storage size

Specifies the maximum total disk space, in gigabytes, that may be used for temporary storage. Its default value is 40 gigabytes, and its smallest permissible value is 4.

Client storage limit

Specifies the maximum disk space, in megabytes, that may be allocated for temporary storage for a single client. Its default value is 50 megabytes, and its smallest permissible value is 0.

Extended client storage limit

Specifies the maximum disk space, in megabytes, that may be allocated for temporary storage for a single client that has been granted the extended disk space storage limit. Its default value is 1024 megabytes, and its smallest permissible value is 0.

Extended limit pool size

Specifies the maximum number of clients that may be granted the extended disk space storage limit concurrently. Its default value is 20 clients, and its smallest permissible value is 0.

Forefront TMG, Medium Business Edition does not support a custom client storage limit, a custom extended client storage limit, or a custom extended limit pool size for client IP addresses that are included in the computer sets that list IP address exceptions. In particular, you cannot configure a custom client storage limit for a downstream proxy server on an upstream proxy server running Forefront TMG, Medium Business Edition in a Web chaining scenario.

Showing the temporary storage settings

The Microsoft Visual Basic Scripting Edition (VBScript) code in ShowTemporaryStorageSettings.vbs (listed later in this document) displays the programmatically configurable advanced settings that determine how downloaded content is stored during malware inspection in the local array.

This script, as presented, must be run on a Forefront TMG computer with the Microsoft Firewall service installed, but it can be modified to run on a remote management computer.

To use this script, paste the code in the script listing into a text editor, save it in a file named ShowTemporaryStorageSettings.vbs, and then run it from a command prompt.

Usage:

CScript ShowTemporaryStorageSettings.vbs

To show the temporary storage settings

  1. Create an instance of the FPC COM object, which is known as the root object and provides access to the other Forefront TMG administration COM objects.

  2. Get references to the FPCArray object, the FPCTemporaryStorageSettings object, and the FPCConnectionLimitPolicy object for the local array.

  3. Display the values of the DiskStorageThresholdInKilobytes and MaxTotalStorageSizeInGigas properties of the FPCTemporaryStorageSettings object.

  4. Display the values of the ClientStorageLimitInMegs, ClientExtendedStorageLimitInMegs, and ClientExtendedStorageLimitPoolSize properties of the FPCConnectionLimit object retrieved from the DefaultLimit property of the FPCConnectionLimitPolicy object.

Script listing: ShowTemporaryStorageSettings.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 displays the following settings for temporary storage
' during malware inspection in the local array:
'   Disk storage threshold - the amount of memory used, in kilobytes,
'     at which temporary storage will switch to disk
'   Maximum total storage size - the maximum total disk space, in
'     gigabytes, that may be used for temporary storage
'   Client storage limit - the maximum disk space, in megabytes, that
'     may be allocated for temporary storage for a single client
'   Extended client storage limit - the maximum disk space, in
'     megabytes, that may be allocated for temporary storage for a
'     single client that has been granted the extended disk space 
'     storage limit
'   Extended limit pool size - the maximum number of clients that
'     may be granted the extended disk space storage limit concurrently
' This script can be run from a command prompt by entering the 
' following command:
'     CScript ShowTemporaryStorageSettings.vbs
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Option Explicit

Sub ShowTemporaryStorageSettings()

    ' Declare the objects needed.
    Dim root         ' The FPCLib.FPC root object
    Dim tmgArray     ' An FPCArray object
    Dim tsSettings   ' An FPCTemporaryStorageSettings object
    Dim clPolicy     ' An FPCConnectionLimitPolicy object

    ' Create the root object.
    Set root = CreateObject("FPC.Root")

    ' Get references to the array object, the temporary storage
    ' settings object, and the connection limit policy object.
    Set tmgArray = root.GetContainingArray()
    Set tsSettings = _
        tmgArray.MalwareInspectionSettings.TemporaryStorageSettings
    Set clPolicy = tmgArray.ArrayPolicy.ConnectionLimitPolicy 

    WScript.Echo "Disk storage threshold:          " _
        & tsSettings.DiskStorageThresholdInKilobytes & " kilobytes"
    WScript.Echo "Maximum total storage size:      " _
        & tsSettings.MaxTotalStorageSizeInGigas & " gigabytes"
    WScript.Echo "Client storage limit:            " _
        & clPolicy.DefaultLimit.ClientStorageLimitInMegs & " megabytes"
    WScript.Echo "Extended client storage limit:   " _
        & clPolicy.DefaultLimit.ClientExtendedStorageLimitInMegs _
        & " megabytes"
    WScript.Echo "Extended client limit pool size: " _
        & clPolicy.DefaultLimit.ClientExtendedStorageLimitPoolSize _
        & " clients"
End Sub

ShowTemporaryStorageSettings()

Modifying the temporary storage settings

The VBScript code in SetTemporaryStorageSettings.vbs (listed later in this document) configures the programmatically configurable advanced settings that determine how downloaded content is stored during malware inspection in the local array.

This script, as presented, must be run on a Forefront TMG computer with the Microsoft Firewall service installed, but it can be modified to run on a remote management computer.

To use this script, paste the code in the script listing into a text editor, save it in a file named SetTemporaryStorageSettings.vbs, and then run it from a command prompt.

Usage:

CScript SetTemporaryStorageSettings.vbs [/d] [/dst:value] [/mts:value] [/csl:value] [/ecsl:value] [/eps:value] [/h | /?]

Here value specifies the value supplied for the applicable argument. The meanings of the arguments are summarized in the following table.

Argument Meaning

/d

Restore the default values of the delivery delay, progress refresh delay, maximum retrieval time, and maximum repeated retrieval time.

/dst

Set the disk storage threshold to the value specified in value.

/mts

Set the maximum total storage size to the value specified in value.

/csl

Set the client storage limit to the value specified in value.

/ecsl

Set the extended client storage limit to the value specified in value.

/eps

Set the extended limit pool size to the value specified in value.

/h /?

Display the usage information.

After you run the script, check the Configuration tab for the Monitoring node to verify that the changes were applied.

To modify the temporary storage settings

  1. Create an instance of the FPC COM object, which is known as the root object and provides access to the other Forefront TMG administration COM objects.

  2. Get references to the FPCArray object, the FPCTemporaryStorageSettings object, and the FPCConnectionLimitPolicy object for the local array.

  3. Do one of the following:

    • If the /d argument is specified, restore the default values of the DiskStorageThresholdInKilobytes and MaxTotalStorageSizeInGigas properties of the FPCTemporaryStorageSettings object and the ClientStorageLimitInMegs, ClientExtendedStorageLimitInMegs, and ClientExtendedStorageLimitPoolSize properties of the FPCConnectionLimit object retrieved from the DefaultLimit property of the FPCConnectionLimitPolicy object.

    • If the /d argument is not specified, change the values of the DiskStorageThresholdInKilobytes and MaxTotalStorageSizeInGigas properties of the FPCTemporaryStorageSettings object and the ClientStorageLimitInMegs, ClientExtendedStorageLimitInMegs, and ClientExtendedStorageLimitPoolSize properties of the FPCConnectionLimit object retrieved from the DefaultLimit property of the FPCConnectionLimitPolicy object to the values specified by the user.

  4. Call Save on the FPCArray object to write the changes to persistent storage.

Script listing: SetTemporaryStorageSettings.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 configures the following settings for temporary storage
' during malware inspection in the local array:
'   Disk storage threshold - the amount of memory used, in kilobytes,
'     at which temporary storage will switch to disk
'   Maximum total storage size - the maximum total disk space, in
'     gigabytes, that may be used for temporary storage
'   Client storage limit - the maximum disk space, in megabytes, that
'     may be allocated for temporary storage for a single client
'   Extended client storage limit - the maximum disk space, in
'     megabytes, that may be allocated for temporary storage for a
'     single client that has been granted the extended disk space 
'     storage limit
'   Extended limit pool size - the maximum number of clients that
'     may be granted the extended disk space storage limit concurrently
' This script can be run from a command prompt by entering the 
' following command:
'     CScript SetTemporaryStorageSettings.vbs [/d] [/dst:value]
'     [/mts:value] [/csl:value] [/cssl:value] [/ecsl:value] 
'     [/ecssl:value]  [/eps:value]
'     [/h | /?]
' After you run the script, check the Configuration tab for the
' Monitoring node to verify that the changes were applied.
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Option Explicit

Main(WScript.Arguments)

Sub Main(args)
    Dim argsN        ' A WScript.Arguments.Named object
    Dim num          ' An Integer

    Set argsN = args.Named 

    num = 0
    If argsN.Exists("d") Then
        num = num + 1
    End If
    If argsN.Exists("dst") Then
        num = num + 1
    End If
    If argsN.Exists("mts") Then
        num = num + 1
    End If
    If argsN.Exists("csl") Then
        num = num + 1
    End If
    If argsN.Exists("cssl") Then
            num = num + 1
    End If
    If argsN.Exists("ecsl") Then
        num = num + 1
    End If
    If argsN.Exists("ecssl") Then
            num = num + 1
    End If
    If argsN.Exists("eps") Then
        num = num + 1
    End If
    If argsN.Exists("h") Then
        num = num + 1
    End If
    If argsN.Exists("?") Then
        num = num + 1
    End If
    If argsN.Count <> args.Count Or argsN.Count <> num Then
        WScript.Echo "An invalid argument was entered."
        Usage()
    End If

    If argsN.Exists("h") And argsN("h") <> "" Then
        WScript.Echo "An invalid argument value was provided."
        Usage()
    End If
    If argsN.Exists("?") And argsN("?") <> "" Then
        WScript.Echo "An invalid argument value was provided."
        Usage()
    End If
    If argsN.Exists("h") Or argsN.Exists("?") Or args.Count = 0 Then
        Usage()
    End If
    If argsN.Exists("d") Then
        If args.Count > 1 Then
            WScript.Echo "Only the default settings will be restored."
            WScript.Echo "The other arguments will be ignored."
        End If
        ResetDefaults()
    End If
    If argsN.Exists("d") And argsN("d") <> "" Then
        WScript.Echo "An invalid argument value was provided."
        Usage()
    End If
    If argsN.Exists("dst") And argsN("dst") = "" Then
        WScript.Echo "No value was provided for /dst."
        Usage()
    End If
    If argsN.Exists("mts") And argsN("mts") = "" Then
        WScript.Echo "No value was provided for /mts."
        Usage()
    End If
    If argsN.Exists("csl") And argsN("csl") = "" Then
        WScript.Echo "No value was provided for /csl."
        Usage()
    End If
    If argsN.Exists("cssl") And argsN("cssl") = "" Then
        WScript.Echo "No value was provided for /cssl."
        Usage()
    End If
    If argsN.Exists("ecsl") And argsN("ecsl") = "" Then
        WScript.Echo "No value was provided for /ecsl."
        Usage()
    End If
    If argsN.Exists("ecssl") And argsN("ecssl") = "" Then
            WScript.Echo "No value was provided for /ecssl."
            Usage()
    End If    
    If argsN.Exists("eps") And argsN("eps") = "" Then
        WScript.Echo "No value was provided for /eps."
        Usage()
    End If

    SetTemporaryStorageSettings(argsN)
End Sub

Sub SetTemporaryStorageSettings(argsN)

    ' Declare the objects needed.
    Dim root         ' The FPCLib.FPC root object
    Dim tmgArray     ' An FPCArray object
    Dim tsSettings   ' An FPCTemporaryStorageSettings object
    Dim clPolicy     ' An FPCConnectionLimitPolicy object

    ' Create the root object.
    Set root = CreateObject("FPC.Root")

    ' Get references to the array object, the temporary storage
    ' settings object, and the connection limit policy object.
    Set tmgArray = root.GetContainingArray()
    Set tsSettings = _
        tmgArray.MalwareInspectionSettings.TemporaryStorageSettings
    Set clPolicy = tmgArray.ArrayPolicy.ConnectionLimitPolicy 

    If argsN.Exists("dst") And argsN("dst") <> "" Then
        WScript.Echo "Current disk storage threshold: " _
            & tsSettings.DiskStorageThresholdInKilobytes
        WScript.Echo "Setting the disk storage threshold to " _
            & argsN("dst") & " kilobytes ..."
        tsSettings.DiskStorageThresholdInKilobytes = argsN("dst")
    End If

    If argsN.Exists("mts") And argsN("mts") <> "" Then
        WScript.Echo "Current maximum total storage size: " _
            & tsSettings.MaxTotalStorageSizeInGigas
        WScript.Echo "Setting the maximum total storage size to " _
            & argsN("mts") & " gigabytes ..."
        tsSettings.MaxTotalStorageSizeInGigas = argsN("mts")
    End If

    If argsN.Exists("csl") And argsN("csl") <> "" Then
        WScript.Echo "Current client default storage limit: " _
            & clPolicy.DefaultLimit.ClientStorageLimitInMegs
        WScript.Echo "Setting the client storage limit to " _
            & argsN("csl") & " megabytes ..."
        clPolicy.DefaultLimit.ClientStorageLimitInMegs = argsN("csl")
    End If
    
    If argsN.Exists("cssl") And argsN("cssl") <> "" Then
        WScript.Echo "Current client special storage limit: " _
            & clPolicy.SpecialLimit.ClientStorageLimitInMegs
        WScript.Echo "Setting the client storage limit to " _
            & argsN("cssl") & " megabytes ..."
        clPolicy.SpecialLimit.ClientStorageLimitInMegs = argsN("cssl")
    End If

    If argsN.Exists("ecsl") And argsN("ecsl") <> "" Then
        WScript.Echo "Current extended client storage limit: " _
            & clPolicy.DefaultLimit.ClientExtendedStorageLimitInMegs
        WScript.Echo "Setting the extended client storage limit to " _
            & argsN("ecsl") & " megabytes ..."
        clPolicy.DefaultLimit.ClientExtendedStorageLimitInMegs = _
            argsN("ecsl")
    End If
    
    If argsN.Exists("ecssl") And argsN("ecssl") <> "" Then
            WScript.Echo "Current extended special client storage limit: " _
                & clPolicy.SpecialLimit.ClientExtendedStorageLimitInMegs
            WScript.Echo "Setting the extended client storage limit to " _
                & argsN("ecsl") & " megabytes ..."
            clPolicy.SpecialLimit.ClientExtendedStorageLimitInMegs = _
                argsN("ecssl")
    End If

    If argsN.Exists("eps") And argsN("eps") <> "" Then
        WScript.Echo "Current extended client limit pool size: " _
            & clPolicy.DefaultLimit.ClientExtendedStorageLimitPoolSize
        WScript.Echo "Setting the extended client limit pool size " _
            & "to " & argsN("eps") & " clients ..."
        clPolicy.DefaultLimit.ClientExtendedStorageLimitPoolSize = _
            argsN("eps")
    End If

    WScript.Echo  "Saving ..."
    tmgArray.Save
    WScript.Echo "Done!"
End Sub

Sub ResetDefaults()

    ' Declare constants needed
    Const defaultDiskStorageThreshold = 64
    Const defaultMaxTotalStorageSize = 40
    Const defaultClientStorageLimit = 50
    Const defaultExtendedClientStorageLimit = 1024
    Const defaultExtendedPoolSize = 20

    ' Declare the objects needed.
    Dim root         ' The FPCLib.FPC root object
    Dim tmgArray     ' An FPCArray object
    Dim tsSettings   ' An FPCTemporaryStorageSettings object
    Dim clPolicy     ' An FPCConnectionLimitPolicy object

    ' Create the root object.
    Set root = CreateObject("FPC.Root")

    ' Get references to the array object, the temporary storage
    ' settings object, and the connection limit policy object.
    Set tmgArray = root.GetContainingArray()
    Set tsSettings = _
        tmgArray.MalwareInspectionSettings.TemporaryStorageSettings
    Set clPolicy = tmgArray.ArrayPolicy.ConnectionLimitPolicy 

    WScript.Echo "Setting the disk storage threshold to " _
        & defaultDiskStorageThreshold & " kilobytes (the default) ..."
    tsSettings.DiskStorageThresholdInKilobytes = _
        defaultDiskStorageThreshold
    WScript.Echo "Setting the maximum total storage size to " _
        & defaultMaxTotalStorageSize & " gigabyptes (the default) ..."
    tsSettings.MaxTotalStorageSizeInGigas = defaultMaxTotalStorageSize
    WScript.Echo "Setting the client storage limit to " _
        & defaultClientStorageLimit & " megabytes (the default) ..."
    clPolicy.DefaultLimit.ClientStorageLimitInMegs = _
        defaultClientStorageLimit
    WScript.Echo "Setting the extended client storage limit to " _
        & defaultExtendedClientStorageLimit _
        & " megabytes (the default) ..."
    clPolicy.DefaultLimit.ClientExtendedStorageLimitInMegs = _
        defaultExtendedClientStorageLimit
    WScript.Echo "Setting the extended limit pool size to " _
        & defaultExtendedPoolSize & " megabytes (the default) ..."
    clPolicy.DefaultLimit.ClientExtendedStorageLimitPoolSize = _
        defaultExtendedPoolSize

    WScript.Echo  "Saving ..."
    tmgArray.Save
    WScript.Echo "Done!"
    WScript.Quit
End Sub

Sub Usage()
    WScript.Echo "Usage:" & VbCrLf _
        & "  " & WScript.ScriptName & " [/dst:value] [/mts:value] " _
        & "[/csl:value] [/ecsl:value] [/eps:value] " _
        & "[/h | /?]" & VbCrLf _
        & "" & VbCrLf _
        & "    /d    - Restore the default values" & VbCrLf _
        & "    /dst  - Set disk storage threshold" & VbCrLf _
        & "    /mts  - Set maximum total storage space" & VbCrLf _
        & "    /csl  - Set client default storage limit" & VbCrLf _ 
        & "    /cssl - Set client special storage limit" & VbCrLf _ 
        & "    /ecsl - Set extended (default) client storage limit" & VbCrLf _ 
        & "    /ecssl - Set extended (special) client storage limit" & VbCrLf _         
        & "    /eps  - Set extended limit pool size" & VbCrLf _ 
        & "    value - New property value" & VbCrLf _
        & "    /h /? - Display this help."
    WScript.Quit
End Sub'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' 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 configures the following settings for temporary storage
' during malware inspection in the local array:
'   Disk storage threshold - the amount of memory used, in kilobytes,
'     at which temporary storage will switch to disk
'   Maximum total storage size - the maximum total disk space, in
'     gigabytes, that may be used for temporary storage
'   Client storage limit - the maximum disk space, in megabytes, that
'     may be allocated for temporary storage for a single client
'   Extended client storage limit - the maximum disk space, in
'     megabytes, that may be allocated for temporary storage for a
'     single client that has been granted the extended disk space 
'     storage limit
'   Extended limit pool size - the maximum number of clients that
'     may be granted the extended disk space storage limit concurrently
' This script can be run from a command prompt by entering the 
' following command:
'     CScript SetTemporaryStorageSettings.vbs [/d] [/dst:value]
'     [/mts:value] [/csl:value] [/ecsl:value] [/eps:value]
'     [/h | /?]
' After you run the script, check the Configuration tab for the
' Monitoring node to verify that the changes were applied.
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Option Explicit

Main(WScript.Arguments)

Sub Main(args)
    Dim argsN        ' A WScript.Arguments.Named object
    Dim num          ' An Integer

    Set argsN = args.Named 

    num = 0
    If argsN.Exists("d") Then
        num = num + 1
    End If
    If argsN.Exists("dst") Then
        num = num + 1
    End If
    If argsN.Exists("mts") Then
        num = num + 1
    End If
    If argsN.Exists("csl") Then
        num = num + 1
    End If
    If argsN.Exists("ecsl") Then
        num = num + 1
    End If
    If argsN.Exists("eps") Then
        num = num + 1
    End If
    If argsN.Exists("h") Then
        num = num + 1
    End If
    If argsN.Exists("?") Then
        num = num + 1
    End If
    If argsN.Count <> args.Count Or argsN.Count <> num Then
        WScript.Echo "An invalid argument was entered."
        Usage()
    End If

    If argsN.Exists("h") And argsN("h") <> "" Then
        WScript.Echo "An invalid argument value was provided."
        Usage()
    End If
    If argsN.Exists("?") And argsN("?") <> "" Then
        WScript.Echo "An invalid argument value was provided."
        Usage()
    End If
    If argsN.Exists("h") Or argsN.Exists("?") Or args.Count = 0 Then
        Usage()
    End If
    If argsN.Exists("d") Then
        If args.Count > 1 Then
            WScript.Echo "Only the default settings will be restored."
            WScript.Echo "The other arguments will be ignored."
        End If
        ResetDefaults()
    End If
    If argsN.Exists("d") And argsN("d") <> "" Then
        WScript.Echo "An invalid argument value was provided."
        Usage()
    End If
    If argsN.Exists("dst") And argsN("dst") = "" Then
        WScript.Echo "No value was provided for /dst."
        Usage()
    End If
    If argsN.Exists("mts") And argsN("mts") = "" Then
        WScript.Echo "No value was provided for /mts."
        Usage()
    End If
    If argsN.Exists("csl") And argsN("csl") = "" Then
        WScript.Echo "No value was provided for /csl."
        Usage()
    End If
    If argsN.Exists("ecsl") And argsN("ecsl") = "" Then
        WScript.Echo "No value was provided for /ecsl."
        Usage()
    End If
    If argsN.Exists("eps") And argsN("eps") = "" Then
        WScript.Echo "No value was provided for /eps."
        Usage()
    End If

    SetTemporaryStorageSettings(argsN)
End Sub

Sub SetTemporaryStorageSettings(argsN)

    ' Declare the objects needed.
    Dim root         ' The FPCLib.FPC root object
    Dim tmgArray     ' An FPCArray object
    Dim tsSettings   ' An FPCTemporaryStorageSettings object
    Dim clPolicy     ' An FPCConnectionLimitPolicy object

    ' Create the root object.
    Set root = CreateObject("FPC.Root")

    ' Get references to the array object, the temporary storage
    ' settings object, and the connection limit policy object.
    Set tmgArray = root.GetContainingArray()
    Set tsSettings = _
        tmgArray.MalwareInspectionSettings.TemporaryStorageSettings
    Set clPolicy = tmgArray.ArrayPolicy.ConnectionLimitPolicy 

    If argsN.Exists("dst") And argsN("dst") <> "" Then
        WScript.Echo "Current disk storage threshold: " _
            & tsSettings.DiskStorageThresholdInKilobytes
        WScript.Echo "Setting the disk storage threshold to " _
            & argsN("dst") & " kilobytes ..."
        tsSettings.DiskStorageThresholdInKilobytes = argsN("dst")
    End If

    If argsN.Exists("mts") And argsN("mts") <> "" Then
        WScript.Echo "Current maximum total storage size: " _
            & tsSettings.MaxTotalStorageSizeInGigas
        WScript.Echo "Setting the maximum total storage size to " _
            & argsN("mts") & " gigabytes ..."
        tsSettings.MaxTotalStorageSizeInGigas = argsN("mts")
    End If

    If argsN.Exists("csl") And argsN("csl") <> "" Then
        WScript.Echo "Current client storage limit: " _
            & clPolicy.DefaultLimit.ClientStorageLimitInMegs
        WScript.Echo "Setting the client storage limit to " _
            & argsN("csl") & " megabytes ..."
        clPolicy.DefaultLimit.ClientStorageLimitInMegs = argsN("csl")
    End If

    If argsN.Exists("ecsl") And argsN("ecsl") <> "" Then
        WScript.Echo "Current extended client storage limit: " _
            & clPolicy.DefaultLimit.ClientExtendedStorageLimitInMegs
        WScript.Echo "Setting the extended client storage limit to " _
            & argsN("ecsl") & " megabytes ..."
        clPolicy.DefaultLimit.ClientExtendedStorageLimitInMegs = _
            argsN("ecsl")
    End If

    If argsN.Exists("eps") And argsN("eps") <> "" Then
        WScript.Echo "Current extended client limit pool size: " _
            & clPolicy.DefaultLimit.ClientExtendedStorageLimitPoolSize
        WScript.Echo "Setting the extended client limit pool size " _
            & "to " & argsN("eps") & " clients ..."
        clPolicy.DefaultLimit.ClientExtendedStorageLimitPoolSize = _
            argsN("eps")
    End If

    WScript.Echo  "Saving ..."
    tmgArray.Save
    WScript.Echo "Done!"
End Sub

Sub ResetDefaults()

    ' Declare constants needed
    Const defaultDiskStorageThreshold = 64
    Const defaultMaxTotalStorageSize = 40
    Const defaultClientStorageLimit = 50
    Const defaultExtendedClientStorageLimit = 1024
    Const defaultExtendedPoolSize = 20

    ' Declare the objects needed.
    Dim root         ' The FPCLib.FPC root object
    Dim tmgArray     ' An FPCArray object
    Dim tsSettings   ' An FPCTemporaryStorageSettings object
    Dim clPolicy     ' An FPCConnectionLimitPolicy object

    ' Create the root object.
    Set root = CreateObject("FPC.Root")

    ' Get references to the array object, the temporary storage
    ' settings object, and the connection limit policy object.
    Set tmgArray = root.GetContainingArray()
    Set tsSettings = _
        tmgArray.MalwareInspectionSettings.TemporaryStorageSettings
    Set clPolicy = tmgArray.ArrayPolicy.ConnectionLimitPolicy 

    WScript.Echo "Setting the disk storage threshold to " _
        & defaultDiskStorageThreshold & " kilobytes (the default) ..."
    tsSettings.DiskStorageThresholdInKilobytes = _
        defaultDiskStorageThreshold
    WScript.Echo "Setting the maximum total storage size to " _
        & defaultMaxTotalStorageSize & " gigabyptes (the default) ..."
    tsSettings.MaxTotalStorageSizeInGigas = defaultMaxTotalStorageSize
    WScript.Echo "Setting the client storage limit to " _
        & defaultClientStorageLimit & " megabytes (the default) ..."
    clPolicy.DefaultLimit.ClientStorageLimitInMegs = _
        defaultClientStorageLimit
    WScript.Echo "Setting the extended client storage limit to " _
        & defaultExtendedClientStorageLimit _
        & " megabytes (the default) ..."
    clPolicy.DefaultLimit.ClientExtendedStorageLimitInMegs = _
        defaultExtendedClientStorageLimit
    WScript.Echo "Setting the extended limit pool size to " _
        & defaultExtendedPoolSize & " megabytes (the default) ..."
    clPolicy.DefaultLimit.ClientExtendedStorageLimitPoolSize = _
        defaultExtendedPoolSize

    WScript.Echo  "Saving ..."
    tmgArray.Save
    WScript.Echo "Done!"
    WScript.Quit
End Sub

Sub Usage()
    WScript.Echo "Usage:" & VbCrLf _
        & "  " & WScript.ScriptName & " [/dst:value] [/mts:value] " _
        & "[/csl:value] [/ecsl:value] [/eps:value] " _
        & "[/h | /?]" & VbCrLf _
        & "" & VbCrLf _
        & "    /d    - Restore the default values" & VbCrLf _
        & "    /dst  - Set disk storage threshold" & VbCrLf _
        & "    /mts  - Set maximum total storage space" & VbCrLf _
        & "    /csl  - Set client storage limit" & VbCrLf _ 
        & "    /ecsl - Set extended client storage limit" & VbCrLf _ 
        & "    /eps  - Set extended limit pool size" & VbCrLf _ 
        & "    value - New property value" & VbCrLf _
        & "    /h /? - Display this help."
    WScript.Quit
End Sub