Washington DC Endpoint Management User Group

 View Only
  • 1.  Create Resource Target component

    Posted Mar 29, 2012 05:50 PM

    I need to use workflow to assign a computer to a Manage Delivery Policy. I am succesfully getting the Policy information in the workflow but it looks like you can't assign a computer directly to the policy. You have to create a resource target first and then assign that to the policy. When I try to create the Resource target I bomb out but can't tell why. Here I am using in my XML:

    <resourceTarget>
      <name>Client Build Wizard - UsersComputer.Name</name>
      <description>This target was create by the Client Buid Wizard</description>
      <baseOrganizationalGroupGuid>91c68fcb-1822-e793-b59c-2684e99a64cd</baseOrganizationalGroupGuid>
      <targetFilters>
        <targetFilter>
          <type>Individual Resources</type>
          <operation>Intersect</operation>
          <resourceGuids>
            <resourceGuid>UsersComputer.Id</resourceGuid>
          </resourceGuids>
        </targetFilter>
      </targetFilters>
    </resourceTarget>

     

     

     This is what the ASDK says:

    The "name" value is the name of the new Resource Target. The "description" contains a description of the Resource Target (this "description" element is optional). The "baseOrganizationalGroupGuid" value should be given the value of the GUID of the Organizational Group item that defines the base or beginning set of resources against which any filters will be applied. If no value is given for the "baseOrganizationalGroupGuid" element, the base organizational group will be set to "All Discovered Resources." (NOTE: Some policies may impose an additional restriction on the starting Group to apply only to Computer or User resources.)

    Zero or more filters may be added under the "targetFilters" element. Each "targetFilter" element defines a different filter to apply. The "type" of the filter must be one of "Organizational Group," "Resource Collection," or "Individual Resources." If the type is given as "Organizational Group," then there must be a sibling element "organizationalGroupGuid" whose value is the GUID of the existing Organizational Group item to be used as the filter. If the type is "Resource Collection," there must be a sibling element "resourceCollectionGuid" with the value of either (1) the GUID of the old-style (NS 6.x) collection, or (2) the Guid of an NS 7 Resource Collection, containing the resources to be used as the filter. (Note: An NS 7 Resource Collection is referred to as a "filter" in the NS Console.) If the type is given as "Individual Resources," there must be a sibling element "resourceGuids" which in turn contains one or more "resourceGuid" elements, each of which contains the GUID of an individual resource to be included in that filter.

    There can be zero or more of each of the three types of filters, in any combination. NOTE: The order in which you place the filters in the XML is important. When the Resource Target is created, each filter will be evaluated in the order it appears in the XML, starting at the topmost filter element and moving downward.

    The "operation" element in each Target Filter defines the logical operation that will be performed between the resources contained in the the filter and base organizational group (in the case of the first filter), or between the filter's resources and the resource set derived from the previous filter opertation (in the case of the second and subsequent filters). Only three values are allowed: "Intersect," "Union," and "Except."

    For more information, see the NS7 documentation regarding Resource Targets and Target Filters.

     

     



  • 2.  RE: Create Resource Target component

    Posted Mar 30, 2012 08:06 AM

    If your swd policy allready has a target based on filtermembership you can:

    • use add to collection component to add computer to filter
    • create a sql component:
      set @targetGuid = (SELECT top 1 [ParentItemGuid] as TargetGuid FROM [ItemReference] where hint='resourcetargetfilter' and [ChildItemGuid]=@filterGuid order by createddate desc)
      EXEC spResourceTargetDeltaUpdate @targetGuid
      where @filterGuid is guid of filter which the policy target is based on

     

    Not sure if Add Inclusion or Add Items to Collection components updates the collection membership. If not you'll have to update it manually with pc Guid BEFORE you update the target:
     
    EXEC('INSERT INTO CollectionIncludeResource ([CollectionGuid],[ResourceGuid],[CreatedDate]) VALUES ('''+@filterGuid+''','''+@PCguid+''', getdate() )')
    EXEC('INSERT INTO CollectionMembership ([CollectionGuid],[ResourceGuid],[CreatedDate]) VALUES ('''+@filterGuid+''','''+@PCguid+''', getdate() )')
    EXEC('UPDATE Collection SET LastUpdated = GETDATE() where Guid='''+@filterGuid+'''')
     
    After this a Update Client Config job installs the sw asap.
     
     



  • 3.  RE: Create Resource Target component

    Posted Apr 02, 2012 01:50 PM

    I would rather use the SDK components than create my own SQL work around if I don't have to. However your sql query did help me find the correct baseOrganizationalGroupGuid. I was using the wrong one for All Computers. It looks like it should be..."EB3A1A12-E1C7-4431-B060-F0333E4E488C"



  • 4.  RE: Create Resource Target component

    Posted Apr 02, 2012 02:34 PM

    Found my problem... found this error in the logs...

    "The specified base organizational group guid does not exist."

    So I am still using the wrong base guid. How do I find these?



  • 5.  RE: Create Resource Target component

    Posted Apr 02, 2012 03:44 PM

    The base Organizational Group for computers is... 91c68fcb-1822-e793-b59c-2684e99a64cd

    I was also placing the Computer.ID variable in the wrong spot in the XML. Once I noticed those two things I was good to go.