From: Ahmed on
Thanx again for the script. i just made a small change in it just make it
easier for me i change the line
if len(sPath) ^> %Len% then WScript.Echo sPath
into
if len(sPath) ^> %Len% then oFile.delete
hope you dont mind and i ran it as vbscript att log off. i will put it in
one of my labs 2moro to see if it works coz it worked for me today in my test
workstation.
some of the website that made the problem are the BBC , the university home
page and youtube and others.

"Pegasus [MVP]" wrote:

> While I accept that there may be more than one web site that generates
> exessively long file names, I do not think that there are many of them. They
> tend to be malicious sites that want to prevent visitors from deleting the
> files they generate. I suspect that some of your users visit sites that they
> should not visit.
>
> One way to deal with the issue is to run a script at logon time to identify
> all temporary internet files with excessively long names. When you have the
> list then you can examine it and discuss the issue with the users. The
> script below will create such a list. Depending on the number of temporary
> internet files, it might take half a minute or more to execute. Do not
> retype the script - use copy and paste instead. The result will be visible
> in c:\LongNames.txt
>
> @echo off
> set Len=240
> if exist c:\LongNames.txt goto :eof
> echo %date% %time:~0,5% %UserName% %ComputerName% > c:\LongNames.txt
> set Scr=c:\TempVBS.vbs
> set VB=echo^>^>%Scr%
> cd 1>nul 2>%Scr%
> %VB% Set oFSO = CreateObject("Scripting.FileSystemObject")
> %VB% Set oWshShell = CreateObject("WScript.Shell")
> %VB% sFolder = oWshShell.ExpandEnvironmentStrings( _
> %VB% "%UserProfile%\Local Settings\" _
> %VB% ^& "Temporary Internet Files\Content.ie5")
> %VB% Set oFolder = oFSO.GetFolder(sFolder)
> %VB% For Each oSubFolder In oFolder.SubFolders
> %VB% For Each oFile In oSubFolder.Files
> %VB% sPath = oFile.path
> %VB% if len(sPath) ^> %Len% then WScript.Echo sPath
> %VB% Next
> %VB% Next
> cscript //nologo %Scr% >> c:\LongNames.txt
> del %Scr%
>
>
> "Ahmed" <Ahmed(a)discussions.microsoft.com> wrote in message
> news:362019CD-44F9-4603-B794-7638D190168B(a)microsoft.com...
> > helloo again
> > first of all i would like to thank you for the effort in trying to help
> > me.
> > second i solved in anther way.
> > i put the delete script in the startup script instead of the log off
> > script
> > and i removed the log off from shutdown menu so the user will choose to
> > restart always and i will be sure that the profile is deleted at start up
> > and
> > it works.
> >
> > the problem is that it is not only one file that cause the problem so i
> > cannot use
> >
> > if exist "%UserProfile%\...\Long File Name.url" del
> >
> > there are many website that cause the problem with files with different
> > extensions like url or jpg .... etc
> >
> > best regards
> >
> > "Pegasus [MVP]" wrote:
> >
> >> *** See below.
> >>
> >> "Ahmed" <Ahmed(a)discussions.microsoft.com> wrote in message
> >> news:41EE6C94-F36D-4DF2-B51B-E14FB284721A(a)microsoft.com...
> >> > 1-a delete instruction cannot be executed in logon script coz
> >> > (=because) the user does not have previlidges and you cannot
> >> > delete the user profile while he is logged in. you may say log off
> >> > script and for the same reason the user does not have enough
> >> > previliges to delete the profile "you can try it" coz (=because)
> >> > i already tried it. it works if an admin logs in and logs out.
> >> *** This is getting a little puzzling. If the user does not have
> >> *** sufficient privileges to delete a file that resides in his own
> >> *** profile folder, how did he create it in the first place? Is
> >> *** it perhaps that the file has the read-only attribute set, which
> >> *** needs to be removed before he can delete the file?
> >>
> >> > 2- regarding the second part "batch file"
> >> > the computers are distributed on 2 buildings in different labs and the
> >> > problem happens when the users visit some website so i dont know when
> >> > the
> >> > problem happens and in which computer and i cant run the batch file
> >> > everytime
> >> > a user logs off.
> >> *** You can insert an instruction like this one into the logon script:
> >> *** if exist "%UserProfile%\...\Long File Name.url" del
> >> ""%UserProfile%\...\Long File Name.url"
> >> *** This does not work because the file name is too long then subst.exe
> >> *** can be used to shorten the path.
> >>
> >> > i already have all those solutions that you talked about but they are
> >> > not
> >> > effecient acctually. i have a dosen of scripts now but all needs admin
> >> > rights
> >> > to run att log off.
> >> *** I would not worry about the solutions being efficient or not, as
> >> *** long as they are effective (=as long as they work).
> >>
> >> > "Pegasus [MVP]" wrote:
> >> >
> >> >> No, you don't "go around to 300 PCs" but if you are responsible for
> >> >> 300
> >> >> of
> >> >> them then it is imperative that you acquire skills in scripting and
> >> >> managing
> >> >> them remotely. Administrators without such skills are ineffective.
> >> >> Here
> >> >> are
> >> >> a couple of methods to resolve the current issue:
> >> >> - Include a suitable "delete" instruction in your logon script.
> >> >> - Execute a batch file from your console that gets the 300 machine
> >> >> names
> >> >> from a text file, then deletes the offending file remotely.
> >> >>
> >> >>
> >> >> "Ahmed" <Ahmed(a)discussions.microsoft.com> wrote in message
> >> >> news:8B31DAFE-9C41-4331-9298-7C0D7BDE7CD7(a)microsoft.com...
> >> >> > hello pegasus
> >> >> > are u serious. u want me to go around 300 computers and delete the
> >> >> > profile
> >> >> > or rename the filename. this is far from being a solution. and why
> >> >> > it
> >> >> > happens
> >> >> > at all the mandatory profile should be deleted on log off.
> >> >> >
> >> >>
> >> >>
> >> >> .
> >> >>
> >>
> >>
> >> .
> >>
>
>
> .
>
From: Pegasus [MVP] on

"Ahmed" <Ahmed(a)discussions.microsoft.com> wrote in message
news:D8B8F6FC-C211-4AEE-B66A-22ACEF76387D(a)microsoft.com...
> Thanx again for the script. i just made a small change in it just make it
> easier for me i change the line
> if len(sPath) ^> %Len% then WScript.Echo sPath
> into
> if len(sPath) ^> %Len% then oFile.delete
> hope you dont mind and i ran it as vbscript att log off. i will put it in
> one of my labs 2moro to see if it works coz it worked for me today in my
> test
> workstation.
> some of the website that made the problem are the BBC , the university
> home
> page and youtube and others.

No, I don't mind at all you changing my script - in fact I'm glad you seized
the initiative. On the other hand you need to be aware that deleting files
without user confirmation can cause problems. During the testing phase I
would probably maintain a log like so:

iLen=240
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oWshShell = CreateObject("WScript.Shell")
sFolder = oWshShell.ExpandEnvironmentStrings( _
"%UserProfile%\Local Settings\" _
& "Temporary Internet Files\Content.ie5")
Set oFolder = oFSO.GetFolder(sFolder)
For Each oSubFolder In oFolder.SubFolders
For Each oFile In oSubFolder.Files
sPath = oFile.path
if len(sPath) > iLen then
WScript.Echo sPath
oFile.Delete sPath
end if
Next
Next

Remember to invoke the script like so:
cscript //nologo c:\LongNames.vbs >> "%UserProfile%\My
Documents\LongNames.txt"