Solved

Logoff script generating a logoff error and not cleaning temp internet files

Posted on 2004-03-26
10
311 Views
Last Modified: 2010-05-01
Hello.  I work in a school district where hundreds of  different users login to workstations hourly.  How can I get rid of the cookies and temp internet files on the local workstation through a logoff script.  I have one created, but keep getting error messages and it is not cleaning the files out.  Here is what I have running on logoff.

SET SRC1=C:\Documents and Settings
SET SRC2=Local Settings\Temporary Internet Files\Content.IE5
SET SRC3=Local Settings\History
SET SRC4=Local Settings\Temp

FOR /D %%X IN ("%SRC1%\*") DO FOR /D %%Y IN ("%%X\%SRC2%\*.*") DO RMDIR /S /Q "%%Y"
FOR /D %%X IN ("%SRC1%\*") DO FOR /D %%Y IN ("%%X\%SRC3%\*.*") DO RMDIR /S /Q "%%Y"
FOR /D %%X IN ("%SRC1%\*") DO FOR /D %%Y IN ("%%X\%SRC4%\*.*") DO RMDIR  /S /Q "%%Y"
FOR /D %%X IN ("%SRC1%\*") DO FOR  %%Y IN ("%%X\%SRC3%\*.*") DO DEL /F /S /Q "%%Y"
FOR /D %%X IN ("%SRC1%\*") DO FOR  %%Y IN ("%%X\%SRC4%\*.*") DO DEL /F /S /Q "%%Y"

exit

The error is:  Line 1 Char:  12   Error:  Expected Statement    Code:  800A0400  Source:  Microsoft VBScript compilation error.

Any help you can give would be much appreciated.
0
Comment
Question by:manch03
  • 3
  • 2
  • 2
  • +1
10 Comments
 
LVL 67

Expert Comment

by:sirbounty
ID: 10686823
Hi manch03,
Try changing the first line to
C:\DOCUME~1
and the next three to
LocalS~1
with Tempor~1 (instead of Temporary Internet Files)...
~sirbounty
0
 
LVL 28

Expert Comment

by:vinnyd79
ID: 10686934
or try changing to:

SET SRC1=Chr(34) & "C:\Documents and Settings" & Chr(34)
SET SRC2=Chr(34) & "Local Settings\Temporary Internet Files\Content.IE5" & Chr(34)
SET SRC3=Chr(34) & "Local Settings\History" & Chr(34)
SET SRC4=Chr(34) & "Local Settings\Temp" & Chr(34)

0
 

Author Comment

by:manch03
ID: 10688947
Ok - now it does not like:

Line 6, Character 5
Line 1, Character 12

I changed to vinnyd79 comment and ran it.

ET SRC1=C:\Documents and Settings
SET SRC2=Local Settings\Temporary Internet Files\Content.IE5
SET SRC3=Local Settings\History
SET SRC4=Local Settings\Temp

FOR /D %%X IN ("%SRC1%\*") DO FOR /D %%Y IN ("%%X\%SRC2%\*.*") DO RMDIR /S /Q "%%Y"
FOR /D %%X IN ("%SRC1%\*") DO FOR /D %%Y IN ("%%X\%SRC3%\*.*") DO RMDIR /S /Q "%%Y"
FOR /D %%X IN ("%SRC1%\*") DO FOR /D %%Y IN ("%%X\%SRC4%\*.*") DO RMDIR  /S /Q "%%Y"
FOR /D %%X IN ("%SRC1%\*") DO FOR  %%Y IN ("%%X\%SRC3%\*.*") DO DEL /F /S /Q "%%Y"
FOR /D %%X IN ("%SRC1%\*") DO FOR  %%Y IN ("%%X\%SRC4%\*.*") DO DEL /F /S /Q "%%Y"

exit
0
 
LVL 67

Expert Comment

by:sirbounty
ID: 10689069
Personally, I think you'd be better off creating a batch file here with these command in it...
Either using the 8.3 conversion as I'd displayed or vinnyd79's suggestion of enclosing the LFNs in quotations.
Then have your script simply point to the batch file...
0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 

Author Comment

by:manch03
ID: 10689206
I can just convert this to  batch file?  Are there any commands I need to change?
0
 
LVL 67

Accepted Solution

by:
sirbounty earned 350 total points
ID: 10689321
Just a touch-up.  Haven't tested this, so remove the "echo" if the process routine displays what you need...

SET SRC="%USERPROFILE%\LocalS~1\"
SET SRC1=Tempor~1\Content.IE5
SET SRC2=History
SET SRC3=Temp

FOR /D %%X IN (%SRC%") DO CALL :PROCESS %%X
SET SRC=
SET SRC1=
SET SRC2=
SET SRC3=
GOTO END

:PROCESS
echo RMDIR /S /Q %1\%SRC1%
echo RMDIR /S /Q %1\%SRC2%
echo RMDIR /S /Q %1\%SRC3%
echo DEL /F /S /Q %1\%SRC2%
echo DEL /F /S /Q %1\%SRC4%

:END
0
 
LVL 17

Expert Comment

by:RDAdams
ID: 10950265
Restore it to my original form and save as a batch file which it is intended to run as.  
0
 
LVL 17

Expert Comment

by:RDAdams
ID: 10950278
Us the changes from the other programmer to add the cookies removal.
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

707 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

12 Experts available now in Live!

Get 1:1 Help Now