Advertisement
shornby

VDIOptimizer - MS Premier Field Eng (PFE).vbs

Aug 23rd, 2014
345
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ' // ========================================================================
  2. ' // Original generated with VDIOptimizer -
  3. ' // ***  https://www.autoitscript.com/site/autoit-tools/vdi-optimizer/   ***
  4. ' // (c)2010 Jonathan Bennett
  5. ' //
  6. ' // Obtained here:
  7. ' // http://blogs.technet.com/b/jeff_stokes/archive/2012/10/15/the-microsoft-premier-field-engineer-pfe-view-on-virtual-desktop-vdi-density.aspx
  8. ' //
  9. ' // Current version updated by Jeff Stokes (MSFT)
  10. ' // Last Modified: 10/18/2012
  11. ' // ========================================================================
  12.  
  13.  
  14. ' // ==============
  15. ' // General Advice
  16. ' // ==============
  17. '
  18. ' Before finalizing the image perform the following tasks:
  19. ' - Ensure no unwanted startup files by using autoruns.exe from SysInternals
  20. ' - Run the Disk Cleanup tool as administrator and delete all temporary files and system restore points (can be automated with this script)
  21. ' - Run disk defrag and consolidate free space: defrag c: /v /x
  22. ' - Reboot the machine 6 times and wait 120 seconds after logging on before performing the next reboot (boot prefetch training)
  23. ' - Run disk defrag and optimize boot files (Windows 7 only): defrag c: /v /b
  24. ' - If using a dynamic virtual disk, use the vendor's utilities to perform a "shrink" operation
  25.  
  26.  
  27. ' // *************
  28. ' // *  CAUTION  *
  29. ' // *************
  30. '
  31. ' THIS SCRIPT MAKES CONSIDERABLE CHANGES TO THE DEFAULT CONFIGURATION OF WINDOWS 7.
  32. '
  33. ' Please review this script THOROUGHLY before applying to your virtual machine, and disable changes below as necessary to suit your current
  34. ' environment.
  35. '
  36. ' This script is provided AS-IS - usage of this source assumes that you are at the very least familiar with the vbscript language being used and the
  37. ' tools used to create and debug this file.
  38. '
  39. ' In other words, if you break it, you get to keep the pieces.
  40.  
  41.  
  42. ' Constants
  43. Const ForReading = 1
  44. Const Disable_Aero = False
  45. Const Disable_BranchCache = False
  46. Const Disable_EFS = False
  47. Const Disable_iSCSI = False
  48. Const Disable_MachPass = False
  49. Const Disable_Search = False
  50.  
  51. ' Common objects
  52. Set oShell = WScript.CreateObject ("WScript.Shell")
  53. Set oFSO = CreateObject("Scripting.FileSystemObject")
  54. Set oEnv = oShell.Environment("User")
  55.  
  56. ' Command Line Arguments for Some Settings
  57. Set colNamedArguments = WScript.Arguments.Named
  58.  
  59. If colNamedArguments.Exists("Aero") Then
  60.      strAero = colNamedArguments.Item("Aero")
  61. Else
  62.      strAero = Disable_Aero
  63. End If
  64.  
  65. If colNamedArguments.Exists("BranchCache") Then
  66.      strBranchCache = colNamedArguments.Item("BranchCache")
  67. Else
  68.      strBranchCache = Disable_BranchCache
  69. End If
  70.  
  71. If colNamedArguments.Exists("EFS") Then
  72.      strEFS = colNamedArguments.Item("EFS")
  73. Else
  74.      strEFS = Disable_EFS
  75. End If
  76.  
  77. If colNamedArguments.Exists("iSCSI") Then
  78.      striSCSI = colNamedArguments.Item("iSCSI")
  79. Else
  80.      striSCSI = Disable_iSCSI
  81. End If
  82.  
  83. If colNamedArguments.Exists("MachPass") Then
  84.      strMachPass = colNamedArguments.Item("MachPass")
  85. Else
  86.      strMachPass = Disable_MachPass
  87. End If
  88.  
  89. If colNamedArguments.Exists("Search") Then
  90.     strSearch = colNamedArguments.Item("Search")
  91. Else
  92.     strSearch = Disable_Search
  93. End If
  94.  
  95. ' First things first - enable RDP Connections!!!
  96. RunWait "WMIC rdtoggle where AllowTSConnections=0 call SetAllowTSConnections 1,1"
  97. RunWait "netsh advfirewall firewall set rule group=" & Chr(34) & "remote desktop" & Chr(34) & " new enable=Yes"
  98.  
  99.  
  100. ' // ==================
  101. ' // Configure Services
  102. ' // ==================
  103.  
  104. ' Disable Adaptive Brightness Service
  105. RunWait "sc config SensrSvc start= disabled"
  106.  
  107. ' Disable Application Layer Gateway Service
  108. RunWait "sc config ALG start= disabled"
  109.  
  110. ' Disable Background Intelligent Transfer Service
  111. RunWait "sc config BITS start= disabled"
  112.  
  113. ' Disable Background Layout Service
  114. oShell.RegWrite "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\OptimalLayout\EnableLayout", 0, "REG_DWORD"
  115.  
  116. ' Disable Bitlocker Drive Encryption Service
  117. RunWait "sc config BDESVC start= disabled"
  118.  
  119. ' Disable Block Level Backup Engine Service
  120. RunWait "sc config wbengine start= disabled"
  121.  
  122. ' Disable Bluetooth Support Service
  123. RunWait "sc config bthserv start= disabled"
  124.  
  125. If strBranchCache = True Then
  126. ' Disable BranchCache Service
  127. RunWait "sc config PeerDistSvc start= disabled"
  128. End If
  129.  
  130. ' Disable Computer Browser Service
  131. RunWait "sc config Browser start= disabled"
  132.  
  133. ' Disable Diagnostic Policy Service
  134. RunWait "sc config DPS start= disabled"
  135.  
  136. ' Disable Disk Defragmenter Service
  137. RunWait "schtasks /change /tn ""microsoft\windows\defrag\ScheduledDefrag"" /disable"
  138. oShell.RegWrite "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Dfrg\BootOptimizeFunction\Enable", "N", "REG_SZ"
  139. RunWait "sc config defragsvc start= disabled"
  140.  
  141. ' Disable Distributed Link Tracking Service
  142. RunWait "sc stop TrkWks"
  143. RunWait "sc config TrkWks start= disabled"
  144.  
  145. If strEFS = True Then
  146. ' Disable Encrypting File System Service
  147. RunWait "sc config EFS start= disabled"
  148. End If
  149.  
  150. ' Disable Function Discovery Resource Publication Service
  151. RunWait "sc config fdPHost start= disabled"
  152.  
  153. ' Disable HomeGroup Listener Service
  154. RunWait "sc config HomeGroupListener start= disabled"
  155.  
  156. ' Disable HomeGroup Provider Service
  157. RunWait "sc config HomeGroupProvider start= disabled"
  158.  
  159. If striSCSI = True Then
  160. ' Disable Microsoft iSCSI Provider Service
  161. RunWait "sc config msiscsi start= disabled"
  162. End If
  163.  
  164. ' Disable Microsoft Software Shadow Copy Provider Service
  165. RunWait "sc config swprv start= disabled"
  166.  
  167. ' Disable Parental Controls Service
  168. RunWait "sc config WPCSvc start= disabled"
  169.  
  170. ' Disable Secure Socket Tunneling Protocol Service
  171. RunWait "sc config SstpSvc start= disabled"
  172.  
  173. ' Disable Shell Hardware Detection Service
  174. RunWait "sc config ShellHWDetection start= disabled"
  175.  
  176. ' Disable SNMP Trap Service
  177. RunWait "sc config SNMPTRAP start= disabled"
  178.  
  179. ' Disable Superfetch Service
  180. oShell.RegWrite "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management\PrefetchParameters\EnablePrefetcher", &H00000000, "REG_DWORD"
  181. oShell.RegWrite "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management\PrefetchParameters\EnableSuperfetch", &H00000000, "REG_DWORD"
  182. RunWait "sc stop SysMain"
  183. RunWait "sc config SysMain start= disabled"
  184.  
  185. ' Disable SSDP Discovery Service
  186. RunWait "sc stop SSDPSRV"
  187. RunWait "sc config SSDPSRV start= disabled"
  188.  
  189. ' Disable Tablet PC Input Service
  190. RunWait "sc config TabletInputService start= disabled"
  191.  
  192. ' Disable Telephony Service
  193. RunWait "sc config TapiSrv start= disabled"
  194.  
  195. ' Disable TPM Base Services Service
  196. RunWait "sc config TBS start= disabled"
  197.  
  198. ' Disable UPnP Device Host Service
  199. RunWait "sc config upnphost start= disabled"
  200.  
  201. ' Disable Windows Backup Service
  202. RunWait "sc config SDRSVC start= disabled"
  203.  
  204. ' Disable Windows CardSpace Service
  205. RunWait "sc config idsvc start= disabled"
  206.  
  207. ' Disable Windows Color System Service
  208. RunWait "sc config WcsPlugInService start= disabled"
  209.  
  210. ' Disable Windows Connect Now - Config Registrar Service
  211. RunWait "sc config wcncsvc start= disabled"
  212.  
  213. ' Disable Windows Defender Service
  214. RunWait "schtasks /change /tn ""microsoft\windows Defender\MPIdleTask"" /disable"
  215. RunWait "schtasks /change /tn ""microsoft\windows Defender\MP Scheduled Scan"" /disable"
  216. RunWait "sc stop WinDefend"
  217. RunWait "sc config WinDefend start= disabled"
  218.  
  219. ' Disable Windows Error Reporting Service
  220. RunWait "sc config WerSvc start= disabled"
  221.  
  222. ' Disable Windows Media Center Receiver Service
  223. RunWait "sc config ehRecvr start= disabled"
  224.  
  225. ' Disable Windows Media Center Scheduler Service
  226. RunWait "sc config ehSched start= disabled"
  227.  
  228. ' Disable Windows Media Player Network Sharing Service
  229. RunWait "sc config WMPNetworkSvc start= disabled"
  230.  
  231. ' Break out Windows Management Instrumentation Service
  232. RunWait "winmgmt /standalonehost"
  233. RunWait "sc config winmgmt group= COM Infrastructure"
  234.  
  235. 'Disable Windows Search Service
  236. If strSearch = True Then
  237.     RunWait "sc stop WSearch"
  238.     RunWait "sc config WSearch start= disabled"
  239. End If
  240.  
  241. ' Disable Wireless Zero Configuration Service
  242. RunWait "sc config WZCSVC start= disabled"
  243.  
  244. ' Disable WLAN AutoConfig Service
  245. RunWait "sc config Wlansvc start= disabled"
  246.  
  247. ' Disable WWAN AutoConfig Service
  248. RunWait "sc config WwanSvc start= disabled"
  249.  
  250.  
  251. ' // ================
  252. ' // MACHINE SETTINGS
  253. ' // ================
  254.  
  255. ' Do you want users to have the ability to use Aero themes for their desktop when connecting?
  256. ' If so, leave these two services enabled.  Disabling these services will disable Aero and DWM, and
  257. ' thus disable the use of any Aero themes:
  258. If strAero = True Then
  259.     ' Disable Desktop Window Manager Session Manager Service
  260.    RunWait "sc config UxSms start= disabled"
  261.     ' Disable Themes Service
  262.    RunWait "sc config Themes start= disabled"
  263. End If
  264.  
  265.  
  266. ' Disable Hard disk timeouts
  267. RunWait "POWERCFG /SETACVALUEINDEX 381b4222-f694-41f0-9685-ff5bb260df2e 0012ee47-9041-4b5d-9b77-535fba8b1442 6738e2c4-e8a5-4a42-b16a-e040e769756e 0"
  268. RunWait "POWERCFG /SETDCVALUEINDEX 381b4222-f694-41f0-9685-ff5bb260df2e 0012ee47-9041-4b5d-9b77-535fba8b1442 6738e2c4-e8a5-4a42-b16a-e040e769756e 0"
  269.  
  270.  
  271. ' Disable TCP/IP / Large Send Offload
  272. oShell.RegWrite "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\DisableTaskOffload", &H00000001, "REG_DWORD"
  273. oShell.RegWrite "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\BNNS\Parameters\EnableOffload", &H00000000, "REG_DWORD"
  274.  
  275.  
  276. ' Disable hibernate
  277. RunWait "powercfg -h off"
  278.  
  279.  
  280. ' Disable System Restore
  281. Set objWMIService = GetObject("winmgmts:\\.\root\default")
  282. Set objItem = objWMIService.Get("SystemRestore")
  283. objItem.Disable("")
  284. RunWait "schtasks /change /tn ""microsoft\windows\SystemRestore\SR"" /disable"
  285. oShell.RegWrite "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\SystemRestore\DisableSR", &H00000001, "REG_DWORD"
  286.  
  287.  
  288. ' Disable NTFS Last Access Timestamps
  289. RunWait "FSUTIL behavior set disablelastaccess 1"
  290.  
  291.  
  292. If strMachPass = True Then
  293.     ' Disable Machine Account Password Changes
  294.    oShell.RegWrite "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Netlogon\Parameters\DisablePasswordChange", &H00000001, "REG_DWORD"
  295. End If
  296.  
  297.  
  298. ' Disable memory dumps
  299. oShell.RegWrite "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\CrashControl\CrashDumpEnabled", &H00000000, "REG_DWORD"
  300. oShell.RegWrite "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\CrashControl\LogEvent", &H00000000, "REG_DWORD"
  301. oShell.RegWrite "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\CrashControl\SendAlert", &H00000000, "REG_DWORD"
  302. oShell.RegWrite "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\CrashControl\AutoReboot", &H00000001, "REG_DWORD"
  303.  
  304.  
  305. ' Disable default system screensaver
  306. oShell.RegWrite "HKEY_USERS\.DEFAULT\Control Panel\Desktop\ScreenSaveActive", 0, "REG_DWORD"
  307.  
  308.  
  309. ' Increase service startup timeouts
  310. oShell.RegWrite "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ServicesPipeTimeout", &H0002bf20, "REG_DWORD"
  311.  
  312.  
  313. ' Increase Disk I/O Timeout to 200 seconds.
  314. oShell.RegWrite "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Disk\TimeOutValue", &H000000C8, "REG_DWORD"
  315.  
  316.  
  317. ' Disable Other Scheduled Tasks
  318. RunWait "schtasks /change /tn ""microsoft\windows\Application Experience\AitAgent"" /disable"
  319. RunWait "schtasks /change /tn ""microsoft\windows\Application Experience\ProgramDataUpdater"" /disable"
  320. RunWait "schtasks /change /tn ""microsoft\windows\Autochk\Proxy"" /disable"
  321. RunWait "schtasks /change /tn ""microsoft\windows\Customer Experience Improvement Program\Consolidator"" /disable"
  322. RunWait "schtasks /change /tn ""microsoft\windows\Customer Experience Improvement Program\KernelCeipTask"" /disable"
  323. RunWait "schtasks /change /tn ""microsoft\windows\Customer Experience Improvement Program\UsbCeip"" /disable"
  324. RunWait "schtasks /change /tn ""microsoft\windows\Diagnosis\Scheduled"" /disable"
  325. RunWait "schtasks /change /tn ""microsoft\windows\DiskDiagnostic\Microsoft-Windows-DiskDiagnosticDataCollector"" /disable"
  326. RunWait "schtasks /change /tn ""microsoft\windows\DiskDiagnostic\Microsoft-Windows-DiskDiagnosticResolver"" /disable"
  327. RunWait "schtasks /change /tn ""microsoft\windows\Maintenance\WinSAT"" /disable"
  328. RunWait "schtasks /change /tn ""microsoft\windows\MobilePC\HotStart"" /disable"
  329. RunWait "schtasks /change /tn ""microsoft\windows\Power Efficiency Diagnostic\AnalyzeSystem"" /disable"
  330. RunWait "schtasks /change /tn ""microsoft\windows\RAC\RacTask"" /disable"
  331. RunWait "schtasks /change /tn ""microsoft\windows\Ras\MobilityManager"" /disable"
  332. RunWait "schtasks /change /tn ""microsoft\windows\Registry\RegIdleBackup"" /disable"
  333. RunWait "schtasks /change /tn ""microsoft\windows\SideShow\AutoWake"" /disable"
  334. RunWait "schtasks /change /tn ""microsoft\windows\SideShow\GadgetManager"" /disable"
  335. RunWait "schtasks /change /tn ""microsoft\windows\SideShow\SessionAgent"" /disable"
  336. RunWait "schtasks /change /tn ""microsoft\windows\SideShow\SystemDataProviders"" /disable"
  337. RunWait "schtasks /change /tn ""microsoft\windows\WDI\ResolutionHost"" /disable"
  338. RunWait "schtasks /change /tn ""microsoft\windows\Windows Filtering Platform\BfeOnServiceStartTypeChange"" /disable"
  339. RunWait "schtasks /change /tn ""microsoft\windows\Windows Media Sharing\UpdateLibrary"" /disable"
  340. RunWait "schtasks /change /tn ""microsoft\windows\Windows Backup\ConfigNotification"" /disable"
  341.  
  342.  
  343. ' Configure Event Logs to 1028KB (Minimum size under Vista/7) and set retention to "overwrite"
  344. Set oEventLogs = GetObject("winmgmts:{impersonationLevel=impersonate,(Security)}!//./root/cimv2").InstancesOf("Win32_NTEventLogFile")
  345. For Each e in oEventLogs
  346.     e.MaxFileSize = 1052672
  347.     e.OverWritePolicy = "WhenNeeded"
  348.     e.OverWriteOutdated = 0
  349.     e.Put_
  350.     e.ClearEventLog()
  351. Next
  352.  
  353. oShell.RegWrite "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\eventlog\Application\Retention", 0, "REG_DWORD"
  354. oShell.RegWrite "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\eventlog\Security\Retention", 0, "REG_DWORD"
  355. oShell.RegWrite "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\eventlog\System\Retention", 0, "REG_DWORD"
  356.  
  357.  
  358. ' Set PopUp Error Mode to "Neither"
  359. oShell.RegWrite "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Windows\ErrorMode", 2, "REG_DWORD"
  360.  
  361.  
  362. ' Disable bootlog and boot animation
  363. RunWait "bcdedit /set {default} bootlog no"
  364. RunWait "bcdedit /set {default} quietboot yes"
  365.  
  366.  
  367. ' Disable UAC secure desktop prompt
  368. oShell.RegWrite "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System\PromptOnSecureDesktop", &H00000000, "REG_DWORD"
  369.  
  370.  
  371. ' Disable New Network dialog
  372. RunWait "reg add HKLM\SYSTEM\CurrentControlSet\Control\Network\NewNetworkWindowOff"
  373.  
  374.  
  375. ' Disable AutoUpdate of drivers from WU
  376. oShell.RegWrite "HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\DriverSearching\searchorderConfig", 0, "REG_DWORD"
  377.  
  378.  
  379. ' Turn off Windows Gadget Platform, Media Center, Tablet PC Components, Windows DVD Maker, and Windows SideShow
  380. RunWait "dism /online /Disable-Feature /FeatureName:WindowsGadgetPlatform /NoRestart"
  381. RunWait "dism /online /Disable-Feature /FeatureName:MediaCenter /NoRestart"
  382. RunWait "dism /online /Disable-Feature /FeatureName:TabletPCOC /NoRestart"
  383. RunWait "dism /online /Disable-Feature /FeatureName:OpticalMediaDisc /NoRestart"
  384. oShell.RegWrite "HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\Sideshow\Disabled", 1, "REG_DWORD"
  385.  
  386.  
  387. ' Disable IE First Run Wizard and RSS Feeds
  388. oShell.RegWrite "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Internet Explorer\Main\DisableFirstRunCustomize", 1, "REG_DWORD"
  389.  
  390.  
  391. ' Disable the ability to clear the paging file during shutdown
  392. oShell.RegWrite "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SessionManager\Memory Management\ClearPageFileAtShutdown", 0, "REG_DWORD"
  393.  
  394.  
  395. ' Perform a disk cleanup
  396. ' Automate by creating the reg checks corresponding to "cleanmgr /sageset:100" so we can use "sagerun:100"
  397. oShell.RegWrite "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Active Setup Temp Folders\StateFlags0100", &H00000002, "REG_DWORD"
  398. oShell.RegWrite "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Downloaded Program Files\StateFlags0100", &H00000002, "REG_DWORD"
  399. oShell.RegWrite "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Internet Cache Files\StateFlags0100", &H00000002, "REG_DWORD"
  400. oShell.RegWrite "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Memory Dump Files\StateFlags0100", &H00000002, "REG_DWORD"
  401. oShell.RegWrite "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Offline Pages Files\StateFlags0100", &H00000002, "REG_DWORD"
  402. oShell.RegWrite "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Old ChkDsk Files\StateFlags0100", &H00000002, "REG_DWORD"
  403. oShell.RegWrite "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Previous Installations\StateFlags0100", &H00000000, "REG_DWORD"
  404. oShell.RegWrite "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Recycle Bin\StateFlags0100", &H00000002, "REG_DWORD"
  405. oShell.RegWrite "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Setup Log Files\StateFlags0100", &H00000002, "REG_DWORD"
  406. oShell.RegWrite "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\System error memory dump files\StateFlags0100", &H00000002, "REG_DWORD"
  407. oShell.RegWrite "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\System error minidump files\StateFlags0100", &H00000002, "REG_DWORD"
  408. oShell.RegWrite "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Temporary Files\StateFlags0100", &H00000002, "REG_DWORD"
  409. oShell.RegWrite "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Temporary Setup Files\StateFlags0100", &H00000002, "REG_DWORD"
  410. oShell.RegWrite "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Thumbnail Cache\StateFlags0100", &H00000002, "REG_DWORD"
  411. oShell.RegWrite "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Upgrade Discarded Files\StateFlags0100", &H00000000, "REG_DWORD"
  412. oShell.RegWrite "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Windows Error Reporting Archive Files\StateFlags0100", &H00000002, "REG_DWORD"
  413. oShell.RegWrite "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Windows Error Reporting Queue Files\StateFlags0100", &H00000002, "REG_DWORD"
  414. oShell.RegWrite "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Windows Error Reporting System Archive Files\StateFlags0100", &H00000002, "REG_DWORD"
  415. oShell.RegWrite "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Windows Error Reporting System Queue Files\StateFlags0100", &H00000002, "REG_DWORD"
  416. oShell.RegWrite "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Explorer\VolumeCaches\Windows Upgrade Log Files\StateFlags0100", &H00000002, "REG_DWORD"
  417. RunWait "cleanmgr.exe /sagerun:100"
  418.  
  419.  
  420.  
  421. ' // =============
  422. ' // USER SETTINGS
  423. ' // =============
  424.  
  425. ' Reduce menu show delay
  426. oShell.RegWrite "HKEY_CURRENT_USER\Control Panel\Desktop\MenuShowDelay", "0", "REG_SZ"
  427.  
  428.  
  429. ' Disable cursor blink
  430. oShell.RegWrite "HKEY_CURRENT_USER\Control Panel\Desktop\CursorBlinkRate", "-1", "REG_SZ"
  431. oShell.RegWrite "HKEY_CURRENT_USER\Control Panel\Desktop\DisableCursorBlink", &H00000001, "REG_DWORD"
  432.  
  433.  
  434. ' Force off-screen composition in IE
  435. oShell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main\Force Offscreen Composition", &H00000001, "REG_DWORD"
  436.  
  437.  
  438. ' Disable screensavers
  439. oShell.RegWrite "HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\Control Panel\Desktop\ScreenSaveActive", "0", "REG_SZ"
  440. oShell.RegWrite "HKEY_CURRENT_USER\Control Panel\Desktop\ScreenSaveActive", "0", "REG_SZ"
  441. oShell.RegWrite "HKEY_USERS\.DEFAULT\Control Panel\Desktop\ScreenSaveActive", "0", "REG_SZ"
  442.  
  443.  
  444. ' Don't show window contents when dragging
  445. oShell.RegWrite "HKEY_CURRENT_USER\Control Panel\Desktop\DragFullWindows", "0", "REG_SZ"
  446.  
  447.  
  448. ' Don't show window minimize/maximize animations
  449. oShell.RegWrite "HKEY_CURRENT_USER\Control Panel\Desktop\WindowMetrics\MinAnimate", "0", "REG_SZ"
  450.  
  451.  
  452. ' Disable font smoothing
  453. oShell.RegWrite "HKEY_CURRENT_USER\Control Panel\Desktop\FontSmoothing", "0", "REG_SZ"
  454.  
  455.  
  456. ' Disable most other visual effects
  457. oShell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\VisualEffects\VisualFXSetting", &H00000003, "REG_DWORD"
  458. oShell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\ListviewAlphaSelect", &H00000000, "REG_DWORD"
  459. oShell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\TaskbarAnimations", &H00000000, "REG_DWORD"
  460. oShell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\ListviewWatermark", &H00000000, "REG_DWORD"
  461. oShell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\ListviewShadow", &H00000000, "REG_DWORD"
  462. RegBinWrite "HKEY_CURRENT_USER\Control Panel\Desktop", "UserPreferencesMask", "90,12,01,80"
  463.  
  464.  
  465. ' Disable Action Center
  466. oShell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\HideSCAHealth", &H00000001, "REG_DWORD"
  467.  
  468.  
  469. ' Disable IE Persistent Cache
  470. oShell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Cache\Persistent", 0, "REG_DWORD"
  471. oShell.RegWrite "HKEY_CURRENT_USER\Software\Microsoft\Feeds\SyncStatus", 0, "REG_DWORD"
  472.  
  473.  
  474. ' Done
  475. WScript.Quit
  476.  
  477.  
  478.  
  479.  
  480.  
  481.  
  482. ' // ================
  483. ' // HELPER FUNCTIONS
  484. ' // ================
  485.  
  486. Function Run(sFile)
  487.     Run = oShell.Run(sFile, 1, False)
  488. End Function
  489.  
  490.  
  491. Function RunWait(sFile)
  492.     RunWait = oShell.Run(sFile, 1, True)
  493. End Function
  494.  
  495.  
  496. Function RunWaitHidden(sFile)
  497.     RunWaitHidden = oShell.Run(sFile, 0, True)
  498. End Function
  499.  
  500.  
  501. Function IsServer()
  502.     IsServer = False
  503.     On Error Resume Next
  504.     For Each objOS in GetObject("winmgmts:").InstancesOf ("Win32_OperatingSystem")
  505.         If objOS.ProductType = 1 Then IsServer = False
  506.         If objOS.ProductType = 2 Or ObjOS.ProductType = 3 Then IsServer = True
  507.     Next
  508. End Function
  509.  
  510.  
  511. Sub RegBinWrite (key, value, data)
  512.     key = "[" & key & "]"
  513.  
  514.     If value <> "@" then
  515.         value = chr(34) & value & chr(34)
  516.     End if
  517.  
  518.     valString = value & "=" & "hex:" & data
  519.  
  520.     tempFile = GetTempDir() & "\regbinaryimport.reg"
  521.     Set txtStream = oFSO.CreateTextFile(tempFile,true)
  522.     txtStream.WriteLine("Windows Registry Editor Version 5.00")
  523.     txtStream.WriteLine(key)
  524.     txtStream.WriteLine(valString)
  525.     txtStream.Close
  526.  
  527.     oShell.Run "regedit.exe /s """ & tempFile & """", 1, true
  528.  
  529.     oFSO.DeleteFile tempFile
  530. End Sub
  531.  
  532.  
  533. Function GetTEMPDir()
  534.     GetTEMPDir = oEnv("TEMP")
  535.     If InStr(GetTEMPDir, "%") Then
  536.         GetTEMPDir = oShell.ExpandEnvironmentStrings(GetTEMPDir)
  537.     End If
  538. End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement