'Written by ejvindh
'Use at own risk
' Systemvariablen 'SpecialFolders("Desktop")' får sin værdi herfra (og kun hvis mappen findes på HD (ellers bliver den tom)): ' HKEY_USERS\S-1-5-21-583907252-1957994488-1708537768-1003\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\\Desktop

Dim Wshshell
 Set WshShell = Wscript.CreateObject("Wscript.Shell") 

Dim strOSVer
 Err.Clear
 strOSVer = Wshshell.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\CurrentVersion")
  If strOSVer = "5.0" Then
   Runfix
  Elseif strOSVer = "5.1" Then
   Runfix
  Else
   MsgBox "The fix only applies to Windows 2000 and XP"
  End if

Public Function Runfix

Warn = MsgBox ("This script has been developed by " & chr(34) & "ejvindh" & chr(34) & " from www.spywarefri.dk. Use at your own risk", 49, "Warning")
 If Warn=2 Then
   Exit Function
 End if

On Error Resume Next
Dim fso
 Set fso = CreateObject("Scripting.FileSystemObject") 
Dim Win, USDSK, Syst 
 Win = fso.GetSpecialFolder(0) 
 USDSK = Wshshell.SpecialFolders("Desktop") 
 Syst = fso.GetSpecialFolder(1) 

DIM lengt, Backsl, Desk, Deskt, plac
 lengt = len(USDSK) + 1

DO
 lengt = lengt - 1
 Backsl = Mid(USDSK, lengt, 1)
Loop Until Backsl = "\"

plac = Len(USDSK) - lengt
Desk = Right(USDSK, plac)
'Deskt = InputBox ("Type the 'name' of the desktop-folder (only the folder itself; not the path -- e.g. in English versions: Desktop", "Check the name of the Desktop", Desk)
' If Deskt="" Then
'   Msgbox "The script will not be run until a name for the Desktop has been entered"
'   Exit Function
' End if
Deskt = Desk

Dim LocalAppData
 LocalAppData = Wshshell.RegRead("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\\Local AppData")

wshshell.run ("taskkill /im explorer.exe /f")

'Delete entries: 
Dim d
 Set d = fso.OpenTextFile("delreg.reg", 2, True)
  d.WriteLine "REGEDIT4" 
  d.WriteLine
  d.WriteLine "[-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Desktop]"
  d.WriteLine "[-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\ActiveDesktop]"
  d.WriteLine "[-HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\Explorer]"
  d.WriteLine "[HKEY_CURRENT_USER\Control Panel\desktop]"
  d.WriteLine """ConvertedWallpaper""=-"
  d.WriteLine """ConvertedWallpaper Last WriteTime""=-"
  d.WriteLine """OriginalWallpaper""=-"
  d.WriteLine """Wallpaper""=-"
  d.WriteLine 
  d.WriteLine "[-HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Desktop\Components\1]"
  d.WriteLine "[-HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Desktop\Components\2]"
  d.WriteLine "[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders]"
  d.WriteLine  """Custom Desktop""=-"
  d.WriteLine "[-HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\ActiveDesktop]"
  d.WriteLine "[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer]"
  d.WriteLine """ClassicShell""=-"
  d.WriteLine """ForceActiveDesktopOn""=-"
  d.WriteLine """NoActiveDesktop""=-"
  d.WriteLine """NoActiveDesktopChanges""=-"
  d.WriteLine """NoAddingComponents""=-"
  d.WriteLine """NoChangingWallPaper""=-"
  d.WriteLine """NoCloseDragDropBands""=-"
  d.WriteLine """NoComponents""=-"
  d.WriteLine """NoDeletingComponents""=-"
  d.WriteLine """NoEditingComponents""=-"
  d.WriteLine """NoHTMLWallPaper""=-"
  d.WriteLine """NoMovingBands""=-"
  d.WriteLine """NoSaveSettings""=-"
  d.WriteLine """NoThemesTab""=-"
  d.WriteLine """NoViewContextMenu""=-"
  d.WriteLine "[-HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System]"
  d.Close
 Return = WshShell.Run(win & "\Regedit.exe /s delreg.reg", 1, true)
 fso.DeleteFile("delreg.reg")


'Write new entries: 
Dim w
 Set w = fso.OpenTextFile("writereg.reg", 2, True)
  w.WriteLine "REGEDIT4"
  w.WriteLine
  w.WriteLine "[HKEY_CURRENT_USER\Control Panel\Colors]"
  w.WriteLine """Background""=""0 78 152"""
  w.WriteLine "[HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Desktop\General]"
  w.WriteLine """WallpaperFileTime""=hex:00,77,28,0a,07,2e,c5,01"
  w.WriteLine """WallpaperLocalFileTime""=hex:00,37,05,fc,c3,2d,c5,01"
  w.Close
 Return = WshShell.Run(win & "\Regedit.exe /s writereg.reg", 1, true)
 fso.DeleteFile("writereg.reg")

  Wshshell.RegWrite "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\Common Desktop","%ALLUSERSPROFILE%\" & Deskt, "REG_EXPAND_SZ"
  Wshshell.RegWrite "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\Common Desktop" ,"%ALLUSERSPROFILE%\" & Deskt, "REG_EXPAND_SZ"   
  Wshshell.RegWrite "HKEY_USERS\S-1-5-18\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\Desktop", Syst & "\config\systemprofile\" & Deskt
  Wshshell.RegWrite "HKEY_USERS\S-1-5-18\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\Desktop" ,"%USERPROFILE%\" & Deskt, "REG_EXPAND_SZ"
  Wshshell.RegWrite "HKEY_USERS\.DEFAULT\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\Desktop", Syst & "\config\systemprofile\" & Deskt
  Wshshell.RegWrite "HKEY_USERS\.DEFAULT\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\Desktop" ,"%USERPROFILE%\" & Deskt, "REG_EXPAND_SZ"

  Wshshell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\International\CpMRU\Enable", 1, "REG_DWORD"
  Wshshell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\International\CpMRU\Size", 10, "REG_DWORD"
  Wshshell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\International\CpMRU\InitHits", 100, "REG_DWORD"
  Wshshell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\International\CpMRU\Factor", 20, "REG_DWORD"
  Wshshell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Desktop\General\BackupWallpaper",LocalAppData & "\Microsoft\Wallpaper1.bmp" , "REG_EXPAND_SZ" 
  Wshshell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Desktop\General\ComponentsPositioned", 1, "REG_DWORD"
  Wshshell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Desktop\General\TileWallpaper", "0"
  Wshshell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Desktop\General\Wallpaper",LocalAppData & "\Microsoft\Wallpaper1.bmp" , "REG_EXPAND_SZ"
  Wshshell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Desktop\Components\GeneralFlags", 5, "REG_DWORD"
  Wshshell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Desktop\Components\0\CurrentState", &h40000004, "REG_BINARY"
  Wshshell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Desktop\Components\0\FriendlyName", "My current startpage"
  Wshshell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Desktop\Components\0\Flags", 2, "REG_DWORD"
  Wshshell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Desktop\Components\0\Source", "About:Home"
  Wshshell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Desktop\Components\0\SubscribedURL", "About:Home"
  Wshshell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Desktop\General\WallpaperStyle", "2"
  Wshshell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Desktop\SafeMode\General\Wallpaper", "%SystemRoot%\Web\SafeMode.htt", "REG_EXPAND_SZ"
  Wshshell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Desktop\SafeMode\General\VisitGallery", 0, "REG_DWORD"
  Wshshell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\Desktop", USDSK
  Wshshell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\Desktop", "%USERPROFILE%\" & Deskt,"REG_EXPAND_SZ"
  Wshshell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\ThemeManager\ThemeActive", "0"

MsgBox "The registry has now been changed!"

Wshshell.Run Win & "\Explorer.exe",true

End Function
