Remove One Folder from Offline Files Cache


  • I am not sure where to place this question, but Leo Huang sent me here from Windows 7 Networking.  The problem is that on Windows 7 (Ent) I have several servers and shares in the "Offline Files Folder" that I don't want there anymore; they are either folders I used temporarily or no longer exist. In the folder, I can right-click a computer and "Delete Offline Copy", and it will respond "Completed Deleting Offline Copies", but the computer and share are still listed. I want to make some of those computers go away from my cache completely, so that they are no longer listed and no longer post to the offline files event log when they connect or disconnect.

    I know that clearing the CSC cache with the registry key "formatdatabase" is an option, but that would mean clearing out the entire CSC cache, which will be highly inconvenient to reload, and with multiple users constitutes possible data loss.

    Furthermore, I see that the Win32_OfflineFilesCache has a method called "deleteItems", but I cannot get it to work correctly in vbscript.  Here is my code, which results in "SWbemObjectEx: Type mismatch".

    dim uiResult
    Set objWMILocator = WScript.CreateObject("WbemScripting.SWbemLocator")
    Set objWMIServices = objWMILocator.ConnectServer("localHost", "root\cimv2")
    Set objCache = objWMIServices.Get("Win32_OfflineFilesCache=@")
    uiResult ="\\server\share",&H00000010)

    So I would be happy with one of two things: either a working example of using Win32_OfflineFilesCache.DeleteItems, or another way to remove a certain server/share from the Offline Files Cache in Windows 7.  Thanks in advance for any help or guidance you give.

    16 พฤษภาคม 2555 11:47