I am trying to delete all user's temp internet files via custom action. I used vbscript to do so. But as we know, it requires logoff and login for system context installation. 

Is there any other way to delete the user's temp internet files without logoff? And silently during system context installation?

Answer Summary:
Finally i used the below script in cmd file. @echo off IF NOT EXIST "%SystemDrive%\Users\" ( for /D %%x in ("%SystemDrive%\Documents and Settings\*") do ( rmdir /s /q "%%x\Local Settings\Temporary Internet Files" ) ) IF EXIST "%SystemDrive%\Users\" ( for /D %%x in ("%SystemDrive%\Users\*") do ( rmdir /s /q "%%x\AppData\Local\Microsoft\Windows\Temporary Internet Files" ) ) To call the cmd file silently in vbscript custom action, i used the below script On error resume next Set WshShell = CreateObject( "WScript.Shell" ) Set objFSO = CreateObject("Scripting.FileSystemObject") strPrgf=WshShell.ExpandEnvironmentStrings("%PROGRAMFILES%") strPrgfx86=WshShell.ExpandEnvironmentStrings("%PROGRAMFILES(X86)%") dest=strPrgf & "\cleanup.cmd" dest2=strPrgfx86 & "\cleanup.cmd" if objFSO.FolderExists(strPrgfx86) then Set WshShell = CreateObject("WScript.Shell" ) WshShell.Run chr(34) & dest2 & Chr(34), 0 Set WshShell = Nothing Else Set WshShell = CreateObject("WScript.Shell" ) WshShell.Run chr(34) & dest & Chr(34), 0 Set WshShell = Nothing End if
Cancel
0 Comments   [ + ] Show Comments

Comments

Please log in to comment

Community Chosen Answer

1

You can write a VBScript which will read the userprofile's folder names under C:\Users except Default and Public folder and delete the Temp files under each users profile's folder

Answered 02/28/2013 by: jagadeish
Red Belt

  • Again vbscript won delete the user files in system context installation. It requires Logoff for active setup to run.
  • No.. You dont need to have Active Setup
Please log in to comment

Answers

0

Finally i used the below script in cmd file.

@echo off

IF NOT EXIST "%SystemDrive%\Users\" (
    for /D %%x in ("%SystemDrive%\Documents and Settings\*") do (
        rmdir /s /q "%%x\Local Settings\Temporary Internet Files"
    )
)

IF EXIST "%SystemDrive%\Users\" (
    for /D %%x in ("%SystemDrive%\Users\*") do (
        rmdir /s /q "%%x\AppData\Local\Microsoft\Windows\Temporary Internet Files"
    )
)

To call the cmd file silently in vbscript custom action, i used the below script

 

On error resume next

Set WshShell = CreateObject( "WScript.Shell" )
Set objFSO = CreateObject("Scripting.FileSystemObject")

strPrgf=WshShell.ExpandEnvironmentStrings("%PROGRAMFILES%")
strPrgfx86=WshShell.ExpandEnvironmentStrings("%PROGRAMFILES(X86)%")
dest=strPrgf & "\cleanup.cmd"
dest2=strPrgfx86 & "\cleanup.cmd"

if objFSO.FolderExists(strPrgfx86) then

Set WshShell = CreateObject("WScript.Shell" )
WshShell.Run chr(34) & dest2 & Chr(34), 0
Set WshShell = Nothing

Else

Set WshShell = CreateObject("WScript.Shell" )
WshShell.Run chr(34) & dest & Chr(34), 0
Set WshShell = Nothing

End if

 

Answered 03/01/2013 by: blask28
Senior Yellow Belt

Please log in to comment
0

If you are talking IE this will do it for current user

RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 255

Answered 02/27/2013 by: SMal.tmcc
Red Belt

  • for others this may help
    http://www.catonmat.net/blog/clear-privacy-ie-firefox-opera-chrome-safari/

    http://ie-support.blogspot.com/2011/02/use-command-line-to-delete-ie-browsing.html
  • Thanks Steve. Can this be done silently?
    • not that I am aware of, look at this link and one response (30Aug2012 11:41) explains why and later someone mentions some other software.
      http://www.autoitscript.com/forum/topic/143786-clearing-internet-explorer-history/
Please log in to comment
This content is currently hidden from public view.
Reason: Removed by member request
For more information, visit our FAQ's.

Answer this question or Comment on this question for clarity