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.