• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 568
  • Last Modified:

Script that deletes file from XP roaming profile -- needs refinement

I'd like for someone to take a look at the code below (which I've pieced together from an example script that I once found).  It loads via Group Policy as a "logon script".

It works properly in that it deletes one specific file after waiting 9 seconds.  In case you're wondering, I can't exclude this entire directory from users' roaming profiles, but this self-generating 9MB help file creates unnecessary panic as the "exceeded roaming profile storage space limit" pops up prematurely.

HOWEVER, it needs some refining because occasionally users complain about an "activex component can't create object 'scripting.filesystemobject' " while their deskop is loading.  They click OK and everything is fine, except it's a nuisance issue for me.

Dim fso, fld, subf

Set fso = CreateObject("Scripting.FileSystemObject")
Set fld = fso.GetFolder("c:\Documents and Settings")

On Error Resume Next

WScript.Sleep(9000)

For Each subf In fld.SubFolders
    fso.DeleteFile "c:\Documents and Settings\" & subf.Name & "\Application Data\ShoreWare Client\Help_17_61_4706_0.pdf"
Next

Set subf = Nothing
Set fld = Nothing
Set fso = Nothing

Open in new window

0
Elmo_Oxygen
Asked:
Elmo_Oxygen
1 Solution
 
David Johnson, CD, MVPOwnerCommented:
why not just a batch file
@ECHO OFF
> "%Temp%.\sleep.vbs" ECHO WScript.Sleep 9000
CSCRIPT //NoLogo "%Temp%.\sleep.vbs"
DEL "%Temp%.\sleep.vbs"
del "%appdata%\ShoreWare Client\Help_17_61_4706_0.pdf"

Open in new window

0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now