Delete Temporary Internet Files Remote Computer

Delete Temporary Internet Files Remote Computer

As stated, this is to delete IE 'Temporary internet files', 'Browser Cache' and 'Cookies' on a remote pc on the fly. The problem we had was to clear all of the above on t.

Hey, Scripting Guy! Is there a way to delete all the files in the Temporary Internet Files folder using a script? -- KR Hey, AK.

Delete Temporary Internet Files Remote Computer

Good afternoon, I need to review the contents of the Temporary Internet Files folder on another user's Windows XP SP2 with IE 7 comput. Whenever I try to browse to a remote computer to delete their Temporary Internet Files to either remove an adware component or just to clear up space.

You know, prompted by your question one of the Scripting Guys (who shall remain nameless) thought to himself, “Hmmm, I wonder what’s in my Temporary Internet Files folder? Download Curse Of Monkey Island 3 Patch. ” Upon checking, he discovered the folder contained 239 megabytes worth of junk; as near as he could tell, the entire Internet was being stored on his hard disk. In other words, having a script that deletes all the files in the Temporary Internet Files folder sounded like a script worth having. The only complicating factor is trying to determine where a user has his or her Temporary Internet Files folder. Typically, you’ll find this in the user’s local user profile, which will usually be something like C: Documents and Settings kenmyer Local Settings Temporary Internet Files. However, the folder doesn’t have to be there; after all, Windows might not even be installed on drive C. That means that the key to writing this script lies in locating the Temporary Internet Files folder; after you’ve found it, deleting all the files is a snap.

So how do you locate this folder? Well, as it turns out, the Temporary Internet Files folder is a “special” folder, a folder which is found, by default, on all installations of Windows, and a folder that the operating system keeps an eye on; no matter what you do to this folder, Windows will still know its whereabouts. Because of that, you can use the Shell object - which has the ability to locate special folders, regardless of their physical location - to determine the path to Temporary Internet Files, and then use that path to bind to the folder and delete all the files found there.

One caveat: the Shell object can’t be created remotely. That means you either need to run this script as a logon or logoff script, or copy it to the remote computer and use the WMI Win32_Process class to kick it off on that remote machine. For more information, you might want to see this column, which used Win32_Process to run the md command on a remote computer. Let’s take a look at the script: Const TEMPORARY_INTERNET_FILES = &H20& Set objShell = CreateObject('Shell.Application') Set objFolder = objShell.Namespace(TEMPORARY_INTERNET_FILES) Set objFolderItem = objFolder.Self strPath = objFolderItem.Path & ' *.*' Set objFSO = CreateObject('Scripting.FileSystemObject') objFSO.DeleteFile(strPath) Yes, we know: after that big buildup, you thought this would be a lot more complicated, didn’t you? We start off by setting the constant TEMPORARY_INTERNET_FILES to &H20&, the value required to connect to the Temporary Internet Files folder (more on that in a minute). We then create the Shell object, and use the Namespace method to locate the folder. Due to the somewhat quirky nature of the Shell object, we then call the Self method to actually connect to the folder; that’s what this line of code does: Set objFolderItem = objFolder.Self At this point, we can now determine the actual path (e.g., C: Documents and Settings kenmyer Local Settings Temporary Internet Files) to the folder in question.

Comments are closed.