The Enabled property gets or sets a Boolean value that indicates whether the User-Agent mapping is enabled.
HRESULT put_Enabled( VARIANT_BOOL fEnabled ); HRESULT get_Enabled( VARIANT_BOOL* pfEnabled );
Pointer to a Boolean variable that is set on return to VARIANT_TRUE if the User-Agent mapping is enabled, or to VARIANT_FALSE if the User-Agent mapping is disabled.
Boolean value that indicates whether the User-Agent mapping is enabled.
These property methods return S_OK if the call is successful; otherwise, they return an error code.
Property Enabled As Boolean
Boolean value that indicates whether the User-Agent mapping is enabled.
Option Explicit ' Define the constant needed. const Error_FileNotFound = &H80070002 Main(WScript.Arguments) Sub Main(args) If(args.Count <> 2) Then Usage() Else EnableOrDisable UCase(args(0)), args(1) End If End Sub Sub EnableOrDisable(action, mappingId) ' Create the root object. Dim root ' The FPCLib.FPC root object Set root = CreateObject("FPC.Root") ' Declare the other objects needed. Dim isaArray ' An FPCArray object Dim mappings ' An FPCUserAgentMappings collection Dim mapping ' An FPCUserAgentMapping object ' Get references to the array object and ' the User-Agent mappings collection. Set isaArray = root.GetContainingArray() Set mappings = isaArray.RuleElements.UserAgentMappings ' Delete the specified User-Agent mapping. On Error Resume Next If IsNumeric(mappingId) Then mappingId = CInt(mappingId) End If If action = "ENABLE" Then Set mapping = mappings.Item(mappingId) If Err.Number = Error_FileNotFound Then WScript.Echo "The User-Agent mapping specified could not be found." WScript.Quit Else If mapping.Enabled = False Then WScript.Echo "Enabling the User-Agent mapping specified..." mapping.Enabled = True Else WScript.Echo "The User-Agent mapping specified is already enabled." WScript.Quit End If End If ElseIf action = "DISABLE" Then Set mapping = mappings.Item(mappingId) If Err.Number = Error_FileNotFound Then WScript.Echo "The User-Agent mapping specified could not be found." WScript.Quit Else If mapping.Enabled = True Then WScript.Echo "Disabling the User-Agent mapping specified..." mapping.Enabled = False Else WScript.Echo "The User-Agent mapping specified is already disabled." WScript.Quit End If End If Else WScript.Echo "The Action parameter specified is not valid." Usage() End If On Error GoTo 0 ' Save the changes to the collection of User-Agent mappings. mappings.Save WScript.Echo "Done!" End Sub Sub Usage() WScript.Echo "Usage:" & VbCrLf _ & " " & WScript.ScriptName & " Action Mapping" & VbCrLf _ & "" & VbCrLf _ & " Action ENABLE Enable the specified mapping." & VbCrLf _ & " DISABLE Disable the specified mapping." & VbCrLf _ & " Mapping Number of the mapping or string that" & VbCrLf _ & " specifies User-Agent headers." WScript.Quit End Sub
This property is read/write. Its default value is True (VARIANT_TRUE in C++).
Client | Requires Windows Vista or Windows XP. |
---|---|
Server | Requires Windows Server 2008. |
Version | Requires Forefront Threat Management Gateway (TMG). |
IDL |
Declared in Msfpccom.idl. |
DLL |
Requires Msfpccom.dll. |
Send comments about this topic to Microsoft
Build date: 11/30/2009
© 2008 Microsoft Corporation. All rights reserved.