Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

VBscript change IE Cache Size

Posted on 2005-04-07
9
Medium Priority
?
798 Views
Last Modified: 2012-05-05
I am trying to change the Temporary Internet Files with VBscript I want to put it in a login script to change it on my computers.

I am only testing at present but have a few problems.

The code runs and does change the registry key but when you open IE it displays the old values. It is like I need to apply the like IE’s GUI does or something.


'Change Cache Size
Option Explicit
Dim WSHShell
Set WSHShell = CreateObject("WScript.Shell")

'51200 bytes = 50 MB cache limit
WSHShell.RegWrite  "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Cache\Content\CacheLimit",51200,"REG_DWORD"  
Set WSHShell = Nothing

Wscript.quit
0
Comment
Question by:bwilks99
  • 3
  • 3
7 Comments
 
LVL 4

Author Comment

by:bwilks99
ID: 13743711
I have found a solution there was another key (added the second key \5.0\ )

I am not sure what the \5.0\ does do you know?

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Option Explicit
Dim WSHShell
Set WSHShell = CreateObject("WScript.Shell")

'51200 bytes = 50 MB cache limit
WSHShell.RegWrite  "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Cache\Content\CacheLimit",51200,"REG_DWORD"  
WSHShell.RegWrite  "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\5.0\Cache\Content\CacheLimit",51200,"REG_DWORD"
Set WSHShell = Nothing

Wscript.quit
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
0
 
LVL 19

Expert Comment

by:Rimvis
ID: 13750859
> I am not sure what the \5.0\ does do you know?
Maybe special handling for IE version 5.0?
0
 
LVL 4

Author Comment

by:bwilks99
ID: 13780377
? I am using version 6 with all updates.
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 23

Expert Comment

by:gecko_au2003
ID: 13797070
you would need to alter it from 5.0 to prolly 6.0 or w.e the version is, couldnt you get the script to detect what version they are using and just insert that versions string inside of there ie :

Dim strVersion As String

strVersion = 'code to detect version
Option Explicit
Dim WSHShell
Set WSHShell = CreateObject("WScript.Shell")

'51200 bytes = 50 MB cache limit
WSHShell.RegWrite  "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Cache\Content\CacheLimit",51200,"REG_DWORD"  
WSHShell.RegWrite  "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\" & strVersion & "\Cache\Content\CacheLimit",51200,"REG_DWORD"
Set WSHShell = Nothing

Wscript.quit

'=======

Something along those lines, I will look now into how to get the version so that it works correctly :)

That should give you an idea of what I mean

0
 
LVL 4

Author Comment

by:bwilks99
ID: 13797088
It is working fine with the extra line of code with \5.0;

WSHShell.RegWrite  "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\5.0\Cache\Content\CacheLimit",51200,"REG_DWORD"
Set WSHShell = Nothing

I was wondering what the \5.0 was; was it going to change with updates ect.

If I run this it works fine;

Option Explicit
Dim WSHShell
Set WSHShell = CreateObject("WScript.Shell")

'51200 bytes = 50 MB cache limit
WSHShell.RegWrite  "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Cache\Content\CacheLimit",51200,"REG_DWORD"  
WSHShell.RegWrite  "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\5.0\Cache\Content\CacheLimit",51200,"REG_DWORD"
Set WSHShell = Nothing

Wscript.quit




0
 
LVL 23

Accepted Solution

by:
gecko_au2003 earned 1000 total points
ID: 13797153
ok here is a script that detects version :

sRegPath = "HKLM\SOFTWARE\Microsoft\Internet Explorer\Version"
Set oShell = CreateObject("wscript.shell")
On Error Resume Next
sIEVer = oShell.RegRead(sRegPath)
If Err <> 0 Then
sIEVer = "0.0.0.0"
End If
On Error Goto 0
aIEVer = Split(sIEVer, ".")
iMajorVersion = Cint(aIEVer(0))
iMinorVersion = Cint(aIEVer(1))
iBuildVersion = Cint(aIEVer(2))
iSubBuildVersion = Cint(aIEVer(3))
WScript.Echo "IE full version is : " & sIEVer
WScript.Echo "IE version is : " & iMajorVersion & "." & iMinorVersion

Just alter your script to be :

Option Explicit
Dim WSHShell
sRegPath = "HKLM\SOFTWARE\Microsoft\Internet Explorer\Version"
Set WSHShell = CreateObject("WScript.Shell")

On Error Resume Next
sIEVer = oShell.RegRead(sRegPath)
If Err <> 0 Then
sIEVer = "0.0.0.0"
End If
On Error Goto 0
aIEVer = Split(sIEVer, ".")
iMajorVersion = Cint(aIEVer(0))
iMinorVersion = Cint(aIEVer(1))
iBuildVersion = Cint(aIEVer(2))
iSubBuildVersion = Cint(aIEVer(3))

'51200 bytes = 50 MB cache limit
WSHShell.RegWrite  "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Cache\Content\CacheLimit",51200,"REG_DWORD"  
WSHShell.RegWrite  "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\" &  iMajorVersion & "." & iMinorVersion & "\Cache\Content\CacheLimit",51200,"REG_DWORD"
Set WSHShell = Nothing

Wscript.quit

0
 
LVL 23

Expert Comment

by:gecko_au2003
ID: 13797155
The 5.0 looks like it is just the version of internet explorer that you or who ever is using :) That is just my guess, does the last script I posted work ?
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The purpose of this article is to demonstrate how we can use conditional statements using Python.
The viewer will learn how to implement Singleton Design Pattern in Java.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Suggested Courses
Course of the Month20 days, 15 hours left to enroll

810 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