Selectively disable ccm_recentlyusedapps per client

If you have enabled the ccm_recentlyusedapps class in sms_def.mof, but have noticed that on multiple-user servers (like Citrix, or application servers), the delta or full hardware inventory file is too large (50mb is the max allowed) to be processed by your primary site, the following are the steps you can do to disable CCM_RecentlyusedApps on a per-client basis, while leaving it on for the site.

Credits: This forum entry The author of the mof snippet is koenraadrens, with some additional steps taken from Paul Thomsen's Local Policy
presentation at Microsoft Management Summit 2009

Steps To Do

  1.  At a client for primary site code <ABC>, run
     wbemtest
     connect
     root\ccm\policy\machine\requestedconfig
     Connect
     query...
     select * from inventorydataitem where itemclass = "ccm_recentlyusedapps"
     apply
     double-click the result
     Scroll to find DataItemID, double-click and copy the value someplace (notepad)
  2. If you have multiple primary sites, repeat for a client of each primary site.  The DataItemID is unique to each Primary Site.
  3. Copy the below to a text file, replacing the {InsertYourUniqueDataItemIDHere} with your unique dataitemid. If you have multiple primary sites, you will need entries for each dataitemID.  Replace "InsertAUniqueNameHere" with something like...  ABCCCMRecentlyUsedAppsDisable  (where abc is the site code)  Why? because if/when you need to selectively delete local policies, you can do so by targetting in wmi where policyid = that unique name.  The text below is a sample of where you might have Two Primary Sites in your environment ABC and XYZ.  If you only have 1 site, remove one of the sections.

    #pragma namespace("\\\\.\\root\\ccm\\policy\\machine\\requestedconfig")   
    [CCM_Policy_PartialPolicy(true)]   
    instance of InventoryDataItem  
    {  
        DataItemID = "{InsertYourUniqueDataItemIDHereForSiteCodeABC}";  
        Namespace = "\\\\.\\root\\ccm\\SoftwareMeteringAgent";  
        ItemClass = "CCM_RecentlyUsedApps";  
        PolicySource = "Local";  
        PolicyID = "ABCCCMRecentlyUsedAppsDisable";   
        PolicyVersion = "2";  
        PolicyRuleID = "2";  
        PolicyInstanceID = "2";  
        // override only this property, all others from the Site/Management Point  
        [CCM_Policy_Override(true)]  
        InventoryActionID = "{00000000-0000-0000-0000-123412341234}";  
    };
    #pragma namespace("\\\\.\\root\\ccm\\policy\\machine\\requestedconfig")   
    [CCM_Policy_PartialPolicy(true)]   
    instance of InventoryDataItem  
    {  
        DataItemID = "{InsertYourUniqueDataItemIDHereForSiteCodeXYZ}";  
        Namespace = "\\\\.\\root\\ccm\\SoftwareMeteringAgent";  
        ItemClass = "CCM_RecentlyUsedApps";  
        PolicySource = "Local";  
        PolicyID = "XYZCCMRecentlyUsedAppsDisable";   
        PolicyVersion = "3";  
        PolicyRuleID = "3";  
        PolicyInstanceID = "3";  
        // override only this property, all others from the Site/Management Point  
        [CCM_Policy_Override(true)]  
        InventoryActionID = "{00000000-0000-0000-0000-2345234523452345}";  
    };
  4. Note:  InventoryActionID is a fake, made up InventoryActionId.  That's what causes this partial policy to make the client not report ccm_recentlyusedapps.
  5. On each client where you want to disable ccm_recentlyusedapps, presuming you have saved the above snippet as LocalPartialPolicy_CCM_RecentlyUsedApps_Disable.mof, using any method (likely software distribution), run
    mofcomp LocalPartialPolicy_CCM_RecentlyUsedApps_Disable.mof
    - Because you are modifying WMI, run with an Administrative account, or with SYSTEM credentials.
  6. End result: until you either cleanup (see below) or completely uninstall the ConfigMgr client and cleanup WMI post-client uninstall, CCM_RecentlyUsedApps will no longer be reported by this client.

Cleaning Up  - Taken from Paul Thomsen's Local Policy Presentation at Microsoft management Summit 2009:

  1. To delete *all* local policies.  If you have multiple local policies (like the sample above has two, 1 for ABC and 1 for XYZ), or you may implement a local policy to disable BHO, or Shortcuts, see 2.
    Set oReq = GetObject("winmgmts://./root/ccm/policy/machine/requestedconfig")
    Set oPolicies = oReq.ExecQuery("SELECT * FROM CCM_Policy where PolicySource='Local'")
    For Each oPolicy in oPolicies
      oPolicy.Delete_
    Next
  2. If you want to selectively delete a local policy, and you know the unique policyID you gave that local policy, you could use something like...
    Set oReq = GetObject("winmgmts://./root/ccm/policy/machine/requestedconfig")
    Set oPolicies = oReq.ExecQuery("SELECT * FROM CCM_Policy where PolicySource='Local'")
    For Each oPolicy in oPolicies
      if lcase(opolicy.policyid) = "abcccmrecentlyusedappsdisable" then
        oPolicy.Delete_
      end if
    Next

    That would delete the abc instance, and leave the xyz one.

Other notes  If you happen to be battling some servers sending really large inventory because of ccm_recentlyusedapps, note that you may want to invoke a "full" hardware inventory on those servers.  A delta hinv may attempt to send up just as large of a file as when ccm_recentlyusedapps was on, because it now wants to send up a "I've removed these entries", and wants to tell the DB.  So a full Hinv might be in order as a standard action to perform following implementing this change.

Here's a possible custom mof edit for sms_def.mof/configuration.mof to pull in any local policies set.

Published Friday, July 03, 2009 4:19 PM by skissinger
Filed under: ,

Comments

No Comments