Solved

VBScript to auto-clear "Enable Offline Files" setting

Posted on 2006-10-24
10
2,614 Views
Last Modified: 2011-10-03
Our agency has recently begun using Ghost to re-image PCs when deemed necessary.  The image we use is provided by our parent organization and we cannot change it.  One of the recent tweaks they made to the image was that the Default User profile has the "Enable Offline Files" setting checked (under Folder Options in Windows Explorer).  This was done because the same image we use for our desktops is also used for our laptops--where such a setting actually serves a useful purpose.  For our desktop users, this setting is not only unncessary, but terribly confusing--whenever the user logs off, they get confusing messages about "synchronizing files," or worse, error messages telling them that "such-and-such file cannot be synchronized."

What I want to do is add a statement to the logon script for our desktop PC users, that clears this setting.

Can this be done?
0
Comment
Question by:jmundsack
  • 5
  • 4
10 Comments
 
LVL 66

Expert Comment

by:johnb6767
ID: 17805504
We have our GPO's divided by Laptops and Workstations, and the Workstations OU doesnt get the Offline folders. Just a thought...

Here is a page at MS talks about the NetCache..Might have een it already..Tells how to disable it in the registry and via GPO

http://www.microsoft.com/technet/prodtechnol/windows2000serv/reskit/regentry/92773.mspx?mfr=true

Unfortunately, I am not a scripter, outside of DOS, so I cannot help with that portion.
0
 
LVL 13

Author Comment

by:jmundsack
ID: 17805928
Well, the scripting is the easy part, for me.

I really had my hopes up with the page you referenced.  Unfortunately, in practice, what I found was this:

I went to one of the desktops where the "Enable Offline Files" is checked.  I ran my script which creates the "Enabled" DWORD, set to zero (which, according to the webpage, means, "Offline Files is disabled, and users cannot enable it").  Then I went back to the Folder Options dialog, and, the "Enable Offline Files" box WAS indeed disabled; however, it was STILL CHECKED!  LOL

The description, "Offline Files is disabled..." suggests it would uncheck the box, and "users cannot enable it" suggests they couldn't check it even if they tried.  But perhaps the part about "Offline Files is disabled" only applies to NEW profiles on the machine--that is, it won't alter the setting for users who already have it enabled?

I will check this out....
0
 
LVL 66

Accepted Solution

by:
johnb6767 earned 500 total points
ID: 17806044
Try this on the system you tested at....

Does the system still try and synchronize?

If so, se this method to reinitialize the CSC cache...Once it is empty, and no further offline files being enabled, it might work...

How to re-initialize the offline files cache and database
http://support.microsoft.com/kb/230738

Our laptops that have the Offline files GPO applied, still haev teh box checked, but since they cant right click or context menu select to make available, no synchronizations happen....
0
 
LVL 13

Author Comment

by:jmundsack
ID: 17806579
Well how's this for a nice turn of events?

When I did BOTH things:

1. Create HKLM\SOFTWARE\Policies\Microsoft\Windows\NetCache\Enabled (DWORD = 0)
2. Create HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\NetCache\FormatDatabase (DWORD = 1)

And then restarted the computer, the result is EXACTLY what I was looking for: the box is unchecked, and it's disabled so it cannot BE checked!  Perfect!  Now all I have to do is figure out how to automatically restart Windows XP from VBScript, but that's beyond the scope of this question.

In case you're interested, here is the VBScript code to do the above:

    Dim oWshShell
    Set oWshShell = CreateObject("Wscript.Shell")
    oWshShell.RegWrite  "HKLM\SOFTWARE\Policies\Microsoft\Windows\NetCache\Enabled", 0, "REG_DWORD"
    oWshShell.RegWrite  "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\NetCache\FormatDatabase", 1, "REG_DWORD"

Thank you for all your expert help!
0
 
LVL 66

Expert Comment

by:johnb6767
ID: 17806836
No problem. Keep in mind there is a shutdown command built in from command line.....

again, not knowing scripting....

shutdown -r -t 60

H:\>shutdown /?
Usage: shutdown [-i | -l | -s | -r | -a] [-f] [-m \\computername] [-t xx] [-c "comment"] [-d up:xx:yy]

        No args                 Display this message (same as -?)
        -i                      Display GUI interface, must be the first option
        -l                      Log off (cannot be used with -m option)
        -s                      Shutdown the computer
        -r                      Shutdown and restart the computer
        -a                      Abort a system shutdown
        -m \\computername       Remote computer to shutdown/restart/abort
        -t xx                   Set timeout for shutdown to xx seconds
        -c "comment"            Shutdown comment (maximum of 127 characters)
        -f                      Forces running applications to close without warning
        -d [u][p]:xx:yy         The reason code for the shutdown
                                u is the user code
                                p is a planned shutdown code
                                xx is the major reason code (positive integer less than 256)
                                yy is the minor reason code (positive integer less than 65536)
0
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.

 
LVL 13

Author Comment

by:jmundsack
ID: 17807152
Yep--I did find that command as soon as I started searching.  Thank you for the extra-credit effort though!

0
 
LVL 66

Expert Comment

by:johnb6767
ID: 17808975
No problem, and since I dont know when to quit, Make sure you dont have that FormatDatabase value running every launch, as it may slow the PC down next boot. I would say after a week or so, remove the values form teh script altogether, since they more than likely would all be hit by then...
0
 
LVL 13

Author Comment

by:jmundsack
ID: 17808988
Hey, I appreciate it.  But actually this isn't going to be in a login script.  It will be something we run after reimaging a machine--one shot deal per machine.  Actually we already have a script that we run to install some additional software on top of the image (I work for a county government agency--we get our image from the state, without our local apps on it, and then we install the local apps).  So, I've just tacked this script onto the end of that software install script, and we're gold.  Thanks again for your help and for covering all the bases.
0
 
LVL 66

Expert Comment

by:johnb6767
ID: 17809261
anytime!!
0
 

Expert Comment

by:neerjajha
ID: 34177391
create script for:  Disables Offline files for desktop computers
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

743 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

11 Experts available now in Live!

Get 1:1 Help Now