25 June 2012

Enable/Disable Offline Files

Posted By: Mick Pletcher - 10:50 AM

Share

& Comment

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.

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  

About Mick Pletcher

My blog is here to help solve issues I have encountered and solved, publish scripts I have written, and educate others in understanding areas that are not well covered

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

Copyright © 2013 Mick's IT Blogs™ is a registered trademark.