cancel
Showing results for 
Search instead for 
Did you mean: 
danv
Level 7
Report Inappropriate Content
Message 1 of 7

Add, list, remove policies on servers?

I'm would like to use the web api to add and remove policies on systems, and also to list all policies applied for a given system.  I've found the policy.assignToSystem command, and that works fine for me.  I still am having trouble with resetInheritance, but I'm still looking at that.  Maybe I'm doing something wrong.  So my question is this.  Is there a way to unassign the policy?  Something like policy.unAssignFromSystem.  I didn't see anything like this in the core.help, but I'm hoping I've overlooked it.  Also, is there a way to get a list of all policy assignments made on a particular system (or a query I could make to do this).  I tried querying the applied policies, but that didn't seem to work.  I have EPO 5.1 installed.  I didn't see a 5.1 specific area, so I was hoping I could as this question here.

Thanks.

6 Replies

Re: Add, list, remove policies on servers?

Anybody have a response to this?  I'm having trouble resetting inheritance via the Web API as well.  I'm limited to only resetting to a default policy, which is not my preferred approach.

jking
Level 10
Report Inappropriate Content
Message 3 of 7

Re: Add, list, remove policies on servers?

Have you looked at policy.assignToGroup?

Running http://<server>:8443/remote/core.help?command=policy.assignToGroup I get:

OK:

policy.assignToGroup groupId productId objectId [resetInheritance]

Assigns policy to the specified group or resets group's inheritance for the

specified policy

Requires permission to at least one group in the System Tree and edit permission for at least one product

Parameters:

groupId (param 1) - Group ID as returned by system.findGroups

productId (param 2) - Product ID as returned by policy.find

objectId (param 3) - Object ID as returned by policy.find

resetInheritance (param 4) - If true resets the inheritance for the specified

policy on the given group. Defaults to false.

Jon

Re: Add, list, remove policies on servers?

The problem is, I need to assign (or unassign, rather) the policy on one machine, not a group.

I've tried running:

mc.policy.assignToSystem(line, 'VIRUSCAN8800', '29', '129', 'True')

with no effect.

Logically, the object ID shouldn't need to be present to reset inheritance so I tried without it and received a missing argument eror:

policy.assignToSystem names productId typeId objectId [resetInheritance]

Assigns policy to a supplied list of systems or resets systems' inheritance for the specified policy

Requires permission to at least one group in the System Tree and edit permission for at least one product

[names (param 1) | ids] - You need to either supply the "names" with a comma separated list of names/ip addresses or a comma separated list of "ids" to which the policy is to be assigned.

productId (param 2) - Product ID as returned by policy.find

typeId (param 3) - Type ID as returned by policy.find

objectId (param 4) - Object ID as returned by policy.find

resetInheritance (param 6) - If true resets the inheritance for the specified policy on the given group. Defaults to false.

Error 0 :

Missing argument: objectId.

jking
Level 10
Report Inappropriate Content
Message 5 of 7

Re: Add, list, remove policies on servers?

This worked for me:

jking@ ~ $ curl -qks -u <user>:<pass> "https://<server>:8443/remote/policy.assignToSystem?ids=3704&productId=EPOAGENTMETA&typeId=2&objectId=398&resetInheritance=true"

OK:

id: 3704

message: Reset inheritance succeeded

name:

status: 0

I think the difference is that the 'true' is case sensitive.  It didn't work for me when I upper cased it.

Jon

Re: Add, list, remove policies on servers?

Awesome!! That was exactly it.  'true' works, but 'True' does not.  Thank you so much!

jking
Level 10
Report Inappropriate Content
Message 7 of 7

Re: Add, list, remove policies on servers?

Sweet!  Happy to help.

Jon