Solved

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

Posted on 2004-03-26
10
313 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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.
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
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…

919 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

13 Experts available now in Live!

Get 1:1 Help Now