Video Screencast Help
Symantec to Separate Into Two Focused, Industry-Leading Technology Companies. Learn more.

How to trigger a Policy update

Created: 19 Oct 2012 • Updated: 19 Oct 2012 | 4 comments

I support a workflow whose goal is to deploy software to computer(s).  The workflow allows the user to add computers to filters and then triggers the computer(s) to check in to the console.  What we are finding is that even though the filters are being updated, the Policies associated with them are not.  As a result the software is not deployed for up to four hours.

Has anyone developed a workflow technique for forcing a Policy to update?  It would be the same functionality that is triggered within the console by navigating to a a policy (Manage --> Policy), on the Applied to tab select Computers from the Apply to drop down list and clicking the Update results button.

Comments 4 CommentsJump to latest comment

b3tts32's picture

Copying my answer from another thread but this should work for you and save me some typing.

So do you just need to update the resource target or a filter? Either way it should be do-able you would just need to pass in the guid. 

If you need to update the Filter then you can use the UpdateCollectionsComponent under Symantec > SMP 7 > Web Services > Collections which is pretty straight forward as long as you pass in the right guid. 

As for the target update, which I think may be the same as the Delta Update you'd need to use a stored procedure to get it to update. Which can be done from an integration library via the stored procedure caller generator. The specific stored procedure you're looking for is spResourceTargetDeltaUpdate from the Symantec_CMDB under Programmability > Stored Procedures. It has a few different inputs to it but the only one that's required is the GUID. I grabbed the GUID from my managed delivery policy and used a GetResourceTargetsComponent to get the GUID for the Resource target that would need to be updated. Hopefully that makes sense.

Below is a screenshot of a workflow I created to add computers to a filter then update resource target which may give you a visual idea.

https://www-secure.symantec.com/connect/forums/scheduling-tasks-error-post-imaging-workflow#comment-7209431

M Rutledge's picture

I'm trying to implement your solution but am having a some issues.

Concerning the use of the Stored Procedure Caller Generator.  When I create a generator for the spResourceTargetDeltaUpdate procedure I get a couple of error messages.  The first is on the Connection panel.  When I specify the Stored procedure I get the message about an error in the DataGridView,  "DataGridViewComboBoxCell value is not valid".  I get this message several times, I assume once for each of the parameters expected by the procedure. 

On the Fields panel I get a message stating "Cannot find the object #targetFilterResource because it does not exist or you do not have permissions".  Based on the name I assume this is a temporary table

In your solution you run the Get Resource Targets component passing it the Guid for the Policy to update.  Where did you get the Policy Guid? 

Finally, what does the Update Collections component do?  I assume I pass it the Guid for the Filter that was updated, but can't figure out the value to pass in the 'Type' parameter.  My project uses the Add Inclusions component to add computers to Filters but does not make use of the Update Collections component.

 
b3tts32's picture

I went back through my Integrated Library and got the same thing for the "DataGridViewComboBoxCell" messages, I believe I remember getting that the first time I selected the stored proc but just "ok'd" through it. I'm not really sure what the message means.. maybe one of the Symantec guys could chime in. I had no problem using it though once I got past the message. 

For the fields section, leave the Return Value unchecked since you won't be returning anything back. That should bypass that particular issue.

I believe I just went to my console and right clicked on the policy and got the GUID from the properties menu. I know that's really not efficient at all or dynamic but I didn't put much time into it. You could populate a list with a query/table generator and have the Policy Name be your display field and pass the GUID in to your next component from there. The SQL code would be something like..

SELECT [Guid]
      ,[Name]
        FROM [Symantec_CMDB].[dbo].[vNonResourceItem]
  
  where ClassGuid= '2D3A170E-5028-4570-BA0C-3DB775CB8BDE'
  
  order by Name

Update Collections updates the membership if I remember correctly, it seems like I had issues getting the add inclusions component to work so I added the update collections component after it. I don't have a type entry for my update collections component so I'm not exactly sure. If that portion of it is working for you I wouldn't necessarily worry about it. But there is a bit of documentation on the web services which these components are calling on your NS under All Programs > Altiris > ASDK Help which may give you more info.

As an additional note I did notice running these components that call web services from the NS was a tad bit slow for my liking, so I ended up calling stored procedures that do the same thing which was night and day faster. AddInclusions for example has an equivalent stored proc of spCollectionIncludesResourceInsert.

M Rutledge's picture

I ended up having to add a step to update the CollectionMembership table prior to running the spResourceTargetDeltaUpdate procedure.  See the attached word document for the logic I put into an Embedded Model.  The model is executed after an Add Inclusions model updates the CollectionIncludeResource table.

Thank you for your help.

AttachmentSize
Update Collections and Policies.docx 106.82 KB