/// <summary> /// Method to get a file info if a product is installed /// Exceptions will be captured on the next level /// </summary> /// <param name="fileName"></param> /// <returns></returns> public static Hashtable GetFileInfo(string fileName) { var fileInfo = new Hashtable(); try { FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(fileName); FileInfo fi = new FileInfo(fileName); fileInfo.Add("Name", fi.Name); fileInfo.Add("Version", fvi.FileVersion == null ? "Unknown" : fvi.FileVersion); fileInfo.Add("ModifiedOn", fi.LastWriteTime.ToLocalTime()); fileInfo.Add("Size", fi.Length); return(fileInfo); } catch (Exception ex) { Logger.Error(ex.ToString()); fileInfo.Add("Name", ex.Message); fileInfo.Add("Version", Html.ErrorMsg()); fileInfo.Add("ModifiedOn", Html.ErrorMsg()); fileInfo.Add("Size", Html.ErrorMsg()); } return(fileInfo); }
internal static string IsShunraInstalledFor(string productName) { var output = Html.ErrorMsg(); try { // Prepend Shunra NV for HP to the product name and convert to regex var regexString = @"Shunra\s*NV.*HP\s*" + productName.Replace(" ", @"\s*"); var regex = new Regex(regexString, RegexOptions.IgnoreCase); var p = InstalledProgramsHelper.GetInstalledProgramByName(regex); if (p != null) { output = Html.Yes; GetShunraProductDetails(p); } else { output = Html.No; } } catch (Exception ex) { Logger.Error(ex.ToString()); } return(output); }
/// <summary> /// Method to check if the Operating System is installed on a Virtual Machine /// Currently only 3 products could be discovered. (VMWare, Virtual Box or Microsoft Virtual PC or Hyper-V) /// We obtain the information by using Windows Management Instrumentation calls /// to the Win32_BaseBoard class and get the Manufacturer property which is the /// name of the computer manufacturer. For VirtualBox it is "innotek GmbH", /// for VirtualPC it starts with "Microsoft", for VMware it starts with "VMWare" /// </summary> public static string IsOSVirtualizedInfo() { try { //ManagementObjectSearcher searcher = new ManagementObjectSearcher("root\\CIMV2", "SELECT * FROM Win32_ComputerSystem"); //string manifacturer = null; string manifacturer = Helper.QueryWMI("Manufacturer", "root\\CIMV2", "Win32_ComputerSystem"); //foreach (ManagementObject mo in searcher.Get()) //{ // manifacturer = mo.GetPropertyValue("Manufacturer").ToString(); //} if (manifacturer.StartsWith("innotek")) { return("Yes (Virtual Box detected)"); } else if (manifacturer.StartsWith("Microsoft")) { return("Yes (Micorosft Virtualization detected)"); } else if (manifacturer.StartsWith("VMware")) { return("Yes (VMware detected)"); } return("No (Not detected)"); } catch (Exception ex) { Logger.Error(ex.ToString()); return(Html.ErrorMsg()); } }
/// <summary> /// Get the list of install level service providers /// and put them into a <div></div> element /// </summary> /// <param name="id">the id of the wrapping element</param> /// <returns></returns> public static string GetInstalledLSPs() { try { string output = Helper.ExecuteCMDCommand("netsh winsock show catalog"); StringBuilder info = new StringBuilder(128); // split the output by \r\n char[] delimiter = new Char[] { '\t', '\r', '\n' }; string[] parts = output.Split(delimiter, StringSplitOptions.RemoveEmptyEntries); CultureInfo ci = CultureInfo.CurrentUICulture; string lang = ci.TwoLetterISOLanguageName; Logger.Info("Detected system language: " + lang); //check for English, German or French syntax string description = String.Empty; string provider = String.Empty; switch (lang) { case "fr": description = "Description "; provider = "Chemin d'accŠs fournisseur "; //Chemin d'accŠs fournisseur break; case "de": description = "Beschreibung"; provider = "Anbieterpfad"; break; case "es": description = "Descripci¢n"; provider = "Ruta de proveedor"; break; default: description = "Description"; provider = "Provider Path"; break; } for (int i = 0; i < parts.Length; i++) { if (parts[i].StartsWith(description)) { info.Append("\t\t\t" + Html.B(parts[i].Substring(description.Length + 1))); } if (parts[i].StartsWith(provider)) { info.Append(" provided by " + parts[i].Substring(provider.Length + 1) + Html.br + "\n"); } } return(info.ToString()); } catch (Exception ex) { Logger.Error(ex.ToString()); return(Html.ErrorMsg()); } }
public static string GetSiebelDllVersionInfo() { try { if (ProductDetection.Vugen.IsInstalled) { var filePath = Path.Combine(ProductDetection.Vugen.BinFolder, dllName); if (File.Exists(filePath)) { FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(filePath); return(Html.Yes + ", " + fvi.FileVersion); } else { return(dllName + " not found!"); } } else { return("Vurtual user generator is not installed"); } } catch (Exception ex) { Logger.Error(ex.ToString()); return(Html.ErrorMsg()); } }
/// <summary> /// Converts milliseconds to string /// Citrix session timeout has predified values and it can't be altered unless directly in registry /// </summary> /// <param name="timeout">the timeout value in milliseconds</param> /// <returns>One of the following: Never, 1 Minute, 5 Minutes, 10 Minutes, 15 Minutes, 30 Minutes, 1 Hour, 2 Hours, 3 Hours, 6 Hours, 8 Hours, 12 Hours, 16 Hours, 18 Hours, 1 Day, 2 Days, 3 Days, 4 Days, 5 Days</returns> public static string FormatSessionTimeout(string timeout) { string output = Html.ErrorMsg(); try { TimeSpan ts = TimeSpan.FromMilliseconds(Convert.ToDouble(timeout)); int minutes = ts.Minutes; int hours = ts.Hours; int days = ts.Days; int seconds = ts.Seconds; int mils = ts.Milliseconds; if (minutes == 0 && hours == 0 && days == 0) { return("Never"); } //The msec and seconds value cannot be modified from GUI. //If it was, then return Never plus the modified seconds. if (mils != 0 || seconds != 0) { return("Never (Incorrect value detected " + ts.ToString() + ")"); } if (minutes > 0 && hours == 0 && days == 0) { output = minutes + " Minute"; if (minutes > 1) { output += "s"; } } else if (hours > 0 && minutes == 0 && days == 0) { output = hours + " Hour"; if (hours > 1) { output += "s"; } } else if (days > 0 && minutes == 0 && hours == 0) { output = days + " Day"; if (days > 1) { output += "s"; } } else { output = "Never (Incorrect value detected " + ts.ToString() + ")"; } } catch (Exception ex) { Logger.Error(ex.ToString()); } return(output); }
public static string GetIsSiebelCorrelationEnabledInfo() { StringBuilder output = new StringBuilder(); //TODO load correlations xml only once //use the VugenProtocols.CorrelationRulesEnabledInfo try { if (ProductDetection.Vugen.IsInstalled) { var rule = CorrelationRules.GetRuleByName("AutoDetect_Siebel_Parse_Page", "Siebel"); bool ruleExists = (rule != null && rule.callbackName == "flCorrelationCallbackParseWebPage"); output.Append("Is 'Siebel' group of rules enabled? " + CorrelationRules.IsGroupEnabledText("Siebel") + Html.br); output.Append(@"Is WebSiebel77Correlation.cor applied? " + Html.BoolToYesNo(ruleExists) + Html.br); output.Append("Is WebSiebelSpanningRules.cor applied? " + CorrelationRules.IsGroupEnabledText("Siebel_Spanning") + Html.br); return(output.ToString()); } else { return("Vurtual user generator is not installed"); } } catch (Exception ex) { Logger.Error(ex.ToString()); return(Html.ErrorMsg()); } }
internal static string IsRDPAccessAllowedInfo() { //HKLM\System\CurrentControlSet\Control\Terminal Server\fDenyTSConnections = 1 //HKLM\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp\UserAuthentication = 0 //HKLM\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp\SecurityLayer = 1 var fDenyTSConnections = RegistryWrapper.GetRegKey64(RegHive.LocalMachine, @"System\CurrentControlSet\Control\Terminal Server", "fDenyTSConnections"); var UserAuthentication = RegistryWrapper.GetRegKey64(RegHive.LocalMachine, @"System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp", "UserAuthentication"); var SecurityLayer = RegistryWrapper.GetRegKey64(RegHive.LocalMachine, @"System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp", "SecurityLayer"); if (fDenyTSConnections == null || UserAuthentication == null || SecurityLayer == null) { return(Html.ErrorMsg()); } if (fDenyTSConnections == "1") { return("Connections to this computer are not allowed"); } else { if (UserAuthentication == "0") { return("Connections are allowed from computers running any version of Remote Desktop"); } else { return("Connections are allowed only from computers running Remote Desktop with Network Level Authentication"); } } }
public static string GetUFTInstallationInfo() { try { var qtpi = new QuickTestProInfo(); string output = "No"; if (qtpi.IsInstalled) { if (qtpi.ProductName.Contains("QC Integration")) { var qtp = InstalledProgramsHelper.GetInstalledProgramByName(new Regex("HP Unified Functional Testing")); if (qtp != null) { output = "Yes, " + qtp.DisplayName + " " + qtp.DisplayVersion; } } else { output = Html.BoolToYesNo(qtpi.IsInstalled) + " " + qtpi.ProductName + " " + qtpi.ProductVersion + Helper.ConvertInstallDate(qtpi.InstallDate); } } return(output); } catch (Exception ex) { Logger.Error(ex.ToString()); return(Html.ErrorMsg()); } }
public static string GetIEExtensions() { try { //HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Approved Extensions string keyPath = @"Software\Microsoft\Internet Explorer\Approved Extensions"; RegistryKey regKey = Registry.CurrentUser; regKey = regKey.OpenSubKey(keyPath); String[] subkeyNames = regKey.GetValueNames(); StringBuilder output = new StringBuilder(); foreach (string subKeyName in subkeyNames) { //HKEY_CLASSES_ROOT\Wow6432Node\CLSID\ string extName = RegistryWrapper.GetValue(RegHive.ClassesRoot, @"\CLSID\" + subKeyName, null); if (extName != null) { output.Append(extName + Html.br); } extName = RegistryWrapper.GetValue(RegHive.ClassesRoot, @"\CLSID\" + subKeyName + "\\InprocServer32", null); if (extName != null) { output.Append(" " + extName + Html.br); } } return(output.ToString()); } catch (Exception ex) { Logger.Error(ex.ToString()); return(Html.ErrorMsg()); } }
public static string GetHardDrivesInformation() { try { DriveInfo[] allDrives = DriveInfo.GetDrives(); string driveInfo = null; foreach (DriveInfo d in allDrives) { // get only the fixed drives i.e. no network drives, no cdroms if (d.DriveType.ToString() == "Fixed") { driveInfo += Html.B("Drive: " + d.Name) + Html.br; //driveInfo += "File type: " + d.DriveType + "<br />"; if (d.IsReady == true) { //driveInfo += "Volume label: " + d.VolumeLabel + "<br />"; //driveInfo += "File system: " + d.DriveFormat + "<br />"; //driveInfo += "Free space: " + d.AvailableFreeSpace + " bytes <br />" ; driveInfo += "Total size of drive: " + (Convert.ToInt64(d.TotalSize) / (1024 * 1024)).ToString() + " Mb" + Html.br; driveInfo += "Total available space: " + (Convert.ToInt64(d.TotalFreeSpace) / (1024 * 1024)).ToString() + " Mb" + Html.br; } } } return(driveInfo); } catch (Exception ex) { Logger.Error(ex.ToString()); return(Html.ErrorMsg()); } }
public string GetProductNameVersionDateFormatted() { try { return(Html.BoolToYesNo(IsInstalled) + " " + ProductName + " " + ProductVersion + Helper.ConvertInstallDate(InstallDate)); } catch (Exception ex) { Logger.Error(ex.ToString()); return(Html.ErrorMsg()); } }
public static string GetBPMServiceInfo() { try { var status = Helper.GetServiceStatus(AgentCaption); return(Helper.FormatServiceNameStatus(AgentCaption, status)); } catch (Exception ex) { Logger.Error(ex.ToString()); return(Html.ErrorMsg()); } }
public string GetCitrixRegistryPatchInfo() { try { var not = IsRegistryPatchInstalled() ? "" : "not "; return("Citrix registry patch is " + not + "installed in 32bit registry"); } catch (Exception ex) { Logger.Error(ex.ToString()); return(Html.ErrorMsg()); } }
public static string GetALMPlatformLoaderInfo() { try { var almpl = InstalledProgramsHelper.GetInstalledProgramByName("ALM Platform Loader"); return((almpl != null) ? almpl.ToString() : "No"); } catch (Exception ex) { Logger.Error(ex.ToString()); return(Html.ErrorMsg()); } }
public static string GetFirefoxInfo() { try { InstalledProgram firefox = InstalledProgramsHelper.GetInstalledProgramByName(new Regex("Firefox")); return(firefox == null ? "No" : "Yes, version " + firefox.DisplayVersion); } catch (Exception ex) { Logger.Error(ex.ToString()); return(Html.ErrorMsg()); } }
public static string GetGoogleChromeInfo() { try { InstalledProgram GoogleChrome = InstalledProgramsHelper.GetInstalledProgramByName("Google Chrome"); return(GoogleChrome == null ? "No" : "Yes, version " + GoogleChrome.DisplayVersion); } catch (Exception ex) { Logger.Error(ex.ToString()); return(Html.ErrorMsg()); } }
internal static string GetJavaIniBoolOption(string option) { try { var setting = ini.GetBoolSetting(tabName, option, false); return(Html.BoolToYesNo(setting)); } catch (Exception ex) { Logger.Error(ex.ToString()); return(Html.ErrorMsg() + " " + option + " option"); } }
internal static string GetJavaIniOption(string option) { try { var setting = ini.GetSetting(tabName, option); return(setting.Length < 100 ? setting : Html.AddLinkToHiddenContent(setting.Replace(";", Html.br))); } catch (Exception ex) { Logger.Error(ex.ToString()); return(Html.ErrorMsg() + " " + option + " option"); } }
public static string GetEnvVariable(string variable, bool system = false) { try { variable = system ? Environment.GetEnvironmentVariable(variable, EnvironmentVariableTarget.Machine) : Environment.GetEnvironmentVariable(variable); return((variable != null) ? Html.Semicolon2br(variable) : Html.Warning("Not set!")); } catch (Exception ex) { Logger.Error(ex.ToString()); return(Html.ErrorMsg()); } }
public string GetVTSServiceInfo() { try { var vtsServiceStatus = Helper.GetServiceStatus(vtsAgentCaption); var vtsPort = Helper.GetOpenedPortsForProcessString("node.exe"); return(Helper.FormatServiceNameStatus(vtsAgentCaption, vtsServiceStatus) + vtsPort); } catch (Exception ex) { Logger.Error(ex.ToString()); return(Html.ErrorMsg()); } }
internal static string GetTCIEVersion() { var version = Html.ErrorMsg(); try { var fileName = Path.Combine(ProductDetection.Vugen.DatFolder, @"WebIE\RRE\content\version.txt"); version = File.ReadAllText(fileName); } catch (Exception ex) { Logger.Error(ex.ToString()); } return(version); }
private static string GetGenerateAutoSyncPointsInfo() { try { int index = Convert.ToInt16(ini.GetSetting("CodeGeneration", "GenerateAutoSyncPoints", "1")); string[] settingText = new string[3] { "None", "Rectangular", "Enhanced" }; return(settingText[index]); } catch (Exception ex) { Logger.Error(ex.ToString()); return(Html.ErrorMsg()); } }
private static string GetRdpStartup() { try { var index = Convert.ToInt16(ini.GetSetting("RDP", "Connection", "0")); var settingText = new string[3] { "Run RDP client application", "Use custom connection file" + Html.br + ini.GetSetting("RDP", "FileName"), "Use default connection file" }; return(settingText[index]); } catch (Exception ex) { Logger.Error(ex.ToString()); return(Html.ErrorMsg()); } }
private static string GetCitrixWindowNameOption(string settingName, string tabName) { try { var index = Convert.ToInt16(ini.GetSetting(tabName, settingName, "0")); var settingText = new string[3] { "Use new window name as is", "Use common preffix for the new window names", "Use common suffix for the new window names" }; return(settingText[index]); } catch (Exception ex) { Logger.Error(ex.ToString()); return(Html.ErrorMsg() + " " + settingName + " option"); } }
private string GetLanguagePack() { var output = Html.ErrorMsg(); try { string keyPath = this.ProductRegistryPath + @"CurrentVersion\"; RegistryKey rk = Registry.LocalMachine.OpenSubKey(keyPath); output = rk.GetValue("LanguagePack").ToString(); } catch (Exception ex) { Logger.Warn(ex.ToString()); } return(output); }
/// <summary> /// Check if the virtual memory available to a process is > 2048 /// </summary> /// <returns></returns> public static string Is3GBSwitchEnabled() { if (is64BitOperatingSystem) { return("Not applicable to 64-bit Operating Systems"); } try { int virtualMemory = OSCollectorHelper.GetTotalMemory("Virtual"); return((virtualMemory > 2048) ? "Yes" : "No"); } catch (Exception ex) { Logger.Info(ex.ToString()); return(Html.ErrorMsg()); } }
/// <summary> /// Get the ACL info /// 1. Get the port range from %APPDATA%\Hewlett-Packard\LoadRunner\Data\Settings\VuGenProperties.xml /// 2. Run the 'netsh http show urlacl' command /// 3. Filter the output for the ports from 1. /// </summary> /// <returns></returns> public static string GetUrlAclInfo() { try { StringBuilder output = new StringBuilder(); string commandOutput = Helper.ExecuteCMDCommand("netsh http show urlacl"); output.Append(FilterPorts(commandOutput)); return(output.ToString()); } catch (Exception ex) { Logger.Error(ex.ToString()); return(Html.ErrorMsg()); } }
internal static string GetJavaProducts(string type) { try { StringBuilder sb = new StringBuilder(); var products = (from p in detectJava.installedJavaProducts where p.type == type select p).ToList <JavaProduct>(); foreach (var product in products) { sb.Append(product.ToString() + Html.br); } return(sb.ToString()); } catch (Exception ex) { Logger.Error(ex.ToString()); return(Html.ErrorMsg()); } }
/// <summary> /// CITRIX DETECTION /// </summary> /// <returns></returns> /*public static string GetCitrixClientInfo() * { * try * { * Version v = GetCitrixClientVersion(); * if (v != null) * return "Yes, " + clientName + " " + v; * } * catch (Exception ex) * { * Logger.Error(ex.ToString()); * return null; * } * }*/ /*public static Version GetCitrixClientVersion() * { * try * { * // check if the new Citrix client exists (>11.2) * string citrixClientCode = ProductInfo.GetProductCode("9B123F490B54521479D0EDD389BCACC1"); * if (citrixClientCode == null) * { * // check if the old Citrix client exists (<11.2) * citrixClientCode = ProductInfo.GetProductCode("6D0FA3AFBC48DDC4897D9845832107CE"); * if (citrixClientCode == null) * { * // Try searching in Add/Remove programs * var client = InstalledProgramsHelper.GetInstalledProgramByName(new Regex("Citrix Receiver", RegexOptions.IgnoreCase)); * if (client != null) * return new Version(client.DisplayVersion); * else * return null; * } * } * * string registryPath = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\" + citrixClientCode + @"\InstallProperties"; * string clientName = RegistryWrapper.GetValue(RegHive.LocalMachine, registryPath, "DisplayName"); * string clientVersion = RegistryWrapper.GetValue(RegHive.LocalMachine, registryPath, "DisplayVersion"); * * return new Version(clientVersion); * } * catch (Exception ex) * { * Logger.Error(ex.ToString()); * return null; * } * } * * * public static string GetCitrixRegistryPatchInfo(string productVersion = "11.50") * { * try * { * string virtualChannels = "not null"; * string allowSimulationAPI = String.Empty; * * string keyPath = @"SOFTWARE\Citrix\ICA Client\Engine\Lockdown Profiles\All Regions\Lockdown\Virtual Channels\Third Party\CustomVC"; * virtualChannels = RegistryWrapper.GetValue(RegHive.LocalMachine, keyPath, "VirtualChannels"); * Logger.Info(@"SOFTWARE\Citrix\ICA Client\Engine\Lockdown Profiles\All Regions\Lockdown\Virtual Channels\Third Party\CustomVC\VirtualChannels = " + virtualChannels); * * keyPath = @"SOFTWARE\Citrix\ICA Client\CCM"; * allowSimulationAPI = RegistryWrapper.GetValue(RegHive.LocalMachine, keyPath, "AllowSimulationAPI"); * Logger.Info(@"Key: " + keyPath + "\\AllowSimulationAPI = " + allowSimulationAPI); * * // The below key is available only in LR 11 citrix reg patch * string preApproved = "Default"; * keyPath = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Ext\PreApproved\{238F6F83-B8B4-11CF-8771-00A024541EE3}"; * preApproved = RegistryWrapper.GetValue(RegHive.LocalMachine, keyPath, "(Default)"); * string not = (preApproved == null) ? "not " : ""; * Logger.Warn("The key does " + not + "exist: " + keyPath); * * string warning = String.Empty; * if (productVersion.StartsWith("11.0") && preApproved == null) * warning = "<br />" + Html.Error("The plugin was not found in the list of pre-approved plugins for IE"); * * not = (virtualChannels == "" && allowSimulationAPI == "1") ? "" : "not "; * return "Citrix registry patch is " + not + "installed" + warning; * } * catch (Exception ex) * { * Logger.Error(ex.ToString()); * return Html.ErrorMsg(); * } * } * */ #endregion #region RDP Client Detection /// <summary> /// RDP DETECTION /// </summary> /// <returns></returns> public static string GetRDPClientVersion() { try { string path = Environment.GetEnvironmentVariable("WINDIR").ToString() + @"\system32\"; FileVersionInfo fvi = FileVersionInfo.GetVersionInfo(path + "mstsc.exe"); if (fvi != null) { return(fvi.ProductVersion.ToString()); } return("No RDP client detected"); } catch (Exception ex) { Logger.Error(ex.ToString()); return(Html.ErrorMsg()); } }