Windows 7 Offline files - "Work online" programmatically

Hi,

Windows 7, using redirection folders that are made automatically available offline.
Our redirected folders are always offline (and they are keeped in sync with the server with the Windows Background Sync every 60 minutes).

For some reason (errors 502 - Access denied in event log, CSC cache locked by other user), I must put the redirected folders in an Online State, before login off.
Via the GUI, I click my redirected folders (for example Desktop or Documents) and I select "Work Online". This works well.

I want to use that in an logout-script (using VBS or Powershell).
I have tried using the informations described in the Workaround section of this Microsoft KB : http://support.microsoft.com/kb/2610379/en-us with no success.
I received no errors, but in the GUI, the "Work Online" has not changed to "Work Offline" : why ?

I have also tried with Powershell using the code :

$oWMI = [wmiclass]"\\localhost\root\cimv2:win32_offlinefilescache"
$oWMI.TransitionOnline("\\myDFS\myShare")

Open in new window

The following is returned :
__GENUS          : 2
__CLASS          : __PARAMETERS
__SUPERCLASS     :
__DYNASTY        : __PARAMETERS
__RELPATH        :
__PROPERTY_COUNT : 1
__DERIVATION     : {}
__SERVER         :
__NAMESPACE      :
__PATH           :
ReturnValue      : 0

Open in new window

... but again, I still have the “Work Online” button.

Is there any way to make the folder working online programatically ?

Thanks

OS version : Windows 7 Enterprise SP1 (x64)
PowerShell  version: v.1.0 (built-in with W7)
st-inAsked:
Who is Participating?
 
st-inConnect With a Mentor Author Commented:
Problem solved. I was not using the correct path for TransitionOnline("\\myDFS\myShare"). The script is working.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.