示例#1
0
        /// <summary>
        /// Checks whether application pool exists
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        internal static bool ApplicationPoolExists(string name)
        {
            WmiHelper wmi = new WmiHelper("root\\MicrosoftIISv2");

            return(wmi.ExecuteQuery(
                       String.Format("SELECT * FROM IIsApplicationPool WHERE Name='W3SVC/AppPools/{0}'", name)).Count > 0);
        }
示例#2
0
        private static bool IsAspNetRoleServiceInstalled()
        {
            WmiHelper wmi = new WmiHelper("root\\cimv2");

            using (ManagementObjectCollection roles = wmi.ExecuteQuery("SELECT NAME FROM Win32_ServerFeature WHERE ID=148"))
            {
                return(roles.Count > 0);
            }
        }
示例#3
0
        internal static string[] GetIPv4Addresses()
        {
            List <string> list = new List <string>();
            WmiHelper     wmi  = new WmiHelper("root\\cimv2");
            ManagementObjectCollection collection = wmi.ExecuteQuery("SELECT IPAddress FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = 'True'");

            foreach (ManagementObject obj in collection)
            {
                string[] ips = obj["IPAddress"] as string[];
                if (ips != null)
                {
                    foreach (string ip in ips)
                    {
                        if (!list.Contains(ip) && IsValidIPv4(ip))
                        {
                            list.Add(ip);
                        }
                    }
                }
            }
            return(list.ToArray());
        }
示例#4
0
		/// <summary>
		/// Checks whether application pool exists
		/// </summary>
		/// <param name="name"></param>
		/// <returns></returns>
		internal static bool ApplicationPoolExists(string name)
		{
			WmiHelper wmi = new WmiHelper("root\\MicrosoftIISv2");
			return(wmi.ExecuteQuery(
				String.Format("SELECT * FROM IIsApplicationPool WHERE Name='W3SVC/AppPools/{0}'", name)).Count > 0);
		}
示例#5
0
		internal static string[] GetIPv4Addresses()
		{
			List<string> list = new List<string>();
			WmiHelper wmi = new WmiHelper("root\\cimv2");
			ManagementObjectCollection collection = wmi.ExecuteQuery("SELECT IPAddress FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = 'True'");
			foreach (ManagementObject obj in collection)
			{
				string[] ips = obj["IPAddress"] as string[];
				if (ips != null)
				{
					foreach (string ip in ips)
					{
						if (!list.Contains(ip) && IsValidIPv4(ip))
							list.Add(ip);
					}
				}
			}
			return list.ToArray();
		}
		private static bool IsAspNetRoleServiceInstalled()
		{
			WmiHelper wmi = new WmiHelper("root\\cimv2");
			using (ManagementObjectCollection roles = wmi.ExecuteQuery("SELECT NAME FROM Win32_ServerFeature WHERE ID=148"))
			{
				return (roles.Count > 0);
			}
		}