25 June 2012

Enable/Disable Offline Files

Here is a VBScript that will either enable or disable offline files. It can also be done as a policy by modifying the registry key listed below, or through a group policy.

You can download the registry key below from here.


Policy Registry key for disabling offline files. Change the 00000001 to 00000000 to enable.
 Windows Registry Editor Version 5.00  
 [HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\NetCache]  
 "DisableFRAdminPin"=dword:00000001  

VBScipt that enables/disables the Offline File Cache
 '*******************************************************************************  
 '     Program: Install.vbs  
 '      Author: Mick Pletcher  
 '        Date: 25 June 2012  
 '    Modified:   
 '  
 ' Description: This will enable or disable the Offline File Cache  
 '                 1) Set Offline File Cache  
 '*******************************************************************************  
 Option Explicit  

 REM Set Offline File Cache   
 SetOfflineFileCache()  

 '*******************************************************************************  
 '*******************************************************************************  
 Sub SetOfflineFileCache()  

      REM Define Local Constants  
      CONST Disable = "False"  
      CONST Enable  = "True"  

      REM Define Local Objects  
      DIM oShell : SET oShell = CreateObject("Wscript.Shell")  

      REM Define Local Variables  
      ' Change the variable at the end of the Install Variable to either Enable or Disable  
      DIM Install : Install = "wmic path win32_offlinefilescache call enable" & Chr(32) & Disable  

      oShell.Run Install, 1, True  

      REM Cleanup Local Variables  
      Set Install = Nothing  
      Set oShell  = Nothing  

 End Sub  

2 comments:

  1. Your registry location is wrong. You're missing the Windows subkey. It should be:

    HKCU\Software\Policies\Microsoft\Windows\NetCache\DisableFRAdminPin

    ReplyDelete
    Replies
    1. Thanks for the catch. That is what I get when I am typing too fast. LOL!

      Delete