程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 數據庫知識 >> SqlServer數據庫 >> 關於SqlServer >> 將MS SQL Server 2005 SP2整合到安裝文件——腳本修正

將MS SQL Server 2005 SP2整合到安裝文件——腳本修正

編輯:關於SqlServer

剛入手新本本,一陣忙活,裝好系統。小黑的驅動真不少,七七八八也有二三十個文件要下載、安裝。輪到安裝開發軟件更是崩潰,一堆堆的sp等著我們打!微軟留給我們的噩夢啊,所以,開始下載整合了SP補丁的軟件,唯獨沒有找到SQL Server2005的整合版下載,只能自己動手,做個整合版了。網上一陣Google,見到園子裡面這篇文章:將 MS SQL Server 2005 SP2 整合到安裝文件,寫的很不錯,方法都有了,一看還有個腳本集成,很不錯,可惜一執行下來,一堆錯誤,自己手動稍微調整了下,已經測試通過,放出來給大家共享一下,整合了開發版和企業版的32位安裝包(帶SP2)的大小855MB,isz壓縮格式。修正的腳本如下:

1 /////////////////////////////////////////////////
2 // Slipsteaming MSSQL Server 2005 SP2
3 // Author : Zealic
4 // Date : 2007-03-19
5 // Version : 1.01
6 //
7 // Author : Hollis Yao
8 // Date : 2008-01-15
9 // Version : 2.00
10 /////////////////////////////////////////////////
11 var swap = "D:\\SWAP";
12 var sqldir = "D:\\MSSQL";
13 var sp2 = "D:\\SP2";
14 var server = sqldir + "\\Servers\\Setup";
15 var tools = sqldir + "\\Tools\\Setup";
16 var log = "D:\\install.log";
17
18 install();
19
20 function install()
21 {
22 WScript.Echo("Slipsteaming MSSQL Server 2005 SP2 By Zealic, Playse wait processing");
23 try
24 {
25 installServers();
26 //exec("RD /Q /S " + swap );
27 installTools();
28 sucess();
29 }
30 catch(e)
31 {
32 WScript.Echo(e.name + " : " + e.message);
33 fail();
34 }
35 }
36
37 function installServers()
38 {
39 testRun("XCOPY /Y /H " + sp2 + "\\*.msi " + server);
40 testRun("msiexec /quiet /a" + server + "\\sqlrun_as.msi TARGETDIR=" + swap + " /L*vx " + log);
41 testRun("msiexec /quiet /a" + server + "\\sqlrun_dts.msi TARGETDIR=" + swap + " /L*vx " + log);
42 testRun("msiexec /quiet /a" + server + "\\sqlrun_ns.msi TARGETDIR=" + swap + " /L*vx " + log);
43 testRun("msiexec /quiet /a" + server + "\\sqlrun_rs.msi TARGETDIR=" + swap + " /L*vx " + log);
44 testRun("msiexec /quiet /a" + server + "\\sqlrun_sql.msi TARGETDIR=" + swap + " /L*vx " + log);
45 testRun("msiexec /quiet /a " + swap + "\\sqlrun_as.msi /p " + sp2 + "\\sqlrun_as.msp" + " /L*vx " + log);
46 testRun("msiexec /quiet /a " + swap + "\\sqlrun_dts.msi /p " + sp2 + "\\sqlrun_dts.msp" + " /L*vx " + log);
47 testRun("msiexec /quiet /a " + swap + "\\sqlrun_ns.msi /p " + sp2 + "\\sqlrun_ns.msp" + " /L*vx " + log);
48 testRun("msiexec /quiet /a " + swap + "\\sqlrun_rs.msi /p " + sp2 + "\\sqlrun_rs.msp" + " /L*vx " + log);
49 testRun("msiexec /quiet /a " + swap + "\\sqlrun_sql.msi /p " + sp2 + "\\sqlrun_sql.msp" + " /L*vx " + log);
50 testRun("XCOPY /Y /E " + swap + " " + server);
51 }
52
53 function installTools()
54 {
55 testRun("XCOPY /Y /H " + sp2 + "\\*.msi " + tools);
56 testRun("msiexec /quiet /a" + tools + "\\sqlrun_tools.msi TARGETDIR=" + swap + "2 /L*vx " + log);
57 testRun("msiexec /quiet /a " + swap + "2\\sqlrun_tools.msi /p " + sp2 + "\\sqlrun_tools.msp" + " /L*vx " + log);
58 testRun("XCOPY /Y /E " + swap + "2 " + tools);
59 }
60
61 function testRun(runStr)
62 {
63 var wsh = new ActiveXObject("Wscript.Shell");
64 var sys32 = wsh.ExpandEnvironmentStrings("%WINDIR%\\System32");
65
66 wsh.CurrentDirectory = sys32;
67 var ret = wsh.Run(runStr,0,true);
68 if(ret != 0)fail();
69 return ret;
70 }
71
72 function exec(runStr)
73 {
74 var wsh = new ActiveXObject("Wscript.Shell");
75 var shell = wsh.ExpandEnvironmentStrings("%COMSPEC%");
76 var ret = wsh.Run(shell + " /K " + runStr,0,true);
77 if(ret != 0)fail();
78 wsh.Run(shell + " /K exit",0,true);
79 return ret;
80 }
81
82 function fail()
83 {
84 WScript.Echo("Process fail! Please retry execute this script, Press 'Enter' to exit.");
85 //WScript.StdIn.ReadLine();
86 WScript.Quit();
87 }
88
89 function sucess()
90 {
91 WScript.Echo("Process OK! Press 'Enter' to exit.");
92 //WScript.StdIn.ReadLine();
93 WScript.Quit();
94 }
  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved