我正在編寫一個Powershell實用程序,嘗試啓用脫機文件,然後將驅動器固定到它們。我使用這些文件,以銷動作:http://msdn.microsoft.com/en-us/library/windows/desktop/bb309186(v=vs.85).aspx使用Win32_OfflineFileCache固定文件夾失敗:「提供程序無法嘗試操作」
所以我有這個(簡化,以專注於問題):
$OfflineFilesCache = [wmiclass]"\\localhost\root\cimv2:win32_offlinefilescache"
$OfflineFilesCache.Enable($true)
$DriveArray = , 'W:'
$OfflineFilesCache.Pin($DriveArray, 1, $true)
當我運行它,我得到以下錯誤:
Exception calling "Pin" : "Provider is not capable of the attempted operation "
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : WMIMethodException
這對我來說並不完全清楚我在做什麼,這是不正確的;我想我是按照規定來調用它的。啓用緩存部分工作正常。
前兩行啓用脫機文件緩存。 – Casey