I've got a project where FPCPolicyRule's is being created with .net(C#) through FPCLib, now i've become aware of an additional setting which is only able to be altered when the rule has been saved e.g. FTP regarding uploads is being blocked by default, that may be good for some rules. But how do i find/change that setting api-wise?
Set fso = CreateObject("Scripting.FileSystemObject") Set rule = GetPolicyRule(RuleName) Set vpSets = rule.VendorParametersSets
Set vpSet = vpSets.Item(FTPFilterGUID) vpSet.Value("BOOL_VALUE") = "FALSE" vpSet.Save
function GetPolicyRule(ruleName) Dim root Dim rules Dim errorCode, errorDescript
Set root = WScript.CreateObject("FPC.Root") Set rules = root.GetContainingArray.ArrayPolicy.PolicyRules On Error Resume Next Set GetPolicyRule = rules(ruleName) Select case err.Number case Error_FileNotFound: WScript.Echo "The policy rule " & ruleName & " could not be found." WScript.Quit case 0: ' OK case Else err.Raise err.Number,, err.Description End Select On Error GoTo 0 End Function
< Message edited by parseint -- 14.Dec.2010 9:07:27 AM >
I forgot to add the vendor set if it doesn't exist, here's the code for doing that:
sub AddVendorSet(ruleN, guid) 'Define the constants needed. Const Error_FileNotFound = &H80070002
Dim rule, vpSets, vpSet
set rule = GetPolicyRule(ruleN) Set vpSets = rule.VendorParametersSets
' Try to retrieve the required vendor parameters set. ' If it does not exist, create it. On Error Resume Next Set vpSet = vpSets.Item(guid) If Err.Number = Error_FileNotFound Then Err.Clear WScript.Echo "Creating the required vendor parameters set..." Set vpSet = vpSets.Add(guid) If Err.Number <> 0 Then WScript.Echo "An error occurred: 0x" & Hex(Err.Number) & " " & Err.Description WScript.Quit End If Else WScript.Echo "The vendor required parameters set already exists." End If Err.Clear On Error GoTo 0
' Set the value of the parameter. vpSet.Value("BOOL_VALUE") = "FALSE"
vpSet.Save WScript.Echo "Done adding vendor set!" End Sub
< Message edited by parseint -- 14.Dec.2010 9:06:59 AM >