Windows 7 Offline files - "Work online" programmatically

Posted on 2012-09-12
Last Modified: 2012-09-14

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 : 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"

Open in new window

The following is returned :
__GENUS          : 2
__CLASS          : __PARAMETERS
__RELPATH        :
__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 ?


OS version : Windows 7 Enterprise SP1 (x64)
PowerShell  version: v.1.0 (built-in with W7)
Question by:st-in
    1 Comment

    Accepted Solution

    Problem solved. I was not using the correct path for TransitionOnline("\\myDFS\myShare"). The script is working.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Why You Should Analyze Threat Actor TTPs

    After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

    Are you one of those front-line IT Service Desk staff fielding calls, replying to emails, all-the-while working to resolve end-user technological nightmares? I am! That's why I have put together this brief overview of tools and techniques I use in o…
    This is a PowerShell web interface I use to manage some task as a network administrator. Clicking an action button on the left frame will display a form in the middle frame to input some data in textboxes, process this data in PowerShell and display…
    The viewer will learn how to back up with the free utility from runtime software, DriveImageXML using Windows 7. Download DriveImageXML from Open folder where it was saved: Start installation by double clicking the install scrip…
    The viewer will learn how to successfully download and install the SARDU utility on Windows 7, without downloading adware.

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now