This script does not work properly on Windows XP. Here is alternative:
dim strJavaPath
set wshShell = CreateObject("WScript.shell")
set scrFilesystem = CreateObject("Scripting.FileSystemObject")
strJavaPath = wshShell.RegRead("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\Common Programs") & "\Java"
if scrFileSystem.FolderExists(strJavaPath) then
scrFileSystem.DeleteFolder(strJavaPath)
end if
This script works both on Windows XP and Windows 7 (maybe other versions too).