public void DeploySQLDMO(string dllPath)
{
string systemPath = Environment.GetFolderPath(Environment.SpecialFolder.System);
string sqlwoaFile = String.Format(@"{0}\sqlwoa.dll", systemPath);
string sqlwidFile = String.Format(@"{0}\sqlwid.dll", systemPath);
if (!File.Exists(sqlwoaFile))
{
File.Copy(String.Format(@"{0}\sqlwoa.dll", dllPath), sqlwoaFile);
}
if (!File.Exists(sqlwidFile))
{
File.Copy(String.Format(@"{0}\sqlwid.dll", dllPath), sqlwidFile);
}
Process p = new Process();
p.StartInfo.FileName = "regsvr32.exe";
p.StartInfo.Arguments = String.Format(" /s {0}\\sqldmo.dll", dllPath);
p.StartInfo.WorkingDirectory = systemPath;
p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
p.Start();
p.WaitForExit();
p.Close();
}
dllPath 目錄下檔案清單:
sqlwid.dll
sqlwoa.dll
sqlresld.dll
sqlsvc.dll
w95scm.dll
SQLDMO.DLL
\Resources\2052\SQLDMO.RLL
\Resources\2052\sqlsvc.RLL
下載SQLDMO所需檔案:
http://files.cnblogs.com/smartstone/SQLDMO.rar