internal bool CheckSql2014Ex() { var architecture = new _architecturechecker(); var xx = architecture.is64BitOperatingSystem; var yy = architecture.is64BitProcess; if (yy && xx) { return(sql6432bit()); } else if (!yy && xx) { return(wow6432()); } return(false); bool sql6432bit() { const string subkey = @"SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\SQL"; using (RegistryKey ndpKey = Registry.LocalMachine.OpenSubKey(subkey)) { if (ndpKey != null) { foreach (var item in ndpKey.GetValueNames()) { var y = ndpKey.GetValue(item); if (y.ToString().Contains("MSSQL12")) { return(true); } } } } return(false); } bool wow6432() { const string subkey = @"SOFTWARE\WOW6432Node\Microsoft\Microsoft SQL Server\Instance Names\SQL"; using (RegistryKey ndpKey = Registry.LocalMachine.OpenSubKey(subkey)) { if (ndpKey != null) { foreach (var item in ndpKey.GetValueNames()) { var y = ndpKey.GetValue(item); if (y.ToString().Contains("MSSQL12")) { return(true); } } } } return(false); } }
public _listmanager() { if (ListItems == null) { ListItems = new ObservableCollection <_itemstructure>(); } if (frameworkCheck == null) { frameworkCheck = new _netframeworkchecker(); } if (sqlCheck == null) { sqlCheck = new _sqlchecker(); } if (architectureCheck == null) { architectureCheck = new _architecturechecker(); } var sb = new StringBuilder(); sb.Append("/Action=Install /IAcceptSQLServerLicenseTerms=True /ADDCURRENTUSERASSQLADMIN=true /FEATURES=SQLENGINE,REPLICATION,SNAC_SDK"); sb.Append(" /INSTANCENAME = " + '"' + "SQLEXPRESS2014EX" + '"'); sb.Append(" /INSTANCEID = " + '"' + "SQLEXPRESS2014EX" + '"'); sb.Append(" /SQLSVCACCOUNT = " + '"' + "NT Service\\MSSQL$SQLEXPRESS2014EX" + '"'); sb.Append(" /SECURITYMODE = " + '"' + "SQL" + '"'); sb.Append(" /SAPWD = " + '"' + "Sql12345" + '"' + " /QS"); ListItems.Add(new _itemstructure { name = "Net Framework 4.8", instaled = frameworkCheck.CheckFramework(), downloaded = false, link64 = "https://download.visualstudio.microsoft.com/download/pr/014120d7-d689-4305-befd-3cb711108212/0fd66638cde16859462a6243a4629a50/ndp48-x86-x64-allos-enu.exe", link32 = null, installfile = "setup.exe", installarguments = "/u" });; ListItems.Add(new _itemstructure { name = "Sql Server 2014 express", instaled = sqlCheck.CheckSql2014Ex(), downloaded = false, link64 = (architectureCheck.is64BitOperatingSystem) ? "https://download.microsoft.com/download/E/A/E/EAE6F7FC-767A-4038-A954-49B8B05D04EB/Express%2064BIT/SQLEXPR_x64_ENU.exe" : null, link32 = (!architectureCheck.is64BitOperatingSystem) ? "https://download.microsoft.com/download/E/A/E/EAE6F7FC-767A-4038-A954-49B8B05D04EB/Express%2032BIT/SQLEXPR_x86_ENU.exe" : null, installfile = "setup.exe", installarguments = sb.ToString() }); }
public _SqlInstallClass(TextBlock _sqlInfotxb, TextBlock _sqlStatustxb, ProgressBar _sqlProBar) { infoTxb = _sqlInfotxb; infoTxb.Text = "SQL 2014 EXPRESS"; instaled = new _sqlchecker().CheckSql2014Ex(); link = new _architecturechecker().is64BitOperatingSystem ? "https://download.microsoft.com/download/E/A/E/EAE6F7FC-767A-4038-A954-49B8B05D04EB/Express%2064BIT/SQLEXPR_x64_ENU.exe" : "https://download.microsoft.com/download/E/A/E/EAE6F7FC-767A-4038-A954-49B8B05D04EB/Express%2032BIT/SQLEXPR_x86_ENU.exe"; file = Path.GetTempPath() + Path.GetFileName(new Uri(link).LocalPath); extractFolder = Path.GetTempPath() + "sqlinstallTemp"; extractArgument = "/u /x:" + extractFolder; downloaded = isDownloaded(); statusTxb = _sqlStatustxb; proBar = _sqlProBar; }