Sign in to follow this  
Followers 0
StevenTech

Reg key delete

6 posts in this topic

Need to delete a couple keys and all subkeys to fix an issue on Windows 7 with IE 9 after removing the IE 10 update they temporary internet files is set to 0.  If you try to change it you get "Please select a value between 8 and 8 for how much disk space Temporary Internet Files may use."

Should be simple?
Tried using RegDelete and always returns 0 - Key not found.

$IE_Cache = RegDelete("HKCU\Software\Microsoft\Windows\CurrentVersion\InternetSettings\5.0\Cache")
; $IE_Cache = RegDelete("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\InternetSettings\5.0\Cache")
$IE_LCache = RegDelete("HKCU\Software\Microsoft\Windows\CurrentVersion\InternetSettings\5.0\LowCache")
; $IE_LCache = RegDelete("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\InternetSettings\5.0\LowCache")

Can browse to the key in RegEdit so tried a batch file which also returns key not found:

@ECHO off

REM Cache:
REG QUERY "HKEY_CURRENT_USERSoftwareMicrosoftWindowsCurrentVersionInternetSettings5.0Cache" /k

Do I have something wrong in the commands?  Any suggestions on how to get these keys deleted?  Can delete by hand but have 50+ machines that need this done.

Share this post


Link to post
Share on other sites



Did you try #RequireAdmin at the top of the script ?

Share this post


Link to post
Share on other sites

Tried #RequireAdmin results still say key not found.  Are there any other includes I need for working on the registry?  Full script below

#RequireAdmin 

$CDel = RegDelete("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\InternetSettings\5.0\Cache")
$LCDel = RegDelete("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\InternetSettings\5.0\LowCache")

If $CDel = 1 Then
   $IE_Cache = "Successfuly deleted Cache."
ElseIf $CDel = 0 Then
   $IE_Cache = "Key HKCU\Software\Microsoft\Windows\CurrentVersion\InternetSettings\5.0\Cache does not exist."
ElseIf $CDel = 2 Then
   $IE_Cache = "Error deleting HKCU\Software\Microsoft\Windows\CurrentVersion\InternetSettings\5.0\Cache."
EndIf

If $LCDel = 1 Then
   $IE_LCache = "Successfuly deleted LowCache."
ElseIf $LCDel = 0 Then
   $IE_LCache = "Key HKCU\Software\Microsoft\Windows\CurrentVersion\InternetSettings\5.0\LowCache does not exist."
ElseIf $LCDel = 2 Then
   $IE_LCache = "Error deleting HKCU\Software\Microsoft\Windows\CurrentVersion\InternetSettings\5.0\LowCache."
EndIf

MsgBox(0,"IE Cache Delete", $IE_Cache & @CRLF & $IE_LCache)

Share this post


Link to post
Share on other sites

Are you running the script on a 64-bit version of Windows 7 ? If so, Windows is automatically redirecting to HKCUSoftwareWow6432NodeMicrosoft... rather than HKCUSoftwareMicrosoft.... Assuming you've compiled the script to an executable, you'll need to compile using 64-bit compilation (using the Compile X64 version. option setting).

Share this post


Link to post
Share on other sites

See any difference?

$IE_Cache = RegDelete("HKCU\Software\Microsoft\Windows\CurrentVersion\InternetSettings\5.0\Cache")
$IE_Cache = RegDelete("HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\5.0\Cache")

I don't know if I would delete the key, though. That's probably not wise.

Why not just change the value instead?

Here is an example of setting the Content CacheLimit for 4 megabytes:

$IE_Cache = RegWrite('HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\5.0\Cache\Content', 'CacheLimit', 'REG_DWORD', '4096')

Make yourself sheep and the wolves will eat you - Benjamin Franklin

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0