彻底防止Windows 7/8/8.1升级更新到Windows 10

!本文可能 超过1年没有更新,今后内容也许不会被维护或者支持,部分内容可能具有时效性,涉及技术细节或者软件使用方面,本人不保证相应的兼容和可操作性。

去年7月写过一篇文章讲解如何去除扰人的获取Windows 10的图标,那时候微软也只是推送了获取Windows 10的提示,具体安装Windows 10与否还是有显著的选项让用户自己选择的。

虽然通过先前的方法确实抑制了升级Windows 10的提示,怎奈微软接下来连续放大招推送升级补丁,并且不怎么明显的“诱使”用户升级系统,比如我遇到的微软健康助手提示升级,并且默认勾选同意的坑。其实我不是说Windows 10不好,就是较为反感微软的推送方式,就好像你去商场老是有业务员跟着你,不停向你推荐某某产品好等等,而且因为大部分客户电脑上一些业务系统在Windows 10下存在各种兼容问题,就有客户反应因为不小心升级Windows 10导致业务软件不能正常运行最后只有重新安装老系统(其实对于误安装有办法直接恢复到老系统,方法附本文后)

第一部分,如何防止Windows 7/8/8.1升级到Windows 10

经常有朋友说我思想老顽固了,不愿意去尝试新鲜事物,其实不是不愿意尝试,而是越来越觉得适合自己的才是最好的,不喜欢繁杂的功能,觉得简单才是一种美,好了言归正传,防止老系统升级到Windows 10实际上已经有人开发了软件GWX Control Panel,大家直接下载后运行,再点击即可防止系统升级,用这个软件还有个好处就是可以在想升级的时候再进行恢复,软件简单操作如下。

1、运行下载的GWX Control Panel程序,首先接受并同意须知,如下图所示:

GWX Control Panel - Step 1

2、点击“Prevent Automatic Windows 10 Upgrades”即可禁止自动的Windows 10升级,其他的选项也有特定含义,主要的我翻译如下图所示:

GWX Control Panel - Step 2

其实对于快餐族或者实用主义者来说GWX Control Panel已经足够,所以下面的内容可以忽略,但是我有一颗重复造轮子的心,遂根据我收集的关于禁止升级到Windows 10的相关文献资料,对于禁止升级到Windows 10,大体上分为以下几个步骤:

1、卸载并且隐藏关联更新,这些更新主要包括如下:

通过以下批处理可以完成相关卸载,另存为.bat文件,并右击以管理员身份运行:

@echo on
wusa /uninstall /kb:3035583 /norestart /quiet
wusa /uninstall /kb:3022345 /norestart /quiet
wusa /uninstall /kb:3068708 /norestart /quiet
wusa /uninstall /kb:3075249 /norestart /quiet
wusa /uninstall /kb:3080149 /norestart /quiet
wusa /uninstall /kb:2990214 /norestart /quiet
wusa /uninstall /kb:3012973 /norestart /quiet
wusa /uninstall /kb:2952664 /norestart /quiet
wusa /uninstall /kb:2976978 /norestart /quiet

隐藏相关更新项目,以避免再一次被推送安装,如何隐藏Windows更新,可以通过以下步骤来实现:

(1) 控制面板 – 所有控制面板项 – Windows Update 点击如下图位置(不完全一样,位置相同)找到待更新的项目:

Windows Update

(2) 对更新项目右击,选择“隐藏更新”即可,如下图所示:

Windows Update 隐藏更新

2、修改相关注册表

将下面的注册表相关另存为.reg文件,并且双击导入即可完成修改:

Windows Registry Editor Version 5.00
 
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\OSUpgrade]
"AllowOSUpgrade"=dword:00000000
 
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\OSUpgrade\State]
"OSUpgradeState"=dword:00000001
 
[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate]
"DisableOSUpgrade"=dword:00000001

3、删除相关文件

删除%SystemRoot%\System32\GWX目录及相关文件,通过以下批处理完成:

del /f /s /a /q %SystemRoot%\System32\GWX

删除已经下载的Windows 10安装包及相关文件,通过以下批处理完成:

del /f /s /a /q %SystemDrive%\$Windows.~BT
del /f /s /a /q %SystemDrive%\$Windows.~WS

这里解释一下,$WINDOWS.~BT文件夹内容是Windows10预下载镜像,这个文件夹很大因为包含了一个操作系统嘛;$Windows.~WS 文件夹是下载工具MediaCreationTool下载的文件夹,默认保留原先旧系统31天,其实并不建议大家通过以上批处理完成清理过程,可以通过系统自带的“磁盘清理工具”来清理比较好。

磁盘清理工具

经过这么一折腾,你的Windows 7/8/8.1又将恢复安静了,至于什么时候安装Windows 10则完全由个人决定,而不是每天都有人催促和推销(M$表打我)。当然我希望这个过程能够越快越好和越简单越好,对于业余系统维护人员来说,客户电脑越稳定自己要做的工作越少,花费的时间也越少,所以不希望有客户误点升级导致业务软件失效,所以我将上述功能打包成VBScript可执行脚本,只要在不可以升级的系统上运行即可免去误升级的烦恼,当然脚本由于个人能力有限可能存在潜在的Bug,因此带来的问题与本人无关,建议使用前备份相关文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
'
' File Description : Disable Windows 7/8/8.1 Upgrade to Windows 10
'
' Copyright (c) 2016 WangYe. All rights reserved.
' 
' Author: WangYe
' Site: http://wangye.org
' This code is distributed under the BSD license
'
' Usage:
'     CScript path/to/this/script
'
' *** 请不要移除此版权信息 ***
'
 
Option Explicit
 
Class WinUpdateMgr
 
    Private objSession
    Private objCollection
 
    Private Sub Class_Initialize()
        Set objSession = WScript.CreateObject("Microsoft.Update.Session")
        objSession.ClientApplicationID = "Disable Windows 10 Update Script"
        Set objCollection = WScript.CreateObject("Microsoft.Update.UpdateColl")
    End Sub
 
    Private Sub Class_Terminate()
        Set objCollection = Nothing
        Set objSession = Nothing
    End Sub
 
    Public Sub AddToCollection(ByRef objUpdateItem)
        objCollection.Add objUpdateItem
    End Sub
 
    Public Sub ClearCollection()
        objCollection.Clear
    End Sub
 
    Public Function GetCollectionCount()
        GetCollectionCount = objCollection.Count
    End Function
 
    Public Function Install()
        If objCollection.Count > 0 Then
            Dim objInstaller
            Set objInstaller = objSession.CreateUpdateInstaller()
                objInstaller.Updates = objCollection
                Set Install = objInstaller.Install()
                ClearCollection
            Set objInstaller = Nothing
        End If
    End Function
 
    Public Function Uninstall()
        If objCollection.Count > 0 Then
            Dim objInstaller
            Set objInstaller = objSession.CreateUpdateInstaller()
                objInstaller.Updates = objCollection
                Set Uninstall = objInstaller.Uninstall()
                ClearCollection
            Set objInstaller = Nothing
        End If
    End Function
 
    Public Function EnumUpdates(ByVal strCallback, ByVal strQuery, ByRef Param)
        Dim i
        Dim objSearcher, objSearchResult, objUpdateItem
        Dim fnCallback
 
        Set fnCallback = GetRef(strCallback)
        Set objSearcher = objSession.CreateUpdateSearcher()
        Set objSearchResult = objSearcher.Search(strQuery)
 
        For i = 0 To objSearchResult.Updates.Count - 1
            Set objUpdateItem = objSearchResult.Updates.Item(i)
            if fnCallback(objUpdateItem, Me, Param) Then Exit For
            Set objUpdateItem = Nothing
        Next
 
        Set objSearcher = Nothing
        Set objSearchResult = Nothing
        Set fnCallback = Nothing
 
        EnumUpdates = i
    End Function
 
End Class
 
' KB2990967 and KB3035583
Function RemoveUpdateCallback(ByRef objItem, ByRef objThis, ByRef Param)
    Dim i, kbArticleId
    For i = 0 To objItem.KBArticleIDs.Count - 1
        kbArticleId = objItem.KBArticleIDs(i)
        If InStr("," & Param & ",", "," & kbArticleId & ",") Then
            WSH.StdOut.Write "Found " & objItem.Title & " ... "
            If objItem.IsInstalled Then
                WSH.StdOut.Write "Installed"
                WSH.StdOut.Write vbCrLf
                objThis.AddToCollection objItem
            Else
                WSH.StdOut.Write "Not Installed"
                WSH.StdOut.Write vbCrLf
            End If
 
            WSH.StdOut.Write " * Hiding this update now ... "
            objItem.IsHidden = True
            WSH.StdOut.Write " Completed" & vbCrLf
        End If
    Next
End Function
 
Sub RemoveWinUpdates()
    Dim objWUMgr, objUninstallResult
    Set objWUMgr = New WinUpdateMgr
 
        WSH.Echo "Please wait for checking Windows updates ..."
 
        objWUMgr.EnumUpdates "RemoveUpdateCallback", "Type='Software'", _
            "3035583,2952664,3022345,3021917,3068708,3075249,3080149,2990214,3012973,2976978"
        WSH.Echo "---------- Check Completed -----------"
 
        If objWUMgr.GetCollectionCount() > 0 Then
 
            WSH.Echo "Please wait for uninstall Windows updates ..."
            Set objUninstallResult = objWUMgr.Uninstall()
            WSH.Echo "Uninstall completed (ResultCode = " & objUninstallResult.ResultCode & ")"
            If objUninstallResult.RebootRequired > 0 Then
                WSH.Echo "You need restart computer for complete uninstall steps"
            End If
            Set objUninstallResult = Nothing
 
        End If
        WSH.Echo
    Set objWUMgr = Nothing
End Sub
 
Sub UpdateRegistry()
    Const HKLM = &H80000002
    Dim strComputer, objRegistry, strKeyPath
 
    WSH.Echo "Update registry now ..."
    strComputer = "."
    Set objRegistry = GetObject("winmgmts:\\" & _
            strComputer & "\root\default:StdRegProv")
 
    strKeyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\OSUpgrade"
    objRegistry.CreateKey HKLM, strKeyPath
    objRegistry.SetDWORDValue HKLM, strKeyPath, "AllowOSUpgrade", 0
 
    strKeyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\OSUpgrade\State"
    objRegistry.CreateKey HKLM, strKeyPath
    objRegistry.SetDWORDValue HKLM, strKeyPath, "OSUpgradeState", 1
 
    strKeyPath = "SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate"
    objRegistry.CreateKey HKLM, strKeyPath
    objRegistry.SetDWORDValue HKLM, strKeyPath, "DisableOSUpgrade", 1
 
    strKeyPath = "SOFTWARE\Policies\Microsoft\Windows\Gwx"
    objRegistry.CreateKey HKLM, strKeyPath
    objRegistry.SetDWORDValue HKLM, strKeyPath, "DisableGwx", 1
 
    WSH.Echo "--------- Update Completed -----------"
    WSH.Echo
    Set objRegistry = Nothing
End Sub
 
Sub DeleteAll(ByRef fso, ByVal strFileName)
    Const DeleteReadonly = True
    Dim objFile, objFolder, objSubFolder
 
    If fso.FileExists(strFileName) Then
        fso.DeleteFile strFileName, True
        Exit Sub
    End If
 
    If fso.FolderExists(strFileName) Then
        Set objFolder = fso.GetFolder(strFileName)
 
        fso.DeleteFile(fso.BuildPath(objFolder.Path, "*")), DeleteReadonly
        fso.DeleteFolder(fso.BuildPath(objFolder.Path, "*")),DeleteReadonly
 
        For Each objFile In objFolder.Files
           On Error Resume Next
           objFile.Delete True
           On Error GoTo 0
        Next
        For Each objSubFolder In objFolder.SubFolders
           On Error Resume Next
           objSubFolder.Delete True
           On Error GoTo 0
        Next
 
        objFolder.Delete True
 
        Set objFolder = Nothing
    End If
 
End Sub
 
Sub DeleteFiles()
    Const WindowsFolder = 0
    Const SystemFolder  = 1
 
    WSH.Echo "Please wait for Clean up unwanted folders or files ..."
    WSH.Echo "--------------------------------------"
 
    Dim objFileSysObj, objFile, strRootDir, strFileName
    Set objFileSysObj = WScript.CreateObject("Scripting.FileSystemObject") 
 
    WSH.Echo "Clean up GWX folder ..."
    Set objFile = objFileSysObj.GetSpecialFolder(SystemFolder)
    strFileName = objFileSysObj.BuildPath(objFile.Path, "GWX")
    DeleteAll objFileSysObj, strFileName
    Set objFile = Nothing
 
    WSH.Echo "Clean up Downloaded Windows 10 folder ..."
    Set objFile = objFileSysObj.GetSpecialFolder(WindowsFolder)
        strRootDir = objFileSysObj.GetParentFolderName(objFile.Path)
        strFileName = objFileSysObj.BuildPath(strRootDir, "$Windows.~BT")
        DeleteAll objFileSysObj, strFileName
        strFileName = objFileSysObj.BuildPath(strRootDir, "$Windows.~WS")
        DeleteAll objFileSysObj, strFileName
    Set objFile = Nothing
 
    WSH.Echo "--------- Clean up Completed ---------"
    WSH.Echo
    Set objFileSysObj = Nothing
End Sub
 
Sub TerminateProcess(ByVal strProcName)
    Const strComputer = "." 
    Dim objWMIService, colProcessList, objProcess
    Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
    Set colProcessList = objWMIService.ExecQuery("SELECT * FROM Win32_Process WHERE Name = '" & strProcName & "'")
    For Each objProcess in colProcessList 
        objProcess.Terminate()
    Next
End Sub
 
Sub KillProcesses()
    WSH.Echo "Terminate process now ..."
 
    WSH.Echo "Kill GWX in process list ..."
    TerminateProcess "GWX.exe"
    TerminateProcess "GWXUX.exe"
    TerminateProcess "Gwxgc.exe"
    TerminateProcess "Gwxconfigmanager.exe"
    TerminateProcess "Gwxdetector.exe"
    TerminateProcess "Gwxuxworker.exe"
    WSH.Echo "-------- Terminate Completed ---------"
    WSH.Echo
End Sub
 
Function CurrentUserIsAdmin()
    Dim objNetwork, strComputer, strUser, objUser, objGroup
    Set objNetwork = CreateObject("Wscript.Network")
    strComputer = objNetwork.ComputerName
    strUser = objNetwork.UserName
 
    CurrentUserIsAdmin = False
 
    Set objGroup = GetObject("WinNT://" & strComputer & "/Administrators")
    For Each objUser in objGroup.Members
        If objUser.Name = strUser Then
            CurrentUserIsAdmin = True  
            Exit Function
        End If
    Next
End Function
 
' http://stackoverflow.com/questions/4765485/how-to-force-vbs-script-to-run-in-cscript-host
' http://stackoverflow.com/questions/4692542/force-a-vbs-to-run-using-cscript-instead-of-wscript
Sub ForceCScriptExecution(ByVal runAsAdmin)
    On Error Resume Next
    WScript.StdErr.Write(Chr(7))
    If Err.Number <> 0 Then
        Err.Clear
        On Error GoTo 0
        Dim WshShell, sh, Arg, Str
        Set WshShell = WScript.CreateObject("WScript.Shell")
        sh = WshShell.ExpandEnvironmentStrings("%SystemRoot%\System32\CScript.exe")
        If InStr(sh,"%") = 1 Then sh="CScript.exe"
 
        For Each Arg In WScript.Arguments
            If InStr( Arg, " " ) Then Arg = """" & Arg & """"
            Str = Str & " " & Arg
        Next
 
        If runAsAdmin Then
            Wscript.CreateObject("Shell.Application").ShellExecute _
             sh, "//NoLogo """ & _
            WScript.ScriptFullName & """ " & Str, "", "runas", 1
        Else
            WshShell.Run sh & " //NoLogo """ & _
                WScript.ScriptFullName & """ " & Str
        End If
        WScript.Quit()
    End If
End Sub
 
Function GetWindowsVersion()
    Dim strComputer, objWMIService
    Dim colOperatingSystem, objOperatingSystem
    strComputer = "."
    Set objWMIService = GetObject( _
        "winmgmts:{impersonationLevel=impersonate}!\\" & _
        strComputer & "\root\cimv2")
    Set colOperatingSystem = _
        objWMIService.ExecQuery ("Select * from Win32_OperatingSystem")
 
    Dim Version
    For Each objOperatingSystem in colOperatingSystem
        Version = objOperatingSystem.Version
    Next
 
    GetWindowsVersion = Version
End Function
 
Sub Pause(strPause)
     WScript.Echo (strPause)
     WScript.StdIn.Read(1)
End Sub
 
Function VBMain()
    VBMain = 0
 
    Dim strVersion, arrVersion
    strVersion = GetWindowsVersion()
    arrVersion = Split(strVersion, ".")
    ' https://msdn.microsoft.com/ru-ru/library/windows/desktop/ms724832(v=vs.85).aspx
    If CInt(arrVersion(0)) <> 6 Or _
        (CInt(arrVersion(0)) = 6 And _
         ( CInt(arrVersion(1)) <> 1 And _
           CInt(arrVersion(1)) <> 2 And _
           CInt(arrVersion(1)) <> 3 )) Then
      MsgBox "This Script Must Run under Windows 7/8/8.1"
      VBMain = 1
      Exit Function
    End If
 
    ForceCScriptExecution True
 
    WSH.Echo "Disable Windows 10 Upgrade Tool 1.0" & vbCrLf &_
              "Written By WangYe http://wangye.org/" & vbCrLf & vbCrLf
 
    If Not CurrentUserIsAdmin() Then
      WSH.Echo "**** Error: This Script Must Run under Administrators Account ****"
      Pause "Press any key to exit..."
      VBMain = 1
      Exit Function
    End If
 
    KillProcesses
    RemoveWinUpdates
    UpdateRegistry
    DeleteFiles
End Function
 
WSH.Quit(VBMain())

另存为*.vbs文件,直接双击即可(如果安全软件提示直接选择允许),这一段脚本其实还有一些小问题,比如隐藏更新的功能貌似一直无效,所以隐藏更新还需要手动操作,另外检查Windows更新时候等待的时间非常之长,需要有足够的耐心,所以总体上这段代码还是供大家参考吧。

第二部分,如何从已经升级Windows 10退回到旧系统

如果已经不小心升级,在30天内还可以通过以下方式进行补救,点击左下角开始标识(田字标志),点击“设置”,如下图所示:

Windows 10 设置

点击“更新和安全”选项,如下图所示:

Windows 10 更新和安全

选择“恢复”并在右边找到“回退到Windows 7”,点击“开始”即可完成回滚过程,如下图所示:

Windows 10回退到Windows 7

参考文档

若无特别说明,本网站文章均为原创,原则上这些文章不允许转载,但是如果阁下是出于研究学习目的可以转载到阁下的个人博客或者主页,转载遵循创作共同性“署名-非商业性使用-相同方式共享”原则,请转载时注明作者出处谢绝商业性、非署名、采集站、垃圾站或者纯粹为了流量的转载。谢谢合作!

  1. 您好!升到Windows 10后,真的很討厭,想還原到以前的系統,可是我已超過30天的恢復期了,有什麽方法可以解決嗎?如果可以的話,在不影響其他系統操作的前提下,因為我對其他安裝的系統不會,謝謝您。

    • 非常遺憾聽到這個消息,不幸的是在超過30天后微軟並沒有提供官方的方法回滾至之前的系統,而且原先系統的備份很有可能已經被刪除,我查詢了網絡,據這篇文章所描述,你可以嘗試第三方軟件Easeus System GoBack以解決這個問題。

    • 存在这样乐于折腾的人,实际上对于大部分人来说还是因为需要一个适应的过程,可能很多人并不是适应新的系统,慢慢的看到周围人用了思想上接受了才会考虑更换;有些人觉得现在系统功能上够用了为了求稳定也不愿意升级;另外还有一些人是因为软件兼容的原因而不得不停留在老系统上。

请稍后...

发表评论

电子邮件地址不会被公开。 必填项已用*标注

*