Link to home
Start Free TrialLog in
Avatar of st-in
st-inFlag for Switzerland

asked on

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)
ASKER CERTIFIED SOLUTION
Avatar of st-in
st-in
Flag of Switzerland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial