none
Client Cache PersistInCache NULL in WMI? RRS feed

  • Question

  • Get-WmiObject -Namespace root\ccm\SoftMgmtAgent -Query 'SELECT * FROM CacheInfoEx WHERE PersistInCache = 0'

    We use the above powershell to pull CM Client cache info (for clean up old content etc)

    This seems to have stopped working because the "PersistInCache" property seems to be NULL now, whether or not the content is set to be persistent or not in the application object.

    Using the following will pull all content in cache obviously...

    Get-WmiObject -Namespace root\ccm\SoftMgmtAgent -Query 'SELECT * FROM CacheInfoEx'

    We are currently on 1706 (w/hofix) client version 5.0.8540.1611

    Anyone else able to confirm?  Know of another way to get persistant flag?  The other methods I have seen doesn't seem to have it (like via com-object UIResource.UIResourceMgr).

    Thank you

    Thursday, December 7, 2017 5:56 PM

All replies

  • Hi,

    I have tested it and the same as what you said. Also, I have no method to get persistent flag.

    If you want to cleanup the client cache which the content is not set to be persistent, you could refer to the link for the PowerShell scripts. (Although working well in my lab environment, please test it in your lab environment too):
    https://gallery.technet.microsoft.com/scriptcenter/Deleting-the-SCCM-Cache-da03e4c7.


    Please remember to mark the replies as answers if they help. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    • Edited by Yuxiang Shi Friday, December 8, 2017 11:28 AM
    Friday, December 8, 2017 11:02 AM
  • Thank you for confirming...

    Though it appears (just from quick glance) that script uses the same methodology to determine cache persistence...

    ## Get list of all non persisted content in CCMCache, only this content will be removed 
    Try { 
        $CacheItems = Get-WmiObject -Namespace root\ccm\SoftMgmtAgent -Query 'SELECT ContentID,Location FROM CacheInfoEx WHERE PersistInCache != 1' -ErrorAction Stop 
    } 

    The snippet above would suggest this cleanup will delete persistent cache items (if all other qualifiers are met AND in our cases where the PersistInCache is NULL ).



    • Edited by dandirk Friday, December 8, 2017 12:55 PM
    Friday, December 8, 2017 12:53 PM
  • Hi,

    I wrote that script but it was complete and utter shit.
    I just finished a new version that skips persisted content and much more.
    Will probably update the blogpost here: https://sccm-zone.com/deleting-the-sccm-cache-the-right-way-3c1de8dc4b48

    but meanwhile you can use the version here:

    https://raw.githubusercontent.com/JhonnyTerminus/SCCMZone/master/Powershell/Clean-CMClientCache/Clean-CMClientCache.ps1

    Ioan

    Tuesday, July 10, 2018 1:55 PM