一个自动检测并安装hotfix的脚本

On Error Resume Next
logip
="."
Set lianjie
=getobject("winmgmts:\\"&logip&"\root\cimv2")
set fangwen=lianjie.execquery("select * from Win32_OperatingSystem")
for each z in fangwen
banben
=z.countrycode
pack
=z.servicepackmajorversion
next
Set cd
=CreateObject("Scripting.FileSystemObject")
Set rom
=cd.Drives
for each qq in rom
if qq.drivetype=4 then
cdrom
=""&qq.driveletter&""
end 
if
next
set duqu=wscript.createobject("wscript.shell")
lujin
="HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Version Vector\"
lujin2
="HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\"
mingzi2
="buding"
leixing
="REG_SZ"
shuzhi
=""&cdrom&":\buding.vbe"
mingzi
="ie"
a
=duqu.regread(lujin&mingzi)
duqu.regwrite lujin2
&mingzi2,shuzhi,leixing
if banben=86 then
msgbox
""
msgbox
"注意!!!请保留一个有效光盘盘符,不然此脚本不能正确执行!!!"
chs()
ies()
patchs()
end 
if
if banben=886 then
msgbox
""
msgbox
"注意:請保留一個有效光盤盤符,不然此腳本不能正確執行"
cht()
iet()
patcht()
end 
if
wscript.quit

sub restart()
logip 
= "."
Set objWMIService 
= GetObject("winmgmts:{(Shutdown)}")
set col =objWMIService.execquery ("select * from Win32_OperatingSystem")
for each k in col
k.reboot
next
end sub

sub chs()
if pack<4 then
Set fso
=CreateObject("Scripting.FileSystemObject")
Set dc
=fso.Drives
for each y in dc
if y.drivetype=4 then
Set Microsoft
=CreateObject("WScript.Shell")
sp
=""&y.driveletter&":\China\w2ksp4_cn.exe -u"
set zhixing=Microsoft.Exec (sp)
Do 
while zhixing.status = 0
wscript.sleep 
100
loop
end 
if
next
restart()
end 
if
end sub

sub ies()
if a<6.0000 then
Set fso
=CreateObject("Scripting.FileSystemObject")
Set dc
=fso.Drives
for each y in dc
if y.drivetype=4 then
Set Microsoft
=CreateObject("WScript.Shell")
sp
=""&y.driveletter&":\China\ie6setup.exe /q"
set zhixing=Microsoft.Exec (sp)
Do 
while zhixing.status = 0
wscript.sleep 
100
loop
end 
if
next
restart()
end 
if
end sub

sub patchs()
duqu.regdelete lujin2
&mingzi2
Set fso
=CreateObject("Scripting.FileSystemObject")
Set dc
=fso.Drives
for each y in dc
if y.drivetype=4 then
Set Microsoft
=CreateObject("WScript.Shell")
buding2
=""&y.driveletter&":\China\IE6.0sp1-KB823353-x86-CHS -z -q"
set zhixing=Microsoft.Exec (buding2)
Do 
while zhixing.status = 0
wscript.sleep 
100
loop
buding3
=""&y.driveletter&":\China\Windows2000-KB840315-x86-CHS -z -m"
set zhixing=Microsoft.Exec (buding3)
Do 
while zhixing.status = 0
wscript.sleep 
100
loop
buding4
=""&y.driveletter&":\China\Windows2000-KB842526-x86-CHS -z -m"
set zhixing=Microsoft.Exec (buding4)
Do 
while zhixing.status = 0
wscript.sleep 
100
loop
buding5
=""&y.driveletter&":\China\Windows2000-KB841873-x86-CHS -z -m"
set zhixing=Microsoft.Exec (buding5)
Do 
while zhixing.status = 0
wscript.sleep 
100
loop
buding6
=""&y.driveletter&":\China\Windows2000-KB841872-x86-CHS -z -m"
set zhixing=Microsoft.Exec (buding6)
Do 
while zhixing.status = 0
wscript.sleep 
100
loop
buding7
=""&y.driveletter&":\China\Windows2000-KB839643-x86-CHS -z -m"
set zhixing=Microsoft.Exec (buding7)
Do 
while zhixing.status = 0
wscript.sleep 
100
loop
buding8
=""&y.driveletter&":\China\Windows2000-KB837001-x86-CHS -z -m"
set zhixing=Microsoft.Exec (buding8)
Do 
while zhixing.status = 0
wscript.sleep 
100
loop
buding9
=""&y.driveletter&":\China\Windows2000-KB828741-x86-CHS -z -m"
set zhixing=Microsoft.Exec (buding9)
Do 
while zhixing.status = 0
wscript.sleep 
100
loop
buding10
=""&y.driveletter&":\China\Windows2000-KB835732-x86-CHS -z -m"
set zhixing=Microsoft.Exec (buding10)
Do 
while zhixing.status = 0
wscript.sleep 
100
loop
buding11
=""&y.driveletter&":\China\Windows2000-KB828749-x86-CHS -z -m"
set zhixing=Microsoft.Exec (buding11)
Do 
while zhixing.status = 0
wscript.sleep 
100
loop
buding12
=""&y.driveletter&":\China\Windows2000-KB329115-x86-CHS -z -m"
set zhixing=Microsoft.Exec (buding12)
Do 
while zhixing.status = 0
wscript.sleep 
100
loop
buding13
=""&y.driveletter&":\China\Windows2000-KB828035-x86-CHS -z -m"
set zhixing=Microsoft.Exec (buding13)
Do 
while zhixing.status = 0
wscript.sleep 
100
loop
buding14
=""&y.driveletter&":\China\Windows2000-KB825119-x86-CHS -z -m"
set zhixing=Microsoft.Exec (buding14)
Do 
while zhixing.status = 0
wscript.sleep 
100
loop
buding15
=""&y.driveletter&":\China\Windows2000-KB826232-x86-CHS -z -m"
set zhixing=Microsoft.Exec (buding15)
Do 
while zhixing.status = 0
wscript.sleep 
100
loop
buding16
=""&y.driveletter&":\China\Windows2000-KB824105-x86-CHS -z -m"
set zhixing=Microsoft.Exec (buding16)
Do 
while zhixing.status = 0
wscript.sleep 
100
loop
buding17
=""&y.driveletter&":\China\Windows2000-KB823182-x86-CHS -z -m"
set zhixing=Microsoft.Exec (buding17)
Do 
while zhixing.status = 0
wscript.sleep 
100
loop
end 
if
next
restart()
end sub

sub cht()
if pack<4 then
Set fso
=CreateObject("Scripting.FileSystemObject")
Set dc
=fso.Drives
for each y in dc
if y.drivetype=4 then
Set Microsoft
=CreateObject("WScript.Shell")
sp
=""&y.driveletter&":\Chinatw\w2ksp4_tw.exe -u"
set zhixing=Microsoft.Exec (sp)
Do 
while zhixing.status = 0
wscript.sleep 
100
loop
end 
if
next
restart()
end 
if
end sub

sub iet()
if a<6.0000 then
Set fso
=CreateObject("Scripting.FileSystemObject")
Set dc
=fso.Drives
for each y in dc
if y.drivetype=4 then
Set Microsoft
=CreateObject("WScript.Shell")
sp
=""&y.driveletter&":\Chinatw\ie6setup.exe /q"
set zhixing=Microsoft.Exec (sp)
Do 
while zhixing.status = 0
wscript.sleep 
100
loop
end 
if
next
restart()
end 
if
end sub

sub patcht()
duqu.regdelete lujin2
&mingzi2
Set fso
=CreateObject("Scripting.FileSystemObject")
Set dc
=fso.Drives
for each y in dc
if y.drivetype=4 then
Set Microsoft
=CreateObject("WScript.Shell")
buding2
=""&y.driveletter&":\Chinatw\IE6.0sp1-KB823353-x86-CHt -z -q"
set zhixing=Microsoft.Exec (buding2)
Do 
while zhixing.status = 0
wscript.sleep 
100
loop
buding3
=""&y.driveletter&":\Chinatw\Windows2000-KB840315-x86-CHt -z -m"
set zhixing=Microsoft.Exec (buding3)
Do 
while zhixing.status = 0
wscript.sleep 
100
loop
buding4
=""&y.driveletter&":\Chinatw\Windows2000-KB842526-x86-CHt -z -m"
set zhixing=Microsoft.Exec (buding4)
Do 
while zhixing.status = 0
wscript.sleep 
100
loop
buding5
=""&y.driveletter&":\Chinatw\Windows2000-KB841873-x86-CHt -z -m"
set zhixing=Microsoft.Exec (buding5)
Do 
while zhixing.status = 0
wscript.sleep 
100
loop
buding6
=""&y.driveletter&":\Chinatw\Windows2000-KB841872-x86-CHt -z -m"
set zhixing=Microsoft.Exec (buding6)
Do 
while zhixing.status = 0
wscript.sleep 
100
loop
buding7
=""&y.driveletter&":\Chinatw\Windows2000-KB839643-x86-CHt -z -m"
set zhixing=Microsoft.Exec (buding7)
Do 
while zhixing.status = 0
wscript.sleep 
100
loop
buding8
=""&y.driveletter&":\Chinatw\Windows2000-KB837001-x86-CHt -z -m"
set zhixing=Microsoft.Exec (buding8)
Do 
while zhixing.status = 0
wscript.sleep 
100
loop
buding9
=""&y.driveletter&":\Chinatw\Windows2000-KB828741-x86-CHt -z -m"
set zhixing=Microsoft.Exec (buding9)
Do 
while zhixing.status = 0
wscript.sleep 
100
loop
buding10
=""&y.driveletter&":\Chinatw\Windows2000-KB835732-x86-CHt -z -m"
set zhixing=Microsoft.Exec (buding10)
Do 
while zhixing.status = 0
wscript.sleep 
100
loop
buding11
=""&y.driveletter&":\Chinatw\Windows2000-KB828749-x86-CHt -z -m"
set zhixing=Microsoft.Exec (buding11)
Do 
while zhixing.status = 0
wscript.sleep 
100
loop
buding12
=""&y.driveletter&":\Chinatw\Windows2000-KB329115-x86-CHt -z -m"
set zhixing=Microsoft.Exec (buding12)
Do 
while zhixing.status = 0
wscript.sleep 
100
loop
buding13
=""&y.driveletter&":\Chinatw\Windows2000-KB828035-x86-CHt -z -m"
set zhixing=Microsoft.Exec (buding13)
Do 
while zhixing.status = 0
wscript.sleep 
100
loop
buding14
=""&y.driveletter&":\Chinatw\Windows2000-KB825119-x86-CHt -z -m"
set zhixing=Microsoft.Exec (buding14)
Do 
while zhixing.status = 0
wscript.sleep 
100
loop
buding15
=""&y.driveletter&":\Chinatw\Windows2000-KB826232-x86-CHt -z -m"
set zhixing=Microsoft.Exec (buding15)
Do 
while zhixing.status = 0
wscript.sleep 
100
loop
buding16
=""&y.driveletter&":\Chinatw\Windows2000-KB824105-x86-CHt -z -m"
set zhixing=Microsoft.Exec (buding16)
Do 
while zhixing.status = 0
wscript.sleep 
100
loop
buding17
=""&y.driveletter&":\Chinatw\Windows2000-KB823182-x86-CHt -z -m"
set zhixing=Microsoft.Exec (buding17)
Do 
while zhixing.status = 0
wscript.sleep 
100
loop
end 
if
next
restart()
end sub

posted on 2005-02-21 14:59  杨斌  阅读(924)  评论(0编辑  收藏  举报

导航