用脚本开启Microsoft Update的方法
本帖最后由 acmilan_11 于 2015-2-21 16:04 编辑微软的官方网站(update.microsoft.com)也是用这个方法来开启6.0.6000、6.1.7600、6.2.9200的Microsoft Update的。
可是这个网站有个缺点:不支持IE11。由于IE11更改了UserAgent字符串,因此从IE11上点击如下这个链接时,会导向一个不可用的提示信息。当然可以添加兼容性视图,但是对于离线的应用来说还是不方便。微软在安装完Office 2007以后版本之后会自动开启Microsoft Update,但是一旦你时候取消了那个选项,想再找到这个选项就困难了。微软把Microsoft Update隐藏了起来。〔Win8.1终于修复了这一蛋疼的遗留问题〕另外,在安装Office 2003之后也不会开启Microsoft Update。
传统的开启方法:点那个链接。(需要Internet)
除非你点那个链接开启了Microsoft Update,否则WU设置选项里是不会有这个选项的。
开启之后,注意第三行的字样:已经有Microsoft Update了。
开启Microsoft Update以后:WU设置中出现了两个Microsoft Update选项。
这是PowerShell程序
以下是代码(手机上可能看不到,请用电脑查看):
# 开启Microsoft Update的PowerShell脚本
$ServiceManager = New-Object -ComObject "Microsoft.Update.ServiceManager"
$ServiceManager.ClientApplicationID = "My App"
$ServiceManager.AddService2("7971f918-a847-4430-9279-4a52d1efe18d",7,"")' 开启Microsoft Update的VBScript脚本(核心代码)
Set ServiceManager = CreateObject("Microsoft.Update.ServiceManager")
ServiceManager.ClientApplicationID = "My App"
Set NewUpdateService = ServiceManager.AddService2("7971f918-a847-4430-9279-4a52d1efe18d",7,"")' 最终版VBScript程序(兼容UAC)
' Execute this program again with admin privilege (for UAC compatibility).
if WScript.Arguments.length = 0 Then
Dim objShell
Set objShell = CreateObject("Shell.Application")
objShell.ShellExecute "wscript.exe", Chr(34) & WScript.ScriptFullName & Chr(34) & " uac", "", "runas", 1
else
CALL MAIN()
end if
SUB MAIN() ' Program starts here
vReturn = MsgBox("Enable Microsoft Update for Windows Vista/7/8?",vbYesNo,"Microsoft Update")
if vReturn = vbYes then
Set ServiceManager = CreateObject("Microsoft.Update.ServiceManager")
ServiceManager.ClientApplicationID = "My App"
Set NewUpdateService = ServiceManager.AddService2("7971f918-a847-4430-9279-4a52d1efe18d",7,"")
MsgBox "Microsoft Update enabled. Try Windows Update again.",vbOKOnly,"Microsoft Update"
end if
END SUB ' Program ends here
是否也可以用在8/8.1上呢? 本帖最后由 acmilan_11 于 2015-4-23 17:49 编辑
win8.1已经修复了这个bug,所以用不着这个脚本
针对旧版本系统的? 解决了大问题 赞一个先!收藏了! 先收藏下来,谢谢分享 收藏了,技术贴
页:
[1]