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  

Related Posts:

  • Removing Outlook Data Files Automating the removal of Outlook data files is a tedious process that is difficult to automate. The registry key is a data hash that is unique on each system. Here is a script I wrote that will do just that. This script wi… Read More
  • Adjust Screen Resolution during Build Sometimes the screen resolution in a build does not set to the maximum. Resolution can be set with PowerShell, but the scripting requirements and complexity is too much, IMO. AutoIT offers an easy way to automate this proce… Read More
  • Enable Wake-On-LAN NOTE: This is an old script. I have a newer and more efficient one located here. This script will enable WOL and test to make sure it has been set. It will return whether it was a success or failure both to a log file and … Read More
  • Pinning Shortcuts to the Taskbar and Start Menu There are already scripts out there that will do this, but I have taken it a little further. I have added checking to make sure the application is installed first so that the script does not error out. I have also added on-… Read More
  • SCCM Client Installer Installing the SCCM client takes a few minutes. This script was written so that it will wait for the ccmsetup.exe to complete. I have encountered issues with the setup not completing before the system reboots during a build… Read More

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