Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Problems with bootstrapping sql install
- string res = RunCmdLineProc(Directory.GetCurrentDirectory().ToString(), "msiexec", " /i SqlLocalDB.msi /qn IACCEPTSQLLOCALDBLICENSETERMS=YES");
- Thread.Sleep(120000);
- string localdbInstanceName = "G2";
- string LocalDBUtilityPath = @"C:Program FilesMicrosoft SQL Server110ToolsBinn""; // aleksey.berezan: added 2nd quote to fix stack overflow syntax highlighting
- //Directory.GetCurrentDirectory().ToString()
- res = RunCmdLineProc(LocalDBUtilityPath, "SqlLocalDB", " " + "create" + " " + localdbInstanceName);
- public static string RunCmdLineProc(string sWrkDir, string sExe, string sArgs)
- {
- try
- {
- string res = "..empty...";
- myLogger.LoggerInstance.sw.Write("n In RunCmdLineProc method..params:" + sWrkDir + " " + sExe + " " + sArgs);
- ProcessStartInfo procStartInfo = new System.Diagnostics.ProcessStartInfo();
- myLogger.LoggerInstance.sw.Write("n1 " + res);
- procStartInfo.FileName = sExe;
- procStartInfo.WorkingDirectory = sWrkDir;
- procStartInfo.Arguments = sArgs;
- procStartInfo.RedirectStandardOutput = true;
- procStartInfo.UseShellExecute = false;
- procStartInfo.CreateNoWindow = false;
- //procStartInfo.Verb = "runas";
- procStartInfo.UserName = "admin";
- System.Security.SecureString pw = new System.Security.SecureString();
- pw.AppendChar('');
- pw.AppendChar('');
- pw.AppendChar('');
- pw.AppendChar('');
- pw.AppendChar('');
- pw.AppendChar('');
- pw.AppendChar('');
- pw.AppendChar('');
- pw.AppendChar('');
- procStartInfo.Password = pw;
- //procStartInfo.Verb = "runas";
- //procStartInfo.RedirectStandardError = true;
- procStartInfo.ErrorDialog = true;
- Process proc = new System.Diagnostics.Process();
- proc.StartInfo = procStartInfo;
- myLogger.LoggerInstance.sw.Write("n2 " + res);
- proc.Start();
- myLogger.LoggerInstance.sw.Write("n3 " + res);
- res = proc.StandardOutput.ReadToEnd();
- myLogger.LoggerInstance.sw.Write("n4** " + res);
- proc.Close();
- proc.Dispose();
- myLogger.LoggerInstance.sw.Write("n5 " + res);
- return res;
- }
- catch (SystemException ex)
- {
- //ex = new Exception(ex.Source.ToString(), ex.InnerException);
- myLogger.LoggerInstance.sw.Write("n6 " + ex);
- //myLogger.LoggerInstance.sw.Close();
- throw ex;
- }
- finally
- {
- myLogger.LoggerInstance.sw.Write("");
- }
- }
Add Comment
Please, Sign In to add comment