16 พฤษภาคม 2555 11:47
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 = objCache.pin("\\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 14:05
DeleteItems is a class method.
Correct format is to use class method.
$cs=Get-WmiObject -List Win32_OfflineFilesCache -computer <compname>
$cs.DeleteItem('path to ite', flags)
- ทำเครื่องหมายเป็นคำตอบโดย rpseekell 16 พฤษภาคม 2555 20:12
16 พฤษภาคม 2555 20:12Thank you! The difference was I needed to use the -List parameter.
16 พฤษภาคม 2555 20:22
Thank you! The difference was I needed to use the -List parameter.
The method is a static method. Static methods alwya exist only on the class and are not avasilable on an instance.