Advertisement
dantpro

TMG2010 Track Failed Logon

Jul 16th, 2014
271
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ' http://support.microsoft.com/kb/2592929/en-us
  2.  
  3. set curArray = CreateObject("FPC.Root").GetContainingArray()
  4. Const SE_VPS_GUID = "{143F5698-103B-12D4-FF34-1F34767DEabc}"
  5. Const SE_VPS_NAME = "LogUsernameForFailedAuthentication"
  6.  
  7. ' ON
  8. Const SE_VPS_VALUE = 1
  9.  
  10. ' OFF (Default)
  11. ' Const SE_VPS_VALUE = 0
  12.  
  13. Sub SetValue()
  14.  
  15. ' Create the root obect.
  16. Dim root ' The FPCLib.FPC root object
  17. Set root = CreateObject("FPC.Root")
  18.  
  19. 'Declare the other objects needed.
  20. Dim array ' An FPCArray object
  21. Dim VendorSets ' An FPCVendorParametersSets collection
  22. Dim VendorSet ' An FPCVendorParametersSet object
  23.  
  24. ' Obtain references to the array object
  25. ' and the network rules collection.
  26. Set array = curArray
  27. Set VendorSets = array.VendorParametersSets
  28.  
  29. On Error Resume Next
  30. Set VendorSet = VendorSets.Item( SE_VPS_GUID )
  31.  
  32. If Err.Number <> 0 Then
  33. Err.Clear
  34.  
  35. ' Add the item
  36. Set VendorSet = VendorSets.Add( SE_VPS_GUID )
  37. CheckError
  38. WScript.Echo "New VendorSet added... " & VendorSet.Name
  39.  
  40. Else
  41. WScript.Echo "Existing VendorSet found... value- " & VendorSet.Value(SE_VPS_NAME)
  42. End If
  43.  
  44. if VendorSet.Value(SE_VPS_NAME) <> SE_VPS_VALUE Then
  45.  
  46. Err.Clear
  47. VendorSet.Value(SE_VPS_NAME) = SE_VPS_VALUE
  48.  
  49. If Err.Number <> 0 Then
  50. CheckError
  51. Else
  52. VendorSets.Save false, true
  53. CheckError
  54.  
  55. If Err.Number = 0 Then
  56. WScript.Echo "Done with " & SE_VPS_NAME & ", saved!"
  57. End If
  58. End If
  59. Else
  60. WScript.Echo "Done with " & SE_VPS_NAME & ", no change!"
  61. End If
  62.  
  63. End Sub
  64.  
  65. Sub CheckError()
  66.  
  67. If Err.Number <> 0 Then
  68. WScript.Echo "An error occurred: 0x" & Hex(Err.Number) & " " & Err.Description
  69. Err.Clear
  70. End If
  71.  
  72. End Sub
  73.  
  74. SetValue
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement