0

I am writing a Powershell utility that attempts to enable Offline files, then pin a drive to them. I'm using this documentation for the pin operation: http://msdn.microsoft.com/en-us/library/windows/desktop/bb309186(v=vs.85).aspx

So I have this (simplified to focus on the problem):

$OfflineFilesCache = [wmiclass]"\\localhost\root\cimv2:win32_offlinefilescache"
$OfflineFilesCache.Enable($true)
$DriveArray = , 'W:'
$OfflineFilesCache.Pin($DriveArray, 1, $true)

When I run it, I get the following error:

Exception calling "Pin" : "Provider is not capable of the attempted operation "
+ CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : WMIMethodException

It's not entirely obvious to me what I'm doing that's not correct; I think I am calling it as specified. The enabling the cache part works fine.

Casey
  • 3,307
  • 1
  • 26
  • 41

3 Answers3

0

I ran it and it worked just fine, might be your drive

Joel Smith
  • 857
  • 9
  • 20
0

I get this message on computers whose offline files cache is disabled. Make sure the cscservice is running.

-1

I am pretty sure that Offline files cache enable/disable requires a system restart.

  • Hi scheidel21, welcome to stack overflow, please make sure you read [answer]. To improve the quality of your answer, and the likelihood of it being accepted / upvoted, please elaborate as to how your answer solves the problem, provide facts pointing towards documentation whenever possible. – Dan Beaulieu Jul 22 '15 at 18:19