File size: 181,413 Bytes
8c763fb | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747 1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769 1770 1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790 1791 1792 1793 1794 1795 1796 1797 1798 1799 1800 1801 1802 1803 1804 1805 1806 1807 1808 1809 1810 1811 1812 1813 1814 1815 1816 1817 1818 1819 1820 1821 1822 1823 1824 1825 1826 1827 1828 1829 1830 1831 1832 1833 1834 1835 1836 1837 1838 1839 1840 1841 1842 1843 1844 1845 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 2178 2179 2180 2181 2182 2183 2184 2185 2186 2187 2188 2189 2190 2191 2192 2193 2194 2195 2196 2197 2198 2199 2200 2201 2202 2203 2204 2205 2206 2207 2208 2209 2210 2211 2212 2213 2214 2215 2216 2217 2218 2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251 2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272 2273 2274 2275 2276 2277 2278 2279 2280 2281 2282 2283 2284 2285 2286 2287 2288 2289 2290 2291 2292 2293 2294 2295 2296 2297 2298 2299 2300 2301 2302 2303 2304 2305 2306 2307 2308 2309 2310 2311 2312 2313 2314 2315 2316 2317 2318 2319 2320 2321 2322 2323 2324 2325 2326 2327 2328 2329 2330 2331 2332 2333 2334 2335 2336 2337 2338 2339 2340 2341 2342 2343 2344 2345 2346 2347 2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381 2382 2383 2384 2385 2386 2387 2388 2389 2390 2391 2392 2393 2394 2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405 2406 2407 2408 2409 2410 2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442 2443 2444 2445 2446 2447 2448 2449 2450 2451 2452 2453 2454 2455 2456 2457 2458 2459 2460 2461 2462 2463 2464 2465 2466 2467 2468 2469 2470 2471 2472 2473 2474 2475 2476 2477 2478 2479 2480 2481 2482 2483 2484 2485 2486 2487 2488 2489 2490 2491 2492 2493 2494 2495 2496 2497 2498 2499 2500 2501 2502 2503 2504 2505 2506 2507 2508 2509 2510 2511 2512 2513 2514 2515 2516 2517 2518 2519 2520 2521 2522 2523 2524 2525 2526 2527 2528 2529 2530 2531 2532 2533 2534 2535 2536 2537 2538 2539 2540 2541 2542 2543 2544 2545 2546 2547 2548 2549 2550 2551 2552 2553 2554 2555 2556 2557 2558 2559 2560 2561 2562 2563 2564 2565 2566 2567 2568 2569 2570 2571 2572 2573 2574 2575 2576 2577 2578 2579 2580 2581 2582 2583 2584 2585 2586 2587 2588 2589 2590 2591 2592 2593 2594 2595 2596 2597 2598 2599 2600 2601 2602 2603 2604 2605 2606 2607 2608 2609 2610 2611 2612 2613 2614 2615 2616 2617 2618 2619 2620 2621 2622 2623 2624 2625 2626 2627 2628 2629 2630 2631 2632 2633 2634 2635 2636 2637 2638 2639 2640 2641 2642 2643 2644 2645 2646 2647 2648 2649 2650 2651 2652 2653 2654 2655 2656 2657 2658 2659 2660 2661 2662 2663 2664 2665 2666 2667 2668 2669 2670 2671 2672 2673 2674 2675 2676 2677 2678 2679 2680 2681 2682 2683 2684 2685 2686 2687 2688 2689 2690 2691 2692 2693 2694 2695 2696 2697 2698 2699 2700 2701 2702 2703 2704 2705 2706 2707 2708 2709 2710 2711 2712 2713 2714 2715 2716 2717 2718 2719 2720 2721 2722 2723 2724 2725 2726 2727 2728 2729 2730 2731 2732 2733 2734 2735 2736 2737 2738 2739 2740 2741 2742 2743 2744 2745 2746 2747 2748 2749 2750 2751 2752 2753 2754 2755 2756 2757 2758 2759 2760 2761 2762 2763 2764 2765 2766 2767 2768 2769 2770 2771 2772 2773 2774 2775 2776 2777 2778 2779 2780 2781 2782 2783 2784 2785 2786 2787 2788 2789 2790 2791 2792 2793 2794 2795 2796 2797 2798 2799 2800 2801 2802 2803 2804 2805 2806 2807 2808 2809 2810 2811 2812 2813 2814 2815 2816 2817 2818 2819 2820 2821 2822 2823 2824 2825 2826 2827 2828 2829 2830 2831 2832 2833 2834 2835 2836 2837 2838 2839 2840 2841 2842 2843 2844 2845 2846 2847 2848 2849 2850 2851 2852 2853 2854 2855 2856 2857 2858 2859 2860 2861 2862 2863 2864 2865 2866 2867 2868 2869 2870 2871 2872 2873 2874 2875 2876 2877 2878 2879 2880 2881 2882 2883 2884 2885 2886 2887 2888 2889 2890 2891 2892 2893 2894 2895 2896 2897 2898 2899 2900 2901 2902 2903 2904 2905 2906 2907 2908 2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 2932 2933 2934 2935 2936 2937 2938 2939 2940 2941 2942 2943 2944 2945 2946 2947 2948 2949 2950 2951 2952 2953 2954 2955 2956 2957 2958 2959 2960 2961 2962 2963 2964 2965 2966 2967 2968 2969 2970 2971 2972 2973 2974 2975 2976 2977 2978 2979 2980 2981 2982 2983 2984 2985 2986 2987 2988 2989 2990 2991 2992 2993 2994 2995 2996 2997 2998 2999 3000 3001 3002 3003 3004 3005 3006 3007 3008 3009 3010 3011 3012 3013 3014 3015 3016 3017 3018 3019 3020 3021 3022 3023 3024 3025 3026 3027 3028 3029 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 3050 3051 3052 3053 3054 3055 3056 3057 3058 3059 3060 3061 3062 3063 3064 3065 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 3095 3096 3097 3098 3099 3100 3101 3102 3103 3104 3105 3106 3107 3108 3109 3110 3111 3112 3113 3114 3115 3116 3117 3118 3119 3120 3121 3122 3123 3124 3125 3126 3127 3128 3129 3130 3131 3132 3133 3134 3135 3136 3137 3138 3139 3140 3141 3142 3143 3144 3145 3146 3147 3148 3149 3150 3151 3152 3153 3154 3155 3156 3157 3158 3159 3160 3161 3162 3163 3164 3165 3166 3167 3168 3169 3170 3171 3172 3173 3174 3175 3176 3177 3178 3179 3180 3181 3182 3183 3184 3185 3186 3187 3188 3189 3190 3191 3192 3193 3194 3195 3196 3197 3198 3199 3200 3201 3202 3203 3204 3205 3206 3207 3208 3209 3210 3211 3212 3213 3214 3215 3216 3217 3218 3219 3220 3221 3222 3223 3224 3225 3226 3227 3228 3229 3230 3231 3232 3233 3234 3235 3236 3237 3238 3239 3240 3241 3242 3243 3244 3245 3246 3247 3248 3249 3250 3251 3252 3253 3254 3255 3256 3257 3258 3259 3260 3261 3262 3263 3264 3265 3266 3267 3268 3269 3270 3271 3272 3273 3274 3275 3276 3277 3278 3279 3280 3281 3282 3283 3284 3285 3286 3287 3288 3289 3290 3291 3292 3293 3294 3295 3296 3297 3298 3299 3300 3301 3302 3303 3304 3305 3306 3307 3308 3309 3310 3311 3312 3313 3314 3315 3316 3317 3318 3319 3320 3321 3322 3323 3324 3325 3326 3327 3328 3329 3330 3331 3332 3333 3334 3335 3336 3337 3338 3339 3340 3341 3342 3343 3344 3345 3346 3347 3348 3349 3350 3351 3352 3353 3354 3355 3356 3357 3358 3359 3360 3361 3362 3363 3364 3365 3366 3367 3368 3369 3370 3371 3372 3373 3374 3375 3376 3377 3378 3379 3380 3381 3382 3383 3384 3385 3386 3387 3388 3389 3390 3391 3392 3393 3394 3395 3396 3397 3398 3399 3400 3401 3402 3403 3404 3405 3406 3407 3408 3409 3410 3411 3412 3413 3414 3415 3416 3417 3418 3419 3420 3421 3422 3423 3424 3425 3426 3427 3428 3429 3430 3431 3432 3433 3434 3435 3436 3437 3438 3439 3440 3441 3442 3443 3444 3445 3446 3447 3448 3449 3450 3451 3452 3453 3454 3455 3456 3457 3458 3459 3460 3461 3462 3463 3464 3465 3466 3467 3468 3469 3470 3471 3472 3473 3474 3475 3476 3477 3478 3479 3480 3481 3482 3483 3484 3485 3486 3487 3488 3489 3490 3491 3492 3493 3494 3495 3496 3497 3498 3499 3500 3501 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 3526 3527 3528 3529 3530 3531 3532 3533 3534 3535 3536 3537 3538 3539 3540 3541 3542 3543 3544 3545 3546 3547 3548 3549 3550 3551 3552 3553 3554 3555 3556 3557 3558 3559 3560 3561 3562 3563 3564 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 3582 3583 3584 3585 3586 3587 3588 3589 3590 3591 3592 3593 3594 3595 3596 3597 3598 3599 3600 3601 3602 3603 3604 3605 3606 3607 3608 3609 3610 3611 3612 3613 3614 3615 3616 3617 3618 3619 3620 3621 3622 3623 3624 3625 3626 3627 3628 3629 3630 3631 3632 3633 3634 3635 3636 3637 3638 3639 3640 3641 3642 3643 3644 3645 3646 3647 3648 3649 3650 3651 3652 3653 3654 3655 3656 3657 3658 3659 3660 3661 3662 3663 3664 3665 3666 3667 3668 3669 3670 3671 3672 3673 3674 3675 3676 3677 3678 3679 3680 3681 3682 3683 3684 3685 3686 3687 3688 3689 3690 3691 3692 3693 3694 3695 3696 3697 3698 3699 3700 3701 3702 3703 3704 3705 3706 3707 3708 3709 3710 3711 3712 3713 3714 3715 3716 3717 3718 3719 3720 3721 3722 3723 3724 3725 3726 3727 3728 3729 3730 3731 3732 3733 3734 3735 3736 3737 3738 3739 3740 3741 3742 3743 3744 3745 3746 3747 3748 3749 3750 3751 3752 3753 3754 3755 3756 3757 3758 3759 3760 3761 3762 3763 3764 3765 3766 3767 3768 3769 3770 3771 3772 3773 3774 3775 3776 3777 3778 3779 3780 3781 3782 3783 3784 3785 3786 3787 3788 3789 3790 3791 3792 3793 3794 3795 3796 3797 3798 3799 3800 3801 3802 3803 3804 3805 3806 3807 3808 3809 3810 3811 3812 3813 3814 3815 3816 3817 3818 3819 3820 3821 3822 3823 3824 3825 3826 3827 3828 3829 3830 3831 3832 3833 3834 3835 3836 3837 3838 3839 3840 3841 3842 3843 3844 3845 3846 3847 3848 3849 3850 3851 3852 3853 3854 3855 3856 3857 3858 3859 3860 3861 3862 3863 3864 3865 3866 3867 3868 3869 3870 3871 3872 3873 3874 3875 3876 3877 3878 3879 3880 3881 3882 3883 3884 3885 3886 3887 3888 3889 3890 3891 3892 3893 3894 3895 3896 3897 3898 3899 3900 3901 3902 3903 3904 3905 3906 3907 3908 3909 3910 3911 3912 3913 3914 3915 3916 3917 3918 3919 3920 3921 3922 3923 3924 3925 3926 3927 3928 3929 3930 3931 3932 3933 3934 3935 3936 3937 3938 3939 3940 3941 3942 3943 3944 3945 3946 3947 3948 3949 3950 3951 3952 3953 3954 3955 3956 3957 3958 3959 3960 3961 3962 3963 3964 3965 3966 3967 3968 3969 3970 3971 3972 3973 3974 3975 3976 3977 3978 3979 3980 3981 3982 3983 3984 3985 3986 3987 3988 3989 3990 3991 3992 3993 3994 3995 3996 3997 3998 3999 4000 4001 4002 4003 4004 4005 4006 4007 4008 4009 4010 4011 4012 4013 4014 4015 4016 4017 4018 4019 4020 4021 4022 4023 4024 4025 4026 4027 4028 4029 4030 4031 4032 4033 4034 4035 4036 4037 4038 4039 4040 4041 4042 4043 4044 4045 4046 4047 4048 4049 4050 4051 4052 4053 4054 4055 4056 4057 4058 4059 4060 4061 4062 4063 4064 4065 4066 4067 4068 4069 4070 4071 4072 4073 4074 4075 4076 4077 4078 4079 4080 4081 4082 4083 4084 4085 4086 4087 4088 4089 4090 4091 4092 4093 4094 4095 4096 4097 4098 4099 4100 4101 4102 4103 4104 4105 4106 4107 4108 4109 4110 4111 4112 4113 4114 4115 4116 4117 4118 4119 4120 4121 4122 4123 4124 4125 4126 4127 4128 4129 4130 4131 4132 4133 4134 4135 4136 4137 4138 4139 4140 4141 4142 4143 4144 4145 4146 4147 4148 4149 4150 4151 4152 4153 4154 4155 4156 4157 4158 4159 4160 4161 4162 4163 4164 4165 4166 4167 4168 4169 4170 4171 4172 4173 4174 4175 4176 4177 4178 4179 4180 4181 4182 4183 4184 4185 4186 4187 4188 4189 4190 4191 4192 4193 4194 4195 4196 4197 4198 4199 4200 4201 4202 4203 4204 4205 4206 4207 4208 4209 4210 4211 4212 4213 4214 4215 4216 4217 4218 4219 4220 4221 4222 4223 4224 4225 4226 4227 4228 4229 4230 4231 4232 4233 4234 4235 4236 4237 4238 4239 4240 4241 4242 4243 4244 4245 4246 4247 4248 4249 4250 4251 4252 4253 4254 4255 4256 4257 4258 4259 4260 4261 4262 4263 4264 4265 4266 4267 4268 4269 4270 4271 4272 4273 4274 4275 4276 4277 4278 4279 4280 4281 4282 4283 4284 4285 4286 4287 4288 4289 4290 4291 4292 4293 4294 4295 4296 4297 4298 4299 4300 4301 4302 4303 4304 4305 4306 4307 4308 4309 4310 4311 4312 4313 4314 4315 4316 4317 4318 4319 4320 4321 4322 4323 4324 4325 4326 4327 4328 4329 4330 4331 4332 4333 4334 4335 4336 4337 4338 4339 4340 4341 4342 4343 4344 4345 4346 4347 4348 4349 4350 4351 4352 4353 4354 4355 4356 4357 4358 4359 4360 4361 4362 4363 4364 4365 4366 4367 4368 4369 4370 4371 4372 4373 4374 4375 4376 4377 4378 4379 4380 4381 4382 4383 4384 4385 4386 4387 4388 4389 4390 4391 4392 4393 4394 4395 4396 4397 4398 4399 4400 4401 4402 4403 4404 4405 4406 4407 4408 4409 4410 4411 4412 4413 4414 4415 4416 4417 4418 4419 4420 4421 4422 4423 4424 4425 4426 4427 4428 4429 4430 4431 4432 4433 4434 4435 4436 4437 4438 4439 4440 4441 4442 4443 4444 4445 4446 4447 4448 4449 4450 4451 4452 4453 4454 4455 4456 4457 4458 4459 4460 4461 4462 4463 4464 4465 4466 4467 4468 4469 4470 4471 4472 4473 4474 4475 4476 4477 4478 4479 4480 4481 4482 4483 4484 4485 4486 4487 4488 4489 4490 4491 4492 4493 4494 4495 4496 4497 4498 4499 4500 4501 4502 4503 4504 4505 4506 4507 4508 4509 4510 4511 4512 4513 4514 4515 4516 4517 4518 4519 4520 4521 4522 4523 4524 4525 4526 4527 4528 4529 4530 4531 4532 4533 4534 4535 4536 4537 4538 4539 4540 4541 4542 4543 4544 4545 4546 4547 4548 4549 4550 4551 4552 4553 4554 4555 4556 4557 4558 4559 4560 4561 4562 4563 4564 4565 4566 4567 4568 4569 4570 4571 4572 4573 4574 4575 4576 4577 4578 4579 4580 4581 4582 4583 4584 4585 4586 4587 4588 4589 4590 4591 4592 4593 4594 4595 4596 4597 4598 4599 4600 4601 4602 4603 4604 4605 4606 4607 4608 4609 4610 4611 4612 4613 4614 4615 4616 4617 4618 4619 4620 4621 4622 4623 4624 4625 4626 4627 4628 4629 4630 4631 4632 4633 4634 4635 4636 4637 4638 4639 4640 4641 4642 4643 4644 4645 4646 4647 4648 4649 4650 4651 4652 4653 4654 4655 4656 4657 4658 4659 4660 4661 4662 4663 4664 4665 4666 4667 4668 4669 4670 4671 4672 4673 4674 4675 4676 4677 4678 4679 4680 4681 4682 4683 4684 4685 4686 4687 4688 4689 4690 4691 4692 4693 4694 4695 4696 4697 4698 4699 4700 4701 4702 4703 4704 4705 4706 4707 4708 4709 4710 4711 4712 4713 4714 4715 4716 4717 4718 4719 4720 4721 4722 4723 4724 4725 4726 4727 4728 4729 4730 4731 4732 4733 4734 4735 4736 4737 4738 4739 4740 4741 4742 4743 4744 4745 4746 4747 4748 4749 4750 4751 4752 4753 4754 4755 4756 4757 4758 4759 4760 4761 4762 4763 4764 4765 4766 4767 4768 4769 4770 4771 4772 4773 4774 4775 4776 4777 4778 4779 4780 4781 4782 4783 4784 4785 4786 4787 4788 4789 4790 4791 4792 4793 4794 4795 4796 4797 4798 4799 4800 4801 4802 4803 4804 4805 4806 4807 4808 4809 4810 4811 4812 4813 4814 4815 4816 4817 4818 4819 4820 4821 4822 4823 4824 4825 4826 4827 4828 4829 4830 4831 4832 4833 4834 4835 4836 4837 4838 4839 4840 4841 4842 4843 4844 4845 4846 4847 4848 4849 4850 4851 4852 4853 4854 4855 4856 4857 4858 4859 4860 4861 4862 4863 4864 4865 4866 4867 4868 4869 4870 4871 4872 4873 4874 4875 4876 4877 4878 4879 4880 4881 4882 4883 4884 4885 4886 4887 4888 4889 4890 4891 4892 4893 4894 4895 4896 4897 4898 4899 4900 4901 4902 4903 4904 4905 4906 4907 4908 4909 4910 4911 4912 4913 4914 4915 4916 4917 4918 4919 4920 4921 4922 4923 4924 4925 4926 4927 4928 4929 4930 4931 4932 4933 4934 4935 4936 4937 4938 4939 4940 4941 4942 4943 4944 4945 4946 4947 4948 4949 4950 4951 4952 4953 4954 4955 4956 4957 4958 4959 4960 4961 4962 4963 4964 4965 4966 4967 4968 4969 4970 4971 4972 4973 4974 4975 4976 4977 4978 4979 4980 4981 4982 4983 4984 4985 4986 4987 4988 4989 4990 4991 4992 4993 4994 4995 4996 4997 4998 4999 5000 5001 5002 5003 5004 5005 5006 5007 5008 5009 5010 5011 5012 5013 5014 5015 5016 5017 5018 5019 5020 5021 5022 5023 5024 5025 5026 5027 5028 5029 5030 5031 5032 5033 5034 5035 5036 5037 5038 5039 5040 5041 5042 5043 5044 5045 5046 5047 5048 5049 5050 5051 5052 5053 5054 5055 5056 5057 5058 5059 5060 5061 5062 5063 5064 5065 5066 5067 5068 5069 5070 5071 5072 5073 5074 5075 5076 5077 5078 5079 5080 5081 5082 5083 5084 5085 5086 5087 5088 5089 5090 5091 5092 5093 5094 5095 5096 5097 5098 5099 5100 5101 5102 5103 5104 5105 5106 5107 5108 5109 5110 5111 5112 5113 5114 5115 5116 5117 5118 5119 5120 5121 5122 5123 5124 5125 5126 5127 5128 5129 5130 5131 5132 5133 5134 5135 5136 5137 5138 5139 5140 5141 5142 5143 5144 5145 5146 5147 5148 5149 5150 5151 5152 5153 5154 5155 5156 5157 5158 5159 | // Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
#if !UNIX
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Globalization;
using System.Linq.Expressions;
using System.Management.Automation;
using System.Reflection;
using System.Runtime.InteropServices;
using Microsoft.Management.Infrastructure;
using Microsoft.Win32;
namespace Microsoft.PowerShell.Commands
{
using Extensions;
#region GetComputerInfoCommand cmdlet implementation
/// <summary>
/// The Get-ComputerInfo cmdlet gathers and reports information
/// about a computer.
/// </summary>
[Cmdlet(VerbsCommon.Get, "ComputerInfo",
HelpUri = "https://go.microsoft.com/fwlink/?LinkId=2096810")]
[Alias("gin")]
[OutputType(typeof(ComputerInfo), typeof(PSObject))]
public class GetComputerInfoCommand : PSCmdlet
{
#region Inner Types
private sealed class OSInfoGroup
{
public WmiOperatingSystem os;
public HotFix[] hotFixes;
public WmiPageFileUsage[] pageFileUsage;
public string halVersion;
public TimeSpan? upTime;
public RegWinNtCurrentVersion regCurVer;
}
private sealed class SystemInfoGroup
{
public WmiBaseBoard baseboard;
public WmiBios bios;
public WmiComputerSystem computer;
public Processor[] processors;
public NetworkAdapter[] networkAdapters;
}
private sealed class HyperVInfo
{
public bool? Present;
public bool? VMMonitorModeExtensions;
public bool? SecondLevelAddressTranslation;
public bool? VirtualizationFirmwareEnabled;
public bool? DataExecutionPreventionAvailable;
}
private sealed class DeviceGuardInfo
{
public DeviceGuardSmartStatus status;
public DeviceGuard deviceGuard;
}
private sealed class MiscInfoGroup
{
public ulong? physicallyInstalledMemory;
public string timeZone;
public string logonServer;
public FirmwareType? firmwareType;
public PowerPlatformRole? powerPlatformRole;
public WmiKeyboard[] keyboards;
public HyperVInfo hyperV;
public ServerLevel? serverLevel;
public DeviceGuardInfo deviceGuard;
}
#endregion Inner Types
#region Static Data and Constants
private const string activity = "Get-ComputerInfo";
private const string localMachineName = null;
#endregion Static Data and Constants
#region Instance Data
private readonly string _machineName = localMachineName; // we might need to have cmdlet work on another machine
/// <summary>
/// Collection of property names from the Property parameter,
/// including any names resulting from the expansion of wild-card
/// patterns given. This list will itself contain no wildcard patterns.
/// </summary>
private List<string> _namedProperties = null;
#endregion Instance Data
#region Parameters
/// <summary>
/// The Property parameter contains the names of properties to be retrieved.
/// If this parameter is given, the cmdlet returns a PSCustomObject
/// containing only the requested properties.
/// Wild-card patterns may be provided.
/// </summary>
/// <remarks>
/// <para>
/// Any named properties that are not recognized are ignored. If no
/// recognized properties are provided the cmdlet returns an empty
/// PSCustomObject.
/// </para>
/// <para>
/// If a provided wild-card pattern contains only an asterisk ("*"),
/// the cmdlet will operate as if the parameter were not given at all
/// and will return a fully-populated ComputerInfo object.
/// </para>
/// </remarks>
[Parameter(Position = 0,
ValueFromPipeline = true,
ValueFromPipelineByPropertyName = true)]
[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")]
public string[] Property { get; set; }
#endregion Parameters
#region Cmdlet Overrides
/// <summary>
/// Perform any first-stage processing.
/// </summary>
protected override void BeginProcessing()
{
// if the Property parameter was given, determine the requested
// property names
if (Property != null && Property.Length > 0)
{
try
{
_namedProperties = CollectPropertyNames(Property);
}
catch (WildcardPatternException ex)
{
WriteError(new ErrorRecord(ex, "WildcardPattern", ErrorCategory.InvalidArgument, this));
}
}
}
/// <summary>
/// Performs the cmdlet's work.
/// </summary>
protected override void ProcessRecord()
{
// if the user provided property names but no matching properties
// were found, return an empty custom object
if (_namedProperties != null && _namedProperties.Count == 0)
{
WriteObject(new PSObject());
return;
}
MiscInfoGroup miscInfo = null;
var osInfo = new OSInfoGroup();
var systemInfo = new SystemInfoGroup();
var now = DateTime.Now;
using (var session = CimSession.Create(_machineName))
{
UpdateProgress(ComputerInfoResources.LoadingOperationSystemInfo);
osInfo.os = session.GetFirst<WmiOperatingSystem>(CIMHelper.ClassNames.OperatingSystem);
osInfo.pageFileUsage = session.GetAll<WmiPageFileUsage>(CIMHelper.ClassNames.PageFileUsage);
if (osInfo.os != null)
{
osInfo.halVersion = GetHalVersion(session, osInfo.os.SystemDirectory);
if (osInfo.os.LastBootUpTime != null)
osInfo.upTime = now - osInfo.os.LastBootUpTime.Value;
}
UpdateProgress(ComputerInfoResources.LoadingHotPatchInfo);
osInfo.hotFixes = session.GetAll<HotFix>(CIMHelper.ClassNames.HotFix);
UpdateProgress(ComputerInfoResources.LoadingRegistryInfo);
osInfo.regCurVer = RegistryInfo.GetWinNtCurrentVersion();
UpdateProgress(ComputerInfoResources.LoadingBiosInfo);
systemInfo.bios = session.GetFirst<WmiBios>(CIMHelper.ClassNames.Bios);
UpdateProgress(ComputerInfoResources.LoadingMotherboardInfo);
systemInfo.baseboard = session.GetFirst<WmiBaseBoard>(CIMHelper.ClassNames.BaseBoard);
UpdateProgress(ComputerInfoResources.LoadingComputerInfo);
systemInfo.computer = session.GetFirst<WmiComputerSystem>(CIMHelper.ClassNames.ComputerSystem);
miscInfo = GetOtherInfo(session);
UpdateProgress(ComputerInfoResources.LoadingProcessorInfo);
systemInfo.processors = GetProcessors(session);
UpdateProgress(ComputerInfoResources.LoadingNetworkAdapterInfo);
systemInfo.networkAdapters = GetNetworkAdapters(session);
UpdateProgress(null); // close the progress bar
}
var infoOutput = CreateFullOutputObject(systemInfo, osInfo, miscInfo);
if (_namedProperties != null)
{
// var output = CreateCustomOutputObject(namedProperties, systemInfo, osInfo, miscInfo);
var output = CreateCustomOutputObject(infoOutput, _namedProperties);
WriteObject(output);
}
else
{
WriteObject(infoOutput);
}
}
#endregion Cmdlet Overrides
#region Private Methods
/// <summary>
/// Display progress.
/// </summary>
/// <param name="status">
/// Text to be displayed in status bar
/// </param>
private void UpdateProgress(string status)
{
ProgressRecord progress = new(0, activity, status ?? ComputerResources.ProgressStatusCompleted);
progress.RecordType = status == null ? ProgressRecordType.Completed : ProgressRecordType.Processing;
WriteProgress(progress);
}
/// <summary>
/// Retrieves the version of the system's hal.dll.
/// </summary>
/// <param name="session">
/// A <see cref="Microsoft.Management.Infrastructure.CimSession"/> object
/// representing the CIM session to query.
/// </param>
/// <param name="systemDirectory">
/// Path to the system directory, which should contain the hal.dll file.
/// </param>
private static string GetHalVersion(CimSession session, string systemDirectory)
{
string halVersion = null;
try
{
var halPath = CIMHelper.EscapePath(System.IO.Path.Combine(systemDirectory, "hal.dll"));
var query = string.Create(CultureInfo.InvariantCulture, $"SELECT * FROM CIM_DataFile Where Name='{halPath}'");
var instance = session.QueryFirstInstance(query);
if (instance != null)
halVersion = instance.CimInstanceProperties["Version"].Value.ToString();
}
catch (Exception)
{
// On any error, fall through to the return
}
return halVersion;
}
/// <summary>
/// Create an array of <see cref="NetworkAdapter"/> object from values in
/// Win32_NetworkAdapter and Win32_NetworkAdapterConfiguration instances.
/// </summary>
/// <param name="session">
/// A <see cref="Microsoft.Management.Infrastructure.CimSession"/> object representing
/// a CIM session.
/// </param>
/// <returns>
/// An array of NetworkAdapter objects.
/// </returns>
/// <remarks>
/// This method matches network adapters associated network adapter configurations.
/// The returned array contains entries only for matched adapter/configuration objects.
/// </remarks>
private static NetworkAdapter[] GetNetworkAdapters(CimSession session)
{
var adaptersMsft = session.GetAll<WmiMsftNetAdapter>(CIMHelper.MicrosoftNetworkAdapterNamespace, CIMHelper.ClassNames.MicrosoftNetworkAdapter);
var adapters = session.GetAll<WmiNetworkAdapter>(CIMHelper.ClassNames.NetworkAdapter);
var configs = session.GetAll<WmiNetworkAdapterConfiguration>(CIMHelper.ClassNames.NetworkAdapterConfiguration);
var list = new List<NetworkAdapter>();
if (adapters != null && configs != null)
{
var configDict = new Dictionary<uint, WmiNetworkAdapterConfiguration>();
foreach (var config in configs)
{
if (config.Index != null)
configDict[config.Index.Value] = config;
}
if (configDict.Count > 0)
{
foreach (var adapter in adapters)
{
// Only include adapters that have a non-null connection status
// and a non-null index
if (adapter.NetConnectionStatus != null
&& adapter.Index != null)
{
if (configDict.ContainsKey(adapter.Index.Value))
{
var config = configDict[adapter.Index.Value];
var nwAdapter = new NetworkAdapter
{
Description = adapter.Description,
ConnectionID = adapter.NetConnectionID
};
var status = EnumConverter<NetConnectionStatus>.Convert(adapter.NetConnectionStatus);
nwAdapter.ConnectionStatus = status == null ? NetConnectionStatus.Other
: status.Value;
if (nwAdapter.ConnectionStatus == NetConnectionStatus.Connected)
{
nwAdapter.DHCPEnabled = config.DHCPEnabled;
nwAdapter.DHCPServer = config.DHCPServer;
nwAdapter.IPAddresses = config.IPAddress;
}
list.Add(nwAdapter);
}
}
}
}
}
return list.ToArray();
}
/// <summary>
/// Create an array of <see cref="Processor"/> objects, using data acquired
/// from WMI via the Win32_Processor class.
/// </summary>
/// <param name="session"></param>
/// <returns></returns>
private static Processor[] GetProcessors(CimSession session)
{
var processors = session.GetAll<WmiProcessor>(CIMHelper.ClassNames.Processor);
if (processors != null)
{
var list = new List<Processor>();
foreach (var processor in processors)
{
var proc = new Processor();
proc.AddressWidth = processor.AddressWidth;
proc.Architecture = EnumConverter<CpuArchitecture>.Convert(processor.Architecture);
proc.Availability = EnumConverter<CpuAvailability>.Convert(processor.Availability);
proc.CpuStatus = EnumConverter<CpuStatus>.Convert(processor.CpuStatus);
proc.CurrentClockSpeed = processor.CurrentClockSpeed;
proc.DataWidth = processor.DataWidth;
proc.Description = processor.Description;
proc.Manufacturer = processor.Manufacturer;
proc.MaxClockSpeed = processor.MaxClockSpeed;
proc.Name = processor.Name;
proc.NumberOfCores = processor.NumberOfCores;
proc.NumberOfLogicalProcessors = processor.NumberOfLogicalProcessors;
proc.ProcessorID = processor.ProcessorId;
proc.ProcessorType = EnumConverter<ProcessorType>.Convert(processor.ProcessorType);
proc.Role = processor.Role;
proc.SocketDesignation = processor.SocketDesignation;
proc.Status = processor.Status;
list.Add(proc);
}
return list.ToArray();
}
return null;
}
private static bool CheckDeviceGuardLicense()
{
const string propertyName = "CodeIntegrity-AllowConfigurablePolicy";
// DeviceGuard is supported on all versions of PowerShell that execute on "full" SKUs
if (Platform.IsWindows &&
!(Platform.IsNanoServer || Platform.IsIoT))
{
try
{
int policy = 0;
if (Native.SLGetWindowsInformationDWORD(propertyName, out policy) == Native.S_OK
&& policy == 1)
{
return true;
}
}
catch (Exception)
{
// if we fail to load the native dll or if the call fails
// catastrophically there's not much we can do except to
// consider there to be no license.
}
}
return false;
}
/// <summary>
/// Retrieve information related to Device Guard.
/// </summary>
/// <param name="session">
/// A <see cref="Microsoft.Management.Infrastructure.CimSession"/> object representing
/// a CIM session.
/// </param>
/// <returns>
/// A <see cref="DeviceGuard"/> object containing information related to
/// the Device Guard feature
/// </returns>
private static DeviceGuardInfo GetDeviceGuard(CimSession session)
{
DeviceGuard guard = null;
var status = DeviceGuardSmartStatus.Off;
if (CheckDeviceGuardLicense())
{
var wmiGuard = session.GetFirst<WmiDeviceGuard>(CIMHelper.DeviceGuardNamespace,
CIMHelper.ClassNames.DeviceGuard);
if (wmiGuard != null)
{
var smartStatus = EnumConverter<DeviceGuardSmartStatus>.Convert((int?)wmiGuard.VirtualizationBasedSecurityStatus ?? 0);
if (smartStatus != null)
{
status = (DeviceGuardSmartStatus)smartStatus;
}
guard = wmiGuard.AsOutputType;
}
}
return new DeviceGuardInfo
{
status = status,
deviceGuard = guard
};
}
/// <summary>
/// A helper method used by GetHyperVisorInfo to retrieve a boolean
/// property value.
/// </summary>
private static bool? GetBooleanProperty(CimInstance instance, string propertyName)
{
if (instance != null)
{
try
{
var property = instance.CimInstanceProperties[propertyName];
if (property != null && property.Value != null)
return (bool)property.Value;
}
catch (Exception)
{
// just in case the cast fails
// fall through to the null return
}
}
return null;
}
/// <summary>
/// Retrieve information related to HyperVisor.
/// </summary>
/// <param name="session">
/// A <see cref="Microsoft.Management.Infrastructure.CimSession"/> object representing
/// a CIM session.
/// </param>
/// <returns>
/// A <see cref="HyperVInfo"/> object containing information related to
/// HyperVisor
/// </returns>
private static HyperVInfo GetHyperVisorInfo(CimSession session)
{
HyperVInfo info = new();
bool ok = false;
CimInstance instance = null;
using (instance = session.QueryFirstInstance(CIMHelper.WqlQueryAll(CIMHelper.ClassNames.ComputerSystem)))
{
if (instance != null)
{
info.Present = GetBooleanProperty(instance, "HypervisorPresent");
ok = true;
}
}
// don't bother checking requirements if the HyperV in present
// when the HyperV is present, the requirements values are misleading
if (ok && info.Present != null && info.Present.Value)
return info;
using (instance = session.QueryFirstInstance(CIMHelper.WqlQueryAll(CIMHelper.ClassNames.OperatingSystem)))
{
if (instance != null)
{
info.DataExecutionPreventionAvailable = GetBooleanProperty(instance, "DataExecutionPrevention_Available");
ok = true;
}
}
using (instance = session.QueryFirstInstance(CIMHelper.WqlQueryAll(CIMHelper.ClassNames.Processor)))
{
if (instance != null)
{
info.SecondLevelAddressTranslation = GetBooleanProperty(instance, "SecondLevelAddressTranslationExtensions");
info.VirtualizationFirmwareEnabled = GetBooleanProperty(instance, "VirtualizationFirmwareEnabled");
info.VMMonitorModeExtensions = GetBooleanProperty(instance, "VMMonitorModeExtensions");
ok = true;
}
}
return ok ? info : null;
}
/// <summary>
/// Retrieve miscellaneous system information.
/// </summary>
/// <param name="session">
/// A <see cref="Microsoft.Management.Infrastructure.CimSession"/> object representing
/// a CIM session.
/// </param>
/// <returns>
/// A <see cref="MiscInfoGroup"/> object containing miscellaneous
/// system information
/// </returns>
private static MiscInfoGroup GetOtherInfo(CimSession session)
{
var rv = new MiscInfoGroup();
// get platform role
try
{
// TODO: Local machine only. Check for that?
uint powerRole = Native.PowerDeterminePlatformRoleEx(Native.POWER_PLATFORM_ROLE_V2);
if (powerRole >= (uint)PowerPlatformRole.MaximumEnumValue)
rv.powerPlatformRole = PowerPlatformRole.Unspecified;
else
rv.powerPlatformRole = EnumConverter<PowerPlatformRole>.Convert((int)powerRole);
}
catch (Exception)
{
// probably failed to load the DLL with PowerDeterminePlatformRoleEx
// either way, move on
}
// get secure-boot info
// TODO: Local machine only? Check for that?
rv.firmwareType = GetFirmwareType();
// get amount of memory physically installed
// TODO: Local machine only. Check for that?
rv.physicallyInstalledMemory = GetPhysicallyInstalledSystemMemory();
// get time zone
// we'll use .Net's TimeZoneInfo for now. systeminfo uses Caption from Win32_TimeZone
var tzi = TimeZoneInfo.Local;
if (tzi != null)
rv.timeZone = tzi.DisplayName;
rv.logonServer = RegistryInfo.GetLogonServer();
rv.keyboards = session.GetAll<WmiKeyboard>(CIMHelper.ClassNames.Keyboard);
rv.hyperV = GetHyperVisorInfo(session);
var serverLevels = RegistryInfo.GetServerLevels();
uint value;
if (serverLevels.TryGetValue("NanoServer", out value) && value == 1)
{
rv.serverLevel = ServerLevel.NanoServer;
}
else if (serverLevels.TryGetValue("ServerCore", out value) && value == 1)
{
rv.serverLevel = ServerLevel.ServerCore;
if (serverLevels.TryGetValue("Server-Gui-Mgmt", out value) && value == 1)
{
rv.serverLevel = ServerLevel.ServerCoreWithManagementTools;
if (serverLevels.TryGetValue("Server-Gui-Shell", out value) && value == 1)
rv.serverLevel = ServerLevel.FullServer;
}
}
rv.deviceGuard = GetDeviceGuard(session);
return rv;
}
/// <summary>
/// Wrapper around the native GetFirmwareType function.
/// </summary>
/// <returns>
/// null if unsuccessful, otherwise FirmwareType enum specifying
/// the firmware type.
/// </returns>
private static FirmwareType? GetFirmwareType()
{
try
{
FirmwareType firmwareType;
if (Native.GetFirmwareType(out firmwareType))
return firmwareType;
}
catch (Exception)
{
// Probably failed to load the DLL or to file the function entry point.
// Fail silently
}
return null;
}
/// <summary>
/// Wrapper around the native GetPhysicallyInstalledSystemMemory function.
/// </summary>
/// <returns>
/// null if unsuccessful, otherwise the amount of physically installed memory.
/// </returns>
private static ulong? GetPhysicallyInstalledSystemMemory()
{
try
{
ulong memory;
if (Native.GetPhysicallyInstalledSystemMemory(out memory))
return memory;
}
catch (Exception)
{
// Probably failed to load the DLL or to file the function entry point.
// Fail silently
}
return null;
}
/// <summary>
/// Create a new ComputerInfo object populated with the specified data objects.
/// </summary>
/// <param name="systemInfo">
/// A <see cref="SystemInfoGroup"/> object containing system-related info
/// such as BIOS, mother-board, computer system, etc.
/// </param>
/// <param name="osInfo">
/// An <see cref="OSInfoGroup"/> object containing operating-system information.
/// </param>
/// <param name="otherInfo">
/// A <see cref="MiscInfoGroup"/> object containing other information to be reported.
/// </param>
/// <returns>
/// A new ComputerInfo object to be output to PowerShell.
/// </returns>
private static ComputerInfo CreateFullOutputObject(SystemInfoGroup systemInfo, OSInfoGroup osInfo, MiscInfoGroup otherInfo)
{
var output = new ComputerInfo();
var regCurVer = osInfo.regCurVer;
if (regCurVer != null)
{
output.WindowsBuildLabEx = regCurVer.BuildLabEx;
output.WindowsCurrentVersion = regCurVer.CurrentVersion;
output.WindowsEditionId = regCurVer.EditionId;
output.WindowsInstallationType = regCurVer.InstallationType;
output.WindowsInstallDateFromRegistry = regCurVer.InstallDate;
output.WindowsProductId = regCurVer.ProductId;
output.WindowsProductName = regCurVer.ProductName;
output.WindowsRegisteredOrganization = regCurVer.RegisteredOrganization;
output.WindowsRegisteredOwner = regCurVer.RegisteredOwner;
output.WindowsSystemRoot = regCurVer.SystemRoot;
output.WindowsVersion = regCurVer.ReleaseId;
output.WindowsUBR = regCurVer.UBR;
}
var os = osInfo.os;
if (os != null)
{
output.OsName = os.Caption;
output.OsBootDevice = os.BootDevice;
output.OsBuildNumber = os.BuildNumber;
output.OsBuildType = os.BuildType;
output.OsCodeSet = os.CodeSet;
output.OsCountryCode = os.CountryCode;
output.OsCSDVersion = os.CSDVersion;
output.OsCurrentTimeZone = os.CurrentTimeZone;
output.OsDataExecutionPreventionAvailable = os.DataExecutionPrevention_Available;
output.OsDataExecutionPrevention32BitApplications = os.DataExecutionPrevention_32BitApplications;
output.OsDataExecutionPreventionDrivers = os.DataExecutionPrevention_Drivers;
output.OsDataExecutionPreventionSupportPolicy =
EnumConverter<DataExecutionPreventionSupportPolicy>.Convert(os.DataExecutionPrevention_SupportPolicy);
output.OsDebug = os.Debug;
output.OsDistributed = os.Distributed;
output.OsEncryptionLevel = EnumConverter<OSEncryptionLevel>.Convert((int?)os.EncryptionLevel);
output.OsForegroundApplicationBoost = EnumConverter<ForegroundApplicationBoost>.Convert(os.ForegroundApplicationBoost);
output.OsTotalSwapSpaceSize = os.TotalSwapSpaceSize;
output.OsTotalVisibleMemorySize = os.TotalVisibleMemorySize;
output.OsFreePhysicalMemory = os.FreePhysicalMemory;
output.OsFreeSpaceInPagingFiles = os.FreeSpaceInPagingFiles;
output.OsTotalVirtualMemorySize = os.TotalVirtualMemorySize;
output.OsFreeVirtualMemory = os.FreeVirtualMemory;
if (os.TotalVirtualMemorySize != null && os.FreeVirtualMemory != null)
output.OsInUseVirtualMemory = os.TotalVirtualMemorySize - os.FreeVirtualMemory;
output.OsInstallDate = os.InstallDate;
output.OsLastBootUpTime = os.LastBootUpTime;
output.OsLocalDateTime = os.LocalDateTime;
output.OsLocaleID = os.Locale;
output.OsManufacturer = os.Manufacturer;
output.OsMaxNumberOfProcesses = os.MaxNumberOfProcesses;
output.OsMaxProcessMemorySize = os.MaxProcessMemorySize;
output.OsMuiLanguages = os.MUILanguages;
output.OsNumberOfLicensedUsers = os.NumberOfLicensedUsers;
output.OsNumberOfProcesses = os.NumberOfProcesses;
output.OsNumberOfUsers = os.NumberOfUsers;
output.OsOperatingSystemSKU = EnumConverter<OperatingSystemSKU>.Convert((int?)os.OperatingSystemSKU);
output.OsOrganization = os.Organization;
output.OsArchitecture = os.OSArchitecture;
output.OsLanguage = os.LanguageName;
output.OsProductSuites = os.ProductSuites;
output.OsOtherTypeDescription = os.OtherTypeDescription;
output.OsPAEEnabled = os.PAEEnabled;
output.OsPortableOperatingSystem = os.PortableOperatingSystem;
output.OsPrimary = os.Primary;
output.OsProductType = EnumConverter<ProductType>.Convert((int?)os.ProductType);
output.OsRegisteredUser = os.RegisteredUser;
output.OsSerialNumber = os.SerialNumber;
output.OsServicePackMajorVersion = os.ServicePackMajorVersion;
output.OsServicePackMinorVersion = os.ServicePackMinorVersion;
output.OsSizeStoredInPagingFiles = os.SizeStoredInPagingFiles;
output.OsStatus = os.Status;
output.OsSuites = os.Suites;
output.OsSystemDevice = os.SystemDevice;
output.OsSystemDirectory = os.SystemDirectory;
output.OsSystemDrive = os.SystemDrive;
output.OsType = EnumConverter<OSType>.Convert(os.OSType);
output.OsVersion = os.Version;
output.OsWindowsDirectory = os.WindowsDirectory;
output.OsHardwareAbstractionLayer = osInfo.halVersion;
output.OsLocale = os.GetLocale();
output.OsUptime = osInfo.upTime;
output.OsHotFixes = osInfo.hotFixes;
var pageFileUsage = osInfo.pageFileUsage;
if (pageFileUsage != null)
{
output.OsPagingFiles = new string[pageFileUsage.Length];
for (int i = 0; i < pageFileUsage.Length; i++)
output.OsPagingFiles[i] = pageFileUsage[i].Caption;
}
}
var bios = systemInfo.bios;
if (bios != null)
{
output.BiosCharacteristics = bios.BiosCharacteristics;
output.BiosBuildNumber = bios.BuildNumber;
output.BiosBIOSVersion = bios.BIOSVersion;
output.BiosCaption = bios.Caption;
output.BiosCodeSet = bios.CodeSet;
output.BiosCurrentLanguage = bios.CurrentLanguage;
output.BiosDescription = bios.Description;
output.BiosEmbeddedControllerMajorVersion = bios.EmbeddedControllerMajorVersion;
output.BiosEmbeddedControllerMinorVersion = bios.EmbeddedControllerMinorVersion;
output.BiosIdentificationCode = bios.IdentificationCode;
output.BiosInstallableLanguages = bios.InstallableLanguages;
output.BiosInstallDate = bios.InstallDate;
output.BiosLanguageEdition = bios.LanguageEdition;
output.BiosListOfLanguages = bios.ListOfLanguages;
output.BiosManufacturer = bios.Manufacturer;
output.BiosName = bios.Name;
output.BiosOtherTargetOS = bios.OtherTargetOS;
output.BiosPrimaryBIOS = bios.PrimaryBIOS;
output.BiosReleaseDate = bios.ReleaseDate;
output.BiosSerialNumber = bios.SerialNumber;
output.BiosSMBIOSBIOSVersion = bios.SMBIOSBIOSVersion;
output.BiosSMBIOSMajorVersion = bios.SMBIOSMajorVersion;
output.BiosSMBIOSMinorVersion = bios.SMBIOSMinorVersion;
output.BiosSMBIOSPresent = bios.SMBIOSPresent;
output.BiosSoftwareElementState = EnumConverter<SoftwareElementState>.Convert(bios.SoftwareElementState);
output.BiosStatus = bios.Status;
output.BiosSystemBiosMajorVersion = bios.SystemBiosMajorVersion;
output.BiosSystemBiosMinorVersion = bios.SystemBiosMinorVersion;
output.BiosTargetOperatingSystem = bios.TargetOperatingSystem;
output.BiosVersion = bios.Version;
if (otherInfo != null)
output.BiosFirmwareType = otherInfo.firmwareType;
}
var computer = systemInfo.computer;
if (computer != null)
{
output.CsAdminPasswordStatus = EnumConverter<HardwareSecurity>.Convert(computer.AdminPasswordStatus);
output.CsAutomaticManagedPagefile = computer.AutomaticManagedPagefile;
output.CsAutomaticResetBootOption = computer.AutomaticResetBootOption;
output.CsAutomaticResetCapability = computer.AutomaticResetCapability;
output.CsBootOptionOnLimit = EnumConverter<BootOptionAction>.Convert(computer.BootOptionOnLimit);
output.CsBootOptionOnWatchDog = EnumConverter<BootOptionAction>.Convert(computer.BootOptionOnWatchDog);
output.CsBootROMSupported = computer.BootROMSupported;
output.CsBootStatus = computer.BootStatus;
output.CsBootupState = computer.BootupState;
output.CsCaption = computer.Caption;
output.CsChassisBootupState = EnumConverter<SystemElementState>.Convert(computer.ChassisBootupState);
output.CsChassisSKUNumber = computer.ChassisSKUNumber;
output.CsCurrentTimeZone = computer.CurrentTimeZone;
output.CsDaylightInEffect = computer.DaylightInEffect;
output.CsDescription = computer.Description;
output.CsDNSHostName = computer.DNSHostName;
output.CsDomain = computer.Domain;
output.CsDomainRole = EnumConverter<DomainRole>.Convert(computer.DomainRole);
output.CsEnableDaylightSavingsTime = computer.EnableDaylightSavingsTime;
output.CsFrontPanelResetStatus = EnumConverter<HardwareSecurity>.Convert(computer.FrontPanelResetStatus);
output.CsHypervisorPresent = computer.HypervisorPresent;
output.CsInfraredSupported = computer.InfraredSupported;
output.CsInitialLoadInfo = computer.InitialLoadInfo;
output.CsInstallDate = computer.InstallDate;
output.CsKeyboardPasswordStatus = EnumConverter<HardwareSecurity>.Convert(computer.KeyboardPasswordStatus);
output.CsLastLoadInfo = computer.LastLoadInfo;
output.CsManufacturer = computer.Manufacturer;
output.CsModel = computer.Model;
output.CsName = computer.Name;
output.CsNetworkAdapters = systemInfo.networkAdapters;
output.CsNetworkServerModeEnabled = computer.NetworkServerModeEnabled;
output.CsNumberOfLogicalProcessors = computer.NumberOfLogicalProcessors;
output.CsNumberOfProcessors = computer.NumberOfProcessors;
output.CsProcessors = systemInfo.processors;
output.CsOEMStringArray = computer.OEMStringArray;
output.CsPartOfDomain = computer.PartOfDomain;
output.CsPauseAfterReset = computer.PauseAfterReset;
output.CsPCSystemType = EnumConverter<PCSystemType>.Convert(computer.PCSystemType);
output.CsPCSystemTypeEx = EnumConverter<PCSystemTypeEx>.Convert(computer.PCSystemTypeEx);
output.CsPowerManagementCapabilities = computer.GetPowerManagementCapabilities();
output.CsPowerManagementSupported = computer.PowerManagementSupported;
output.CsPowerOnPasswordStatus = EnumConverter<HardwareSecurity>.Convert(computer.PowerOnPasswordStatus);
output.CsPowerState = EnumConverter<PowerState>.Convert(computer.PowerState);
output.CsPowerSupplyState = EnumConverter<SystemElementState>.Convert(computer.PowerSupplyState);
output.CsPrimaryOwnerContact = computer.PrimaryOwnerContact;
output.CsPrimaryOwnerName = computer.PrimaryOwnerName;
output.CsResetCapability = EnumConverter<ResetCapability>.Convert(computer.ResetCapability);
output.CsResetCount = computer.ResetCount;
output.CsResetLimit = computer.ResetLimit;
output.CsRoles = computer.Roles;
output.CsStatus = computer.Status;
output.CsSupportContactDescription = computer.SupportContactDescription;
output.CsSystemFamily = computer.SystemFamily;
output.CsSystemSKUNumber = computer.SystemSKUNumber;
output.CsSystemType = computer.SystemType;
output.CsThermalState = EnumConverter<SystemElementState>.Convert(computer.ThermalState);
output.CsTotalPhysicalMemory = computer.TotalPhysicalMemory;
output.CsUserName = computer.UserName;
output.CsWakeUpType = EnumConverter<WakeUpType>.Convert(computer.WakeUpType);
output.CsWorkgroup = computer.Workgroup;
if (otherInfo != null)
{
output.CsPhysicallyInstalledMemory = otherInfo.physicallyInstalledMemory;
}
}
if (otherInfo != null)
{
output.TimeZone = otherInfo.timeZone;
output.LogonServer = otherInfo.logonServer;
output.PowerPlatformRole = otherInfo.powerPlatformRole;
if (otherInfo.keyboards.Length > 0)
{
// TODO: handle multiple keyboards?
// there might be several keyboards found. For the moment
// we display info for only one
string layout = otherInfo.keyboards[0].Layout;
output.KeyboardLayout = Conversion.GetLocaleName(layout);
}
if (otherInfo.hyperV != null)
{
output.HyperVisorPresent = otherInfo.hyperV.Present;
output.HyperVRequirementDataExecutionPreventionAvailable = otherInfo.hyperV.DataExecutionPreventionAvailable;
output.HyperVRequirementSecondLevelAddressTranslation = otherInfo.hyperV.SecondLevelAddressTranslation;
output.HyperVRequirementVirtualizationFirmwareEnabled = otherInfo.hyperV.VirtualizationFirmwareEnabled;
output.HyperVRequirementVMMonitorModeExtensions = otherInfo.hyperV.VMMonitorModeExtensions;
}
output.OsServerLevel = otherInfo.serverLevel;
var deviceGuardInfo = otherInfo.deviceGuard;
if (deviceGuardInfo != null)
{
output.DeviceGuardSmartStatus = deviceGuardInfo.status;
var deviceGuard = deviceGuardInfo.deviceGuard;
if (deviceGuard != null)
{
output.DeviceGuardRequiredSecurityProperties = deviceGuard.RequiredSecurityProperties;
output.DeviceGuardAvailableSecurityProperties = deviceGuard.AvailableSecurityProperties;
output.DeviceGuardSecurityServicesConfigured = deviceGuard.SecurityServicesConfigured;
output.DeviceGuardSecurityServicesRunning = deviceGuard.SecurityServicesRunning;
output.DeviceGuardCodeIntegrityPolicyEnforcementStatus = deviceGuard.CodeIntegrityPolicyEnforcementStatus;
output.DeviceGuardUserModeCodeIntegrityPolicyEnforcementStatus = deviceGuard.UserModeCodeIntegrityPolicyEnforcementStatus;
}
}
}
return output;
}
/// <summary>
/// Create a new PSObject, containing only those properties named in the
/// namedProperties parameter.
/// </summary>
/// <param name="info">
/// A <see cref="ComputerInfo"/> containing all the acquired system information
/// </param>
/// <param name="namedProperties">
/// A list of property names to be included in the returned object
/// </param>
/// <returns>
/// A new PSObject with the properties specified in the <paramref name="namedProperties"/>
/// parameter
/// </returns>
private static PSObject CreateCustomOutputObject(ComputerInfo info, List<string> namedProperties)
{
var rv = new PSObject();
if (info != null && namedProperties != null && namedProperties.Count > 0)
{
// Walk the list of named properties, find a matching property in the
// info object, and create a new property on the results object
// with the associated value.
var type = info.GetType();
foreach (var propertyName in namedProperties)
{
var propInfo = type.GetProperty(propertyName, BindingFlags.Public | BindingFlags.Instance);
if (propInfo != null)
{
object value = propInfo.GetValue(info);
rv.Properties.Add(new PSNoteProperty(propertyName, value));
}
}
}
return rv;
}
/// <summary>
/// Get the names of all <see cref="ComputerInfo"/> properties. This is
/// part of the processes of validating property names provided by the user.
/// </summary>
/// <returns></returns>
private static List<string> GetComputerInfoPropertyNames()
{
var rv = new List<string>();
var type = typeof(ComputerInfo);
foreach (var prop in type.GetProperties(BindingFlags.Public | BindingFlags.Instance))
rv.Add(prop.Name);
return rv;
}
/// <summary>
/// Expand any wild-card patterns into known property names.
/// </summary>
/// <param name="propertyNames">
/// List of known property names
/// </param>
/// <param name="pattern">
/// The wild-card pattern used to perform globbing
/// </param>
/// <returns></returns>
private static List<string> ExpandWildcardPropertyNames(List<string> propertyNames, string pattern)
{
var rv = new List<string>();
var wcp = new WildcardPattern(pattern, WildcardOptions.Compiled | WildcardOptions.IgnoreCase);
foreach (var name in propertyNames)
if (wcp.IsMatch(name))
rv.Add(name);
return rv;
}
/// <summary>
/// Produce a list of known, valid property names from property-name
/// parameters. These parameter may use wild-card patterns and may
/// contain invalid property names. This method expands wild-card
/// patterns and filter out any invalid property names.
/// </summary>
/// <param name="requestedProperties"></param>
/// <returns>
/// </returns>
private static List<string> CollectPropertyNames(string[] requestedProperties)
{
// A quick scan through the requested properties to make sure
// we want to use user-specified properties
foreach (var name in requestedProperties)
{
if (WildcardPattern.ContainsWildcardCharacters(name))
{
if (name == "*")
return null; // we treat a wild-card pattern of "*" as if no properties were named
}
}
var availableProperties = GetComputerInfoPropertyNames();
var rv = new List<string>();
// walk though the requested properties again, expanding and collecting property names
foreach (var name in requestedProperties)
{
if (WildcardPattern.ContainsWildcardCharacters(name))
{
foreach (var matchedName in ExpandWildcardPropertyNames(availableProperties, name))
if (!rv.Contains(matchedName))
rv.Add(matchedName);
}
else
{
// find a matching property name via case-insensitive string comparison
Predicate<string> pred = (s) =>
{
return string.Equals(s,
name,
StringComparison.OrdinalIgnoreCase);
};
var propertyName = availableProperties.Find(pred);
// add the properly-cased name, if found, to the list
if (propertyName != null && !rv.Contains(propertyName))
rv.Add(propertyName);
}
}
return rv;
}
#endregion Private Methods
}
#endregion GetComputerInfoCommand cmdlet implementation
#region Helper classes
internal static class Conversion
{
/// <summary>
/// Attempt to convert a string representation of a base-16 value
/// into an integer.
/// </summary>
/// <param name="hexString">
/// A string containing the text to be parsed.
/// </param>
/// <param name="value">
/// An integer into which the parsed value is stored. If the string
/// cannot be converted, this parameter is set to 0.
/// </param>
/// <returns>
/// Returns true if the conversion was successful, false otherwise.
/// </returns>
/// <remarks>
/// The hexString parameter must contain a hexadecimal value, with no
/// base-indication prefix. For example, the string "0409" will be
/// parsed into the base-10 integer value 1033, while the string "0x0409"
/// will fail to parse due to the "0x" base-indication prefix.
/// </remarks>
internal static bool TryParseHex(string hexString, out uint value)
{
try
{
value = Convert.ToUInt32(hexString, 16);
return true;
}
catch (Exception)
{
value = 0;
return false;
}
}
/// <summary>
/// Attempt to create a <see cref="System.Globalization.CultureInfo"/>
/// object from a locale string as retrieved from WMI.
/// </summary>
/// <param name="locale">
/// A string containing WMI's notion (usually) of a locale.
/// </param>
/// <returns>
/// A CultureInfo object if successful, null otherwise.
/// </returns>
/// <remarks>
/// This method first tries to convert the string to a hex value
/// and get the CultureInfo object from that value.
/// Failing that it attempts to retrieve the CultureInfo object
/// using the locale string as passed.
/// </remarks>
internal static string GetLocaleName(string locale)
{
CultureInfo culture = null;
if (locale != null)
{
try
{
// The "locale" must contain a hexadecimal value, with no
// base-indication prefix. For example, the string "0409" will be
// parsed into the base-10 integer value 1033, while the string "0x0409"
// will fail to parse due to the "0x" base-indication prefix.
if (uint.TryParse(locale, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out uint localeNum))
{
culture = CultureInfo.GetCultureInfo((int)localeNum);
}
// If TryParse failed we'll try using the original string as culture name
culture ??= CultureInfo.GetCultureInfo(locale);
}
catch (Exception)
{
culture = null;
}
}
return culture?.Name;
}
/// <summary>
/// Convert a Unix time, expressed in seconds, to a <see cref="DateTime"/>.
/// </summary>
/// <param name="seconds">Number of seconds since the Unix epoch.</param>
/// <returns>
/// A DateTime object representing the date and time represented by the
/// <paramref name="seconds"/> parameter.
/// </returns>
internal static DateTime UnixSecondsToDateTime(long seconds)
{
#if false // requires .NET 4.6 or higher
return DateTimeOffset.FromUnixTimeSeconds(seconds).DateTime;
#else
const int DaysPerYear = 365;
const int DaysPer4Years = DaysPerYear * 4 + 1;
const int DaysPer100Years = DaysPer4Years * 25 - 1;
const int DaysPer400Years = DaysPer100Years * 4 + 1;
const int DaysTo1970 = DaysPer400Years * 4 + DaysPer100Years * 3 + DaysPer4Years * 17 + DaysPerYear;
const long UnixEpochTicks = TimeSpan.TicksPerDay * DaysTo1970;
long ticks = seconds * TimeSpan.TicksPerSecond + UnixEpochTicks;
return new DateTimeOffset(ticks, TimeSpan.Zero).DateTime;
#endif
}
}
/// <summary>
/// The EnumConverter<typeparamref name="T"/> class contains a method
/// for converting an integer to a nullable enum of the type specified
/// in T.
/// </summary>
/// <typeparam name="T">
/// The type of enum to be the destination of the conversion.
/// </typeparam>
internal static class EnumConverter<T> where T : struct, IConvertible
{
// The converter object
private static readonly Func<int, T?> s_convert = MakeConverter();
/// <summary>
/// Convert an integer to a Nullable enum of type T.
/// </summary>
/// <param name="value">
/// The integer value to be converted to the specified enum type.
/// </param>
/// <returns>
/// A Nullable<typeparamref name="T"/> enum object. If the value
/// is convertible to a valid enum value, the returned object's
/// value will contain the converted value, otherwise the returned
/// object will be null.
/// </returns>
internal static T? Convert(int? value)
{
try
{
if (value.HasValue)
return s_convert(value.Value);
}
catch (Exception)
{
// nothing should go wrong, but just in case
// fall through to the return null below
}
return (T?)null;
}
/// <summary>
/// Create a converter using Linq Expression classes.
/// </summary>
/// <returns>
/// A generic Func{} object to convert an int to the specified enum type.
/// </returns>
internal static Func<int, T?> MakeConverter()
{
var param = Expression.Parameter(typeof(int));
var method = Expression.Lambda<Func<int, T?>>
(Expression.Convert(param, typeof(T?)), param);
return method.Compile();
}
}
internal static class RegistryInfo
{
public static Dictionary<string, uint> GetServerLevels()
{
const string keyPath = @"Software\Microsoft\Windows NT\CurrentVersion\Server\ServerLevels";
var rv = new Dictionary<string, uint>();
using (var key = Registry.LocalMachine.OpenSubKey(keyPath))
{
if (key != null)
{
foreach (var name in key.GetValueNames())
{
if (key.GetValueKind(name) == RegistryValueKind.DWord)
{
var val = key.GetValue(name);
rv.Add(name, Convert.ToUInt32(val));
}
}
}
}
return rv;
}
public static string GetLogonServer()
{
const string valueName = "LOGONSERVER";
const string keyPath = "Volatile Environment";
using (var key = Registry.CurrentUser.OpenSubKey(keyPath))
{
if (key != null)
return (string)key.GetValue(valueName, null);
}
return null;
}
public static RegWinNtCurrentVersion GetWinNtCurrentVersion()
{
using (var key = Registry.LocalMachine.OpenSubKey(@"Software\Microsoft\Windows NT\CurrentVersion"))
{
if (key != null)
{
object temp = key.GetValue("InstallDate");
return new RegWinNtCurrentVersion()
{
BuildLabEx = (string)key.GetValue("BuildLabEx"),
CurrentVersion = (string)key.GetValue("CurrentVersion"),
EditionId = (string)key.GetValue("EditionID"),
InstallationType = (string)key.GetValue("InstallationType"),
InstallDate = temp == null ? (DateTime?)null
: Conversion.UnixSecondsToDateTime((long)(int)temp),
ProductId = (string)key.GetValue("ProductId"),
ProductName = (string)key.GetValue("ProductName"),
RegisteredOrganization = (string)key.GetValue("RegisteredOrganization"),
RegisteredOwner = (string)key.GetValue("RegisteredOwner"),
SystemRoot = (string)key.GetValue("SystemRoot"),
ReleaseId = (string)key.GetValue("ReleaseId"),
UBR = (int?)key.GetValue("UBR")
};
}
}
return null;
}
}
#endregion Helper classes
#region Intermediate WMI classes
/// <summary>
/// Base class for some of the other Intermediate WMI classes,
/// providing some shared methods.
/// </summary>
internal abstract class WmiClassBase
{
/// <summary>
/// Get a language name from a language identifier.
/// </summary>
/// <param name="lcid">
/// A nullable integer containing the language ID for the desired language.
/// </param>
/// <returns>
/// A string containing the display name of the language identified by
/// the language parameter. If the language parameter is null or has a
/// value that is not a valid language ID, the method returns null.
/// </returns>
protected static string GetLanguageName(uint? lcid)
{
if (lcid != null && lcid >= 0)
{
try
{
return CultureInfo.GetCultureInfo((int)lcid.Value).Name;
}
catch
{
}
}
return null;
}
}
#pragma warning disable 649 // fields and properties in these class are assigned dynamically
[SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses", Justification = "Class is instantiated directly from a CIM instance")]
internal sealed class WmiBaseBoard
{
public string Caption;
public string[] ConfigOptions;
public float? Depth;
public string Description;
public float? Height;
public bool? HostingBoard;
public bool? HotSwappable;
public DateTime? InstallDate;
public string Manufacturer;
public string Model;
public string Name;
public string OtherIdentifyingInfo;
public string PartNumber;
public bool? PoweredOn;
public string Product;
public bool? Removable;
public bool? Replaceable;
public string RequirementsDescription;
public bool? RequiresDaughterBoard;
public string SerialNumber;
public string SKU;
public string SlotLayout;
public bool? SpecialRequirements;
public string Status;
public string Tag;
public string Version;
public float? Weight;
public float? Width;
}
[SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses", Justification = "Class is instantiated directly from a CIM instance")]
internal sealed class WmiBios : WmiClassBase
{
public ushort[] BiosCharacteristics;
public string[] BIOSVersion;
public string BuildNumber;
public string Caption;
public string CodeSet;
public string CurrentLanguage;
public string Description;
public byte? EmbeddedControllerMajorVersion;
public byte? EmbeddedControllerMinorVersion;
public string IdentificationCode;
public ushort? InstallableLanguages;
public DateTime? InstallDate;
public string LanguageEdition;
public string[] ListOfLanguages;
public string Manufacturer;
public string Name;
public string OtherTargetOS;
public bool? PrimaryBIOS;
public DateTime? ReleaseDate;
public string SerialNumber;
public string SMBIOSBIOSVersion;
public ushort? SMBIOSMajorVersion;
public ushort? SMBIOSMinorVersion;
public bool? SMBIOSPresent;
public ushort? SoftwareElementState;
public string Status;
public byte? SystemBiosMajorVersion;
public byte? SystemBiosMinorVersion;
public ushort? TargetOperatingSystem;
public string Version;
}
[SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses", Justification = "Class is instantiated directly from a CIM instance")]
internal sealed class WmiComputerSystem
{
public ushort? AdminPasswordStatus;
public bool? AutomaticManagedPagefile;
public bool? AutomaticResetBootOption;
public bool? AutomaticResetCapability;
public ushort? BootOptionOnLimit;
public ushort? BootOptionOnWatchDog;
public bool? BootROMSupported;
public string BootupState;
public ushort[] BootStatus;
public string Caption;
public ushort? ChassisBootupState;
public string ChassisSKUNumber;
public short? CurrentTimeZone;
public bool? DaylightInEffect;
public string Description;
public string DNSHostName;
public string Domain;
public ushort? DomainRole;
public bool? EnableDaylightSavingsTime;
public ushort? FrontPanelResetStatus;
public bool? HypervisorPresent;
public bool? InfraredSupported;
public string InitialLoadInfo;
public DateTime? InstallDate;
public ushort? KeyboardPasswordStatus;
public string LastLoadInfo;
public string Manufacturer;
public string Model;
public string Name;
public bool? NetworkServerModeEnabled;
public uint? NumberOfLogicalProcessors;
public uint? NumberOfProcessors;
public string[] OEMStringArray;
public bool? PartOfDomain;
public long? PauseAfterReset;
public ushort? PCSystemType;
public ushort? PCSystemTypeEx;
public ushort[] PowerManagementCapabilities;
public bool? PowerManagementSupported;
public ushort? PowerOnPasswordStatus;
public ushort? PowerState;
public ushort? PowerSupplyState;
public string PrimaryOwnerContact;
public string PrimaryOwnerName;
public ushort? ResetCapability;
public short? ResetCount;
public short? ResetLimit;
public string[] Roles;
public string Status;
public string[] SupportContactDescription;
public string SystemFamily;
public string SystemSKUNumber;
public string SystemType;
public ushort? ThermalState;
public ulong? TotalPhysicalMemory;
public string UserName;
public ushort? WakeUpType;
public string Workgroup;
public PowerManagementCapabilities[] GetPowerManagementCapabilities()
{
if (PowerManagementCapabilities != null)
{
var list = new List<PowerManagementCapabilities>();
foreach (var cap in PowerManagementCapabilities)
{
var val = EnumConverter<PowerManagementCapabilities>.Convert(cap);
if (val != null)
list.Add(val.Value);
}
return list.ToArray();
}
return null;
}
}
[SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses", Justification = "Class is instantiated directly from a CIM instance")]
internal sealed class WmiDeviceGuard
{
public uint[] AvailableSecurityProperties;
public uint? CodeIntegrityPolicyEnforcementStatus;
public uint? UsermodeCodeIntegrityPolicyEnforcementStatus;
public uint[] RequiredSecurityProperties;
public uint[] SecurityServicesConfigured;
public uint[] SecurityServicesRunning;
public uint? VirtualizationBasedSecurityStatus;
public DeviceGuard AsOutputType
{
get
{
var guard = new DeviceGuard();
var status = EnumConverter<DeviceGuardSmartStatus>.Convert((int?)VirtualizationBasedSecurityStatus);
if (status != null && status != DeviceGuardSmartStatus.Off)
{
var listHardware = new List<DeviceGuardHardwareSecure>();
for (int i = 0; i < RequiredSecurityProperties.Length; i++)
{
var temp = EnumConverter<DeviceGuardHardwareSecure>.Convert((int?)RequiredSecurityProperties[i]);
if (temp != null)
listHardware.Add(temp.Value);
}
guard.RequiredSecurityProperties = listHardware.ToArray();
listHardware.Clear();
for (int i = 0; i < AvailableSecurityProperties.Length; i++)
{
var temp = EnumConverter<DeviceGuardHardwareSecure>.Convert((int?)AvailableSecurityProperties[i]);
if (temp != null)
listHardware.Add(temp.Value);
}
guard.AvailableSecurityProperties = listHardware.ToArray();
var listSoftware = new List<DeviceGuardSoftwareSecure>();
for (int i = 0; i < SecurityServicesConfigured.Length; i++)
{
var temp = EnumConverter<DeviceGuardSoftwareSecure>.Convert((int?)SecurityServicesConfigured[i]);
if (temp != null)
listSoftware.Add(temp.Value);
}
guard.SecurityServicesConfigured = listSoftware.ToArray();
listSoftware.Clear();
for (int i = 0; i < SecurityServicesRunning.Length; i++)
{
var temp = EnumConverter<DeviceGuardSoftwareSecure>.Convert((int?)SecurityServicesRunning[i]);
if (temp != null)
listSoftware.Add(temp.Value);
}
guard.SecurityServicesRunning = listSoftware.ToArray();
}
var configCiStatus = EnumConverter<DeviceGuardConfigCodeIntegrityStatus>.Convert((int?)CodeIntegrityPolicyEnforcementStatus);
var userModeCiStatus = EnumConverter<DeviceGuardConfigCodeIntegrityStatus>.Convert((int?)UsermodeCodeIntegrityPolicyEnforcementStatus);
guard.CodeIntegrityPolicyEnforcementStatus = configCiStatus;
guard.UserModeCodeIntegrityPolicyEnforcementStatus = userModeCiStatus;
return guard;
}
}
}
[SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses", Justification = "Class is instantiated directly from a CIM instance")]
internal sealed class WmiKeyboard
{
public ushort? Availability;
public string Caption;
public uint? ConfigManagerErrorCode;
public bool? ConfigManagerUserConfig;
public string Description;
public string DeviceID;
public bool? ErrorCleared;
public string ErrorDescription;
public DateTime? InstallDate;
public bool? IsLocked;
public uint? LastErrorCode;
public string Layout;
public string Name;
public ushort? NumberOfFunctionKeys;
public ushort? Password;
public string PNPDeviceID;
public ushort[] PowerManagementCapabilities;
public bool? PowerManagementSupported;
public string Status;
public ushort? StatusInfo;
public string SystemCreationClassName;
public string SystemName;
}
[SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses", Justification = "Class is instantiated directly from a CIM instance")]
internal sealed class WMiLogicalMemory
{
// TODO: fill this in!!!
public uint? TotalPhysicalMemory;
}
[SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses", Justification = "Class is instantiated directly from a CIM instance")]
internal sealed class WmiMsftNetAdapter
{
public string Caption;
public string Description;
public DateTime? InstallDate;
public string Name;
public string Status;
public ushort? Availability;
public uint? ConfigManagerErrorCode;
public bool? ConfigManagerUserConfig;
public string DeviceID;
public bool? ErrorCleared;
public string ErrorDescription;
public uint? LastErrorCode;
public string PNPDeviceID;
public ushort[] PowerManagementCapabilities;
public bool? PowerManagementSupported;
public ushort? StatusInfo;
public string SystemCreationClassName;
public string SystemName;
public ulong? Speed;
public ulong? MaxSpeed;
public ulong? RequestedSpeed;
public ushort? UsageRestriction;
public ushort? PortType;
public string OtherPortType;
public string OtherNetworkPortType;
public ushort? PortNumber;
public ushort? LinkTechnology;
public string OtherLinkTechnology;
public string PermanentAddress;
public string[] NetworkAddresses;
public bool? FullDuplex;
public bool? AutoSense;
public ulong? SupportedMaximumTransmissionUnit;
public ulong? ActiveMaximumTransmissionUnit;
public string InterfaceDescription;
public string InterfaceName;
public ulong? NetLuid;
public string InterfaceGuid;
public uint? InterfaceIndex;
public string DeviceName;
public uint? NetLuidIndex;
public bool? Virtual;
public bool? Hidden;
public bool? NotUserRemovable;
public bool? IMFilter;
public uint? InterfaceType;
public bool? HardwareInterface;
public bool? WdmInterface;
public bool? EndPointInterface;
public bool? iSCSIInterface;
public uint? State;
public uint? NdisMedium;
public uint? NdisPhysicalMedium;
public uint? InterfaceOperationalStatus;
public bool? OperationalStatusDownDefaultPortNotAuthenticated;
public bool? OperationalStatusDownMediaDisconnected;
public bool? OperationalStatusDownInterfacePaused;
public bool? OperationalStatusDownLowPowerState;
public uint? InterfaceAdminStatus;
public uint? MediaConnectState;
public uint? MtuSize;
public ushort? VlanID;
public ulong? TransmitLinkSpeed;
public ulong? ReceiveLinkSpeed;
public bool? PromiscuousMode;
public bool? DeviceWakeUpEnable;
public bool? ConnectorPresent;
public uint? MediaDuplexState;
public string DriverDate;
public ulong? DriverDateData;
public string DriverVersionString;
public string DriverName;
public string DriverDescription;
public ushort? MajorDriverVersion;
public ushort? MinorDriverVersion;
public byte? DriverMajorNdisVersion;
public byte? DriverMinorNdisVersion;
public string PnPDeviceID;
public string DriverProvider;
public string ComponentID;
public uint[] LowerLayerInterfaceIndices;
public uint[] HigherLayerInterfaceIndices;
public bool? AdminLocked;
}
[SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses", Justification = "Class is instantiated directly from a CIM instance")]
internal sealed class WmiNetworkAdapter
{
public string AdapterType;
public ushort? AdapterTypeID;
public bool? AutoSense;
public ushort? Availability;
public string Caption;
public uint? ConfigManagerErrorCode;
public bool? ConfigManagerUserConfig;
public string Description;
public string DeviceID;
public bool? ErrorCleared;
public string ErrorDescription;
public string GUID;
public uint? Index;
public DateTime? InstallDate;
public bool? Installed;
public uint? InterfaceIndex;
public uint? LastErrorCode;
public string MACAddress;
public string Manufacturer;
public uint? MaxNumberControlled;
public ulong? MaxSpeed;
public string Name;
public string NetConnectionID;
public ushort? NetConnectionStatus;
public bool? NetEnabled;
public string[] NetworkAddresses;
public string PermanentAddress;
public bool? PhysicalAdapter;
public string PNPDeviceID;
public ushort[] PowerManagementCapabilities;
public bool? PowerManagementSupported;
public string ProductName;
public string ServiceName;
public ulong? Speed;
public string Status;
public ushort? StatusInfo;
public string SystemCreationClassName;
public string SystemName;
public DateTime? TimeOfLastReset;
}
[SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses", Justification = "Class is instantiated directly from a CIM instance")]
internal sealed class WmiNetworkAdapterConfiguration
{
public bool? ArpAlwaysSourceRoute;
public bool? ArpUseEtherSNAP;
public string Caption;
public string DatabasePath;
public bool? DeadGWDetectEnabled;
public string[] DefaultIPGateway;
public byte? DefaultTOS;
public byte? DefaultTTL;
public string Description;
public bool? DHCPEnabled;
public DateTime? DHCPLeaseExpires;
public DateTime? DHCPLeaseObtained;
public string DHCPServer;
public string DNSDomain;
public string[] DNSDomainSuffixSearchOrder;
public bool? DNSEnabledForWINSResolution;
public string DNSHostName;
public string[] DNSServerSearchOrder;
public bool? DomainDNSRegistrationEnabled;
public uint? ForwardBufferMemory;
public bool? FullDNSRegistrationEnabled;
public ushort[] GatewayCostMetric;
public byte? IGMPLevel;
public uint? Index;
public uint? InterfaceIndex;
public string[] IPAddress;
public uint? IPConnectionMetric;
public bool? IPEnabled;
public bool? IPFilterSecurityEnabled;
public bool? IPPortSecurityEnabled;
public string[] IPSecPermitIPProtocols;
public string[] IPSecPermitTCPPorts;
public string[] IPSecPermitUDPPorts;
public string[] IPSubnet;
public bool? IPUseZeroBroadcast;
public string IPXAddress;
public bool? IPXEnabled;
public uint[] IPXFrameType;
public uint? IPXMediaType;
public string[] IPXNetworkNumber;
public string IPXVirtualNetNumber;
public uint? KeepAliveInterval;
public uint? KeepAliveTime;
public string MACAddress;
public uint? MTU;
public uint? NumForwardPackets;
public bool? PMTUBHDetectEnabled;
public bool? PMTUDiscoveryEnabled;
public string ServiceName;
public string SettingID;
public uint? TcpipNetbiosOptions;
public uint? TcpMaxConnectRetransmissions;
public uint? TcpMaxDataRetransmissions;
public uint? TcpNumConnections;
public bool? TcpUseRFC1122UrgentPointer;
public ushort? TcpWindowSize;
public bool? WINSEnableLMHostsLookup;
public string WINSHostLookupFile;
public string WINSPrimaryServer;
public string WINSScopeID;
public string WINSSecondaryServer;
}
[SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses", Justification = "Class is instantiated directly from a CIM instance")]
internal sealed class WmiOperatingSystem : WmiClassBase
{
#region Fields
public string BootDevice;
public string BuildNumber;
public string BuildType;
public string Caption;
public string CodeSet;
public string CountryCode;
public string CSDVersion;
public string CSName;
public short? CurrentTimeZone;
public bool? DataExecutionPrevention_Available;
public bool? DataExecutionPrevention_32BitApplications;
public bool? DataExecutionPrevention_Drivers;
public byte? DataExecutionPrevention_SupportPolicy;
public bool? Debug;
public string Description;
public bool? Distributed;
public uint? EncryptionLevel;
public byte? ForegroundApplicationBoost;
public ulong? FreePhysicalMemory;
public ulong? FreeSpaceInPagingFiles;
public ulong? FreeVirtualMemory;
public DateTime? InstallDate;
public DateTime? LastBootUpTime;
public DateTime? LocalDateTime;
public string Locale;
public string Manufacturer;
public uint? MaxNumberOfProcesses;
public ulong? MaxProcessMemorySize;
public string[] MUILanguages;
public string Name;
public uint? NumberOfLicensedUsers;
public uint? NumberOfProcesses;
public uint? NumberOfUsers;
public uint? OperatingSystemSKU;
public string Organization;
public string OSArchitecture;
public uint? OSLanguage;
public uint? OSProductSuite;
public ushort? OSType;
public string OtherTypeDescription;
public bool? PAEEnabled;
public bool? PortableOperatingSystem;
public bool? Primary;
public uint? ProductType;
public string RegisteredUser;
public string SerialNumber;
public ushort? ServicePackMajorVersion;
public ushort? ServicePackMinorVersion;
public ulong? SizeStoredInPagingFiles;
public string Status;
public uint? SuiteMask;
public string SystemDevice;
public string SystemDirectory;
public string SystemDrive;
public ulong? TotalSwapSpaceSize;
public ulong? TotalVirtualMemorySize;
public ulong? TotalVisibleMemorySize;
public string Version;
public string WindowsDirectory;
#endregion Fields
#region Public Properties
public string LanguageName
{
get { return GetLanguageName(OSLanguage); }
}
public OSProductSuite[] ProductSuites
{
get { return MakeProductSuites(OSProductSuite); }
}
public OSProductSuite[] Suites
{
get { return MakeProductSuites(SuiteMask); }
}
#endregion Public Properties
#region Public Methods
public string GetLocale()
{
return Conversion.GetLocaleName(Locale);
}
#endregion Public Methods
#region Private Methods
private static OSProductSuite[] MakeProductSuites(uint? suiteMask)
{
if (suiteMask == null)
return null;
var mask = suiteMask.Value;
var list = new List<OSProductSuite>();
foreach (OSProductSuite suite in Enum.GetValues<OSProductSuite>())
if ((mask & (uint)suite) != 0)
list.Add(suite);
return list.ToArray();
}
#endregion Private Methods
}
[SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses", Justification = "Class is instantiated directly from a CIM instance")]
internal sealed class WmiPageFileUsage
{
public uint? AllocatedBaseSize;
public string Caption;
public uint? CurrentUsage;
public string Description;
public DateTime? InstallDate;
public string Name;
public uint? PeakUsage;
public string Status;
public bool? TempPageFile;
}
[SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses", Justification = "Class is instantiated directly from a CIM instance")]
internal sealed class WmiProcessor
{
public ushort? AddressWidth;
public ushort? Architecture;
public string AssetTag;
public ushort? Availability;
public string Caption;
public uint? Characteristics;
public uint? ConfigManagerErrorCode;
public bool? ConfigManagerUserConfig;
public ushort? CpuStatus;
public uint? CurrentClockSpeed;
public ushort? CurrentVoltage;
public ushort? DataWidth;
public string Description;
public string DeviceID;
public bool? ErrorCleared;
public string ErrorDescription;
public uint? ExtClock;
public ushort? Family;
public DateTime? InstallDate;
public uint? L2CacheSize;
public uint? L2CacheSpeed;
public uint? L3CacheSize;
public uint? L3CacheSpeed;
public uint? LastErrorCode;
public ushort? Level;
public ushort? LoadPercentage;
public string Manufacturer;
public uint? MaxClockSpeed;
public string Name;
public uint? NumberOfCores;
public uint? NumberOfEnabledCore;
public uint? NumberOfLogicalProcessors;
public string OtherFamilyDescription;
public string PartNumber;
public string PNPDeviceID;
public ushort[] PowerManagementCapabilities;
public bool? PowerManagementSupported;
public string ProcessorId;
public ushort? ProcessorType;
public ushort? Revision;
public string Role;
public bool? SecondLevelAddressTranslationExtensions;
public string SerialNumber;
public string SocketDesignation;
public string Status;
public ushort? StatusInfo;
public string Stepping;
public string SystemName;
public uint? ThreadCount;
public string UniqueId;
public ushort? UpgradeMethod;
public string Version;
public bool? VirtualizationFirmwareEnabled;
public bool? VMMonitorModeExtensions;
public uint? VoltageCaps;
}
#pragma warning restore 649
#endregion Intermediate WMI classes
#region Other Intermediate classes
internal sealed class RegWinNtCurrentVersion
{
public string BuildLabEx;
public string CurrentVersion;
public string EditionId;
public string InstallationType;
public DateTime? InstallDate;
public string ProductId;
public string ProductName;
public string RegisteredOrganization;
public string RegisteredOwner;
public string SystemRoot;
public string ReleaseId;
public int? UBR;
}
#endregion Other Intermediate classes
#region Output components
#region Classes comprising the output object
/// <summary>
/// Provides information about Device Guard.
/// </summary>
public class DeviceGuard
{
/// <summary>
/// Array of required security properties.
/// </summary>
[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")]
public DeviceGuardHardwareSecure[] RequiredSecurityProperties { get; internal set; }
/// <summary>
/// Array of available security properties.
/// </summary>
[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")]
public DeviceGuardHardwareSecure[] AvailableSecurityProperties { get; internal set; }
/// <summary>
/// Indicates which security services have been configured.
/// </summary>
[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")]
public DeviceGuardSoftwareSecure[] SecurityServicesConfigured { get; internal set; }
/// <summary>
/// Indicates which security services are running.
/// </summary>
[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")]
public DeviceGuardSoftwareSecure[] SecurityServicesRunning { get; internal set; }
/// <summary>
/// Indicates the status of the Device Guard Code Integrity policy.
/// </summary>
public DeviceGuardConfigCodeIntegrityStatus? CodeIntegrityPolicyEnforcementStatus { get; internal set; }
/// <summary>
/// Indicates the status of the Device Guard user mode Code Integrity policy.
/// </summary>
public DeviceGuardConfigCodeIntegrityStatus? UserModeCodeIntegrityPolicyEnforcementStatus { get; internal set; }
}
/// <summary>
/// Describes a Quick-Fix Engineering update.
/// </summary>
public class HotFix
{
/// <summary>
/// Unique identifier associated with a particular update.
/// </summary>
public string HotFixID
{
get;
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "Class is instantiated directly from a CIM instance")]
internal set;
}
/// <summary>
/// Description of the update.
/// </summary>
public string Description
{
get;
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "Class is instantiated directly from a CIM instance")]
internal set;
}
/// <summary>
/// String containing the date that the update was installed.
/// </summary>
public string InstalledOn
{
get;
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "Class is instantiated directly from a CIM instance")]
internal set;
}
/// <summary>
/// Additional comments that relate to the update.
/// </summary>
public string FixComments
{
get;
[SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode", Justification = "Class is instantiated directly from a CIM instance")]
internal set;
}
}
/// <summary>
/// Provides information about a network adapter.
/// </summary>
public class NetworkAdapter
{
/// <summary>
/// Description of the network adapter.
/// </summary>
public string Description { get; internal set; }
/// <summary>
/// Name of the network connection as it appears in the Network
/// Connections Control Panel program.
/// </summary>
public string ConnectionID { get; internal set; }
/// <summary>
/// Indicates whether the DHCP server automatically assigns an IP address
/// to the computer system when establishing a network connection.
/// </summary>
public bool? DHCPEnabled { get; internal set; }
/// <summary>
/// IP Address of the DHCP server.
/// </summary>
public string DHCPServer { get; internal set; }
/// <summary>
/// State of the network adapter connection to the network.
/// </summary>
public NetConnectionStatus ConnectionStatus { get; internal set; }
/// <summary>
/// Array of all of the IP addresses associated with the current network adapter.
/// </summary>
[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")]
public string[] IPAddresses { get; internal set; }
}
/// <summary>
/// Describes a processor on the computer.
/// </summary>
public class Processor
{
/// <summary>
/// Name of the processor.
/// </summary>
public string Name { get; internal set; }
/// <summary>
/// Name of the processor manufacturer.
/// </summary>
public string Manufacturer { get; internal set; }
/// <summary>
/// Description of the processor.
/// </summary>
public string Description { get; internal set; }
/// <summary>
/// Processor architecture used by the platform.
/// </summary>
public CpuArchitecture? Architecture { get; internal set; }
/// <summary>
/// Address width of the processor.
/// </summary>
public ushort? AddressWidth { get; internal set; }
/// <summary>
/// Data width of the processor.
/// </summary>
public ushort? DataWidth { get; internal set; }
/// <summary>
/// Maximum speed of the processor, in MHz.
/// </summary>
public uint? MaxClockSpeed { get; internal set; }
/// <summary>
/// Current speed of the processor, in MHz.
/// </summary>
public uint? CurrentClockSpeed { get; internal set; }
/// <summary>
/// Number of cores for the current instance of the processor.
/// </summary>
/// <remarks>
/// A core is a physical processor on the integrated circuit
/// </remarks>
public uint? NumberOfCores { get; internal set; }
/// <summary>
/// Number of logical processors for the current instance of the processor.
/// </summary>
/// <remarks>
/// For processors capable of hyperthreading, this value includes only the
/// processors which have hyperthreading enabled
/// </remarks>
public uint? NumberOfLogicalProcessors { get; internal set; }
/// <summary>
/// Processor information that describes the processor features.
/// </summary>
/// <remarks>
/// For an x86 class CPU, the field format depends on the processor support
/// of the CPUID instruction. If the instruction is supported, the property
/// contains 2 (two) DWORD formatted values. The first is an offset of 08h-0Bh,
/// which is the EAX value that a CPUID instruction returns with input EAX set
/// to 1. The second is an offset of 0Ch-0Fh, which is the EDX value that the
/// instruction returns. Only the first two bytes of the property are significant
/// and contain the contents of the DX register at CPU reset—all others are set
/// to 0 (zero), and the contents are in DWORD format
/// </remarks>
public string ProcessorID { get; internal set; }
/// <summary>
/// Type of chip socket used on the circuit.
/// </summary>
public string SocketDesignation { get; internal set; }
/// <summary>
/// Primary function of the processor.
/// </summary>
public ProcessorType? ProcessorType { get; internal set; }
/// <summary>
/// Role of the processor.
/// </summary>
public string Role { get; internal set; }
/// <summary>
/// Current status of the processor.
/// </summary>
public string Status { get; internal set; }
/// <summary>
/// Current status of the processor.
/// Status changes indicate processor usage, but not the physical
/// condition of the processor.
/// </summary>
public CpuStatus? CpuStatus { get; internal set; }
/// <summary>
/// Availability and status of the processor.
/// </summary>
public CpuAvailability? Availability { get; internal set; }
}
/// <summary>
/// The ComputerInfo class is output to the PowerShell pipeline.
/// </summary>
public class ComputerInfo
{
#region Registry
/// <summary>
/// Windows build lab information, from the Windows Registry.
/// </summary>
public string WindowsBuildLabEx { get; internal set; }
/// <summary>
/// Windows version number, from the Windows Registry.
/// </summary>
public string WindowsCurrentVersion { get; internal set; }
/// <summary>
/// Windows edition, from the Windows Registry.
/// </summary>
public string WindowsEditionId { get; internal set; }
/// <summary>
/// Windows installation type, from the Windows Registry.
/// </summary>
public string WindowsInstallationType { get; internal set; }
/// <summary>
/// The data Windows was installed, from the Windows Registry.
/// </summary>
public DateTime? WindowsInstallDateFromRegistry { get; internal set; }
/// <summary>
/// The Windows product ID, from the Windows Registry.
/// </summary>
public string WindowsProductId { get; internal set; }
/// <summary>
/// The Windows product name, from the Windows Registry.
/// </summary>
public string WindowsProductName { get; internal set; }
/// <summary>
/// Name of the organization that this installation of Windows is registered to, from the Windows Registry.
/// </summary>
public string WindowsRegisteredOrganization { get; internal set; }
/// <summary>
/// Name of the registered owner of this installation of Windows, from the Windows Registry.
/// </summary>
public string WindowsRegisteredOwner { get; internal set; }
/// <summary>
/// Path to the operating system's root directory, from the Windows Registry.
/// </summary>
public string WindowsSystemRoot { get; internal set; }
/// <summary>
/// The Windows ReleaseId, from the Windows Registry.
/// </summary>
public string WindowsVersion { get; internal set; }
/// <summary>
/// The Windows Update Build Revision (UBR), from the Windows Registry.
/// </summary>
public int? WindowsUBR { get; internal set; }
#endregion Registry
#region BIOS
/// <summary>
/// Array of BIOS characteristics supported by the system as defined by
/// the System Management BIOS Reference Specification.
/// </summary>
[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")]
public ushort[] BiosCharacteristics { get; internal set; }
/// <summary>
/// Array of the complete system BIOS information. In many computers
/// there can be several version strings that are stored in the registry
/// and represent the system BIOS information.
/// </summary>
[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")]
public string[] BiosBIOSVersion { get; internal set; }
/// <summary>
/// Internal identifier for this compilation of the BIOS firmware.
/// </summary>
public string BiosBuildNumber { get; internal set; }
/// <summary>
/// Short description of the BIOS.
/// </summary>
public string BiosCaption { get; internal set; }
/// <summary>
/// Code set used by the BIOS.
/// </summary>
public string BiosCodeSet { get; internal set; }
/// <summary>
/// Name of the current BIOS language.
/// </summary>
public string BiosCurrentLanguage { get; internal set; }
/// <summary>
/// Description of the BIOS.
/// </summary>
public string BiosDescription { get; internal set; }
/// <summary>
/// Major version of the embedded controller firmware.
/// </summary>
public short? BiosEmbeddedControllerMajorVersion { get; internal set; }
/// <summary>
/// Minor version of the embedded controller firmware.
/// </summary>
public short? BiosEmbeddedControllerMinorVersion { get; internal set; }
/// <summary>
/// Firmware type of the local computer.
/// </summary>
/// <remarks>
/// This is acquired via the GetFirmwareType Windows API function
/// </remarks>
public FirmwareType? BiosFirmwareType { get; internal set; }
/// <summary>
/// Manufacturer's identifier for this software element.
/// Often this will be a stock keeping unit (SKU) or a part number.
/// </summary>
public string BiosIdentificationCode { get; internal set; }
/// <summary>
/// Number of languages available for installation on this system.
/// Language may determine properties such as the need for Unicode and bidirectional text.
/// </summary>
public ushort? BiosInstallableLanguages { get; internal set; }
/// <summary>
/// Date and time the object was installed.
/// </summary>
// TODO: do we want this? On my system this is null
public DateTime? BiosInstallDate { get; internal set; }
/// <summary>
/// Language edition of the BIOS firmware.
/// The language codes defined in ISO 639 should be used.
/// Where the software element represents a multilingual or international
/// version of a product, the string "multilingual" should be used.
/// </summary>
public string BiosLanguageEdition { get; internal set; }
/// <summary>
/// Array of names of available BIOS-installable languages.
/// </summary>
[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")]
public string[] BiosListOfLanguages { get; internal set; }
/// <summary>
/// Manufacturer of the BIOS.
/// </summary>
public string BiosManufacturer { get; internal set; }
/// <summary>
/// Name used to identify the BIOS.
/// </summary>
public string BiosName { get; internal set; }
/// <summary>
/// Records the manufacturer and operating system type for the BIOS when
/// the BiosTargetOperatingSystem property has a value of 1 (Other).
/// When TargetOperatingSystem has a value of 1, BiosOtherTargetOS must
/// have a nonnull value. For all other values of BiosTargetOperatingSystem,
/// BiosOtherTargetOS is NULL.
/// </summary>
public string BiosOtherTargetOS { get; internal set; }
/// <summary>
/// If true, this is the primary BIOS of the computer system.
/// </summary>
public bool? BiosPrimaryBIOS { get; internal set; }
/// <summary>
/// Release date of the Windows BIOS.
/// </summary>
public DateTime? BiosReleaseDate { get; internal set; }
/// <summary>
/// Assigned serial number of the BIOS.
/// </summary>
public string BiosSerialNumber { get; internal set; }
/// <summary>
/// BIOS version as reported by SMBIOS.
/// </summary>
public string BiosSMBIOSBIOSVersion { get; internal set; }
/// <summary>
/// SMBIOS major version number. This property is null if SMBIOS is not found.
/// </summary>
public ushort? BiosSMBIOSMajorVersion { get; internal set; }
/// <summary>
/// SMBIOS minor version number. This property is null if SMBIOS is not found.
/// </summary>
public ushort? BiosSMBIOSMinorVersion { get; internal set; }
/// <summary>
/// If true, the SMBIOS is available on this computer system.
/// </summary>
public bool? BiosSMBIOSPresent { get; internal set; }
/// <summary>
/// State of a BIOS software element.
/// </summary>
public SoftwareElementState? BiosSoftwareElementState { get; internal set; }
/// <summary>
/// Status of the BIOS.
/// </summary>
public string BiosStatus { get; internal set; }
/// <summary>
/// Major elease of the System BIOS.
/// </summary>
public ushort? BiosSystemBiosMajorVersion { get; internal set; }
/// <summary>
/// Minor release of the System BIOS.
/// </summary>
public ushort? BiosSystemBiosMinorVersion { get; internal set; }
/// <summary>
/// Target operating system.
/// </summary>
public ushort? BiosTargetOperatingSystem { get; internal set; }
/// <summary>
/// Version of the BIOS.
/// This string is created by the BIOS manufacturer.
/// </summary>
public string BiosVersion { get; internal set; }
#endregion BIOS
#region Computer System
/// <summary>
/// System hardware security settings for administrator password status.
/// </summary>
// public AdminPasswordStatus? CsAdminPasswordStatus { get; internal set; }
public HardwareSecurity? CsAdminPasswordStatus { get; internal set; }
/// <summary>
/// If true, the system manages the page file.
/// </summary>
public bool? CsAutomaticManagedPagefile { get; internal set; }
/// <summary>
/// If True, the automatic reset boot option is enabled.
/// </summary>
public bool? CsAutomaticResetBootOption { get; internal set; }
/// <summary>
/// If True, the automatic reset is enabled.
/// </summary>
public bool? CsAutomaticResetCapability { get; internal set; }
/// <summary>
/// Boot option limit is ON. Identifies the system action when the
/// CsResetLimit value is reached.
/// </summary>
public BootOptionAction? CsBootOptionOnLimit { get; internal set; }
/// <summary>
/// Type of reboot action after the time on the watchdog timer is elapsed.
/// </summary>
public BootOptionAction? CsBootOptionOnWatchDog { get; internal set; }
/// <summary>
/// If true, indicates whether a boot ROM is supported.
/// </summary>
public bool? CsBootROMSupported { get; internal set; }
/// <summary>
/// Status and Additional Data fields that identify the boot status.
/// </summary>
[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")]
public ushort[] CsBootStatus { get; internal set; }
/// <summary>
/// System is started. Fail-safe boot bypasses the user startup files—also called SafeBoot.
/// </summary>
public string CsBootupState { get; internal set; }
/// <summary>
/// The name of this computer.
/// </summary>
public string CsCaption { get; internal set; } // TODO: remove this? Same as CsName???
/// <summary>
/// Boot up state of the chassis.
/// </summary>
// public ChassisBootupState? CsChassisBootupState { get; internal set; }
public SystemElementState? CsChassisBootupState { get; internal set; }
/// <summary>
/// The chassis or enclosure SKU number as a string.
/// </summary>
public string CsChassisSKUNumber { get; internal set; }
/// <summary>
/// Amount of time the unitary computer system is offset from Coordinated
/// Universal Time (UTC).
/// </summary>
public short? CsCurrentTimeZone { get; internal set; }
/// <summary>
/// If True, the daylight savings mode is ON.
/// </summary>
public bool? CsDaylightInEffect { get; internal set; }
/// <summary>
/// Description of the computer system.
/// </summary>
public string CsDescription { get; internal set; }
/// <summary>
/// Name of local computer according to the domain name server.
/// </summary>
public string CsDNSHostName { get; internal set; }
/// <summary>
/// Name of the domain to which a computer belongs.
/// </summary>
/// <remarks>
/// If the computer is not part of a domain, then the name of the workgroup is returned
/// </remarks>
public string CsDomain { get; internal set; }
/// <summary>
/// Role of a computer in an assigned domain workgroup. A domain workgroup
/// is a collection of computers on the same network. For example,
/// a DomainRole property may show that a computer is a member workstation.
/// </summary>
public DomainRole? CsDomainRole { get; internal set; }
/// <summary>
/// Enables daylight savings time on a computer. A value of True indicates
/// that the system time changes to an hour ahead or behind when DST starts
/// or ends. A value of False indicates that the system time does not change
/// to an hour ahead or behind when DST starts or ends. A value of NULL
/// indicates that the DST status is unknown on a system.
/// </summary>
public bool? CsEnableDaylightSavingsTime { get; internal set; }
/// <summary>
/// Hardware security setting for the reset button on a computer.
/// </summary>
// public FrontPanelResetStatus? CsFrontPanelResetStatus { get; internal set; }
public HardwareSecurity? CsFrontPanelResetStatus { get; internal set; }
/// <summary>
/// If True, a hypervisor is present.
/// </summary>
public bool? CsHypervisorPresent { get; internal set; }
/// <summary>
/// If True, an infrared port exists on a computer system.
/// </summary>
public bool? CsInfraredSupported { get; internal set; }
/// <summary>
/// Data required to find the initial load device or boot service to request that the operating system start up.
/// </summary>
public string CsInitialLoadInfo { get; internal set; }
/// <summary>
/// Object is installed. An object does not need a value to indicate that it is installed.
/// </summary>
public DateTime? CsInstallDate { get; internal set; }
/// <summary>
/// System hardware security setting for Keyboard Password Status.
/// </summary>
// public KeyboardPasswordStatus? CsKeyboardPasswordStatus { get; internal set; }
public HardwareSecurity? CsKeyboardPasswordStatus { get; internal set; }
/// <summary>
/// Array entry of the CsInitialLoadInfo property that contains the data
/// to start the loaded operating system.
/// </summary>
public string CsLastLoadInfo { get; internal set; }
/// <summary>
/// Name of the computer manufacturer.
/// </summary>
public string CsManufacturer { get; internal set; }
/// <summary>
/// Product name that a manufacturer gives to a computer.
/// </summary>
public string CsModel { get; internal set; }
/// <summary>
/// Key of a CIM_System instance in an enterprise environment.
/// </summary>
public string CsName { get; internal set; }
/// <summary>
/// An array of <see cref="NetworkAdapter"/> objects describing any
/// network adapters on the system.
/// </summary>
[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")]
public NetworkAdapter[] CsNetworkAdapters { get; internal set; }
/// <summary>
/// If True, the network Server Mode is enabled.
/// </summary>
public bool? CsNetworkServerModeEnabled { get; internal set; }
/// <summary>
/// Number of logical processors available on the computer.
/// </summary>
public uint? CsNumberOfLogicalProcessors { get; internal set; }
/// <summary>
/// Number of physical processors currently available on a system.
/// </summary>
/// <remarks>
/// This is the number of enabled processors for a system, which
/// does not include the disabled processors. If a computer system
/// has two physical processors each containing two logical processors,
/// then the value of CsNumberOfProcessors is 2 and CsNumberOfLogicalProcessors
/// is 4. The processors may be multicore or they may be hyperthreading processors
/// </remarks>
public uint? CsNumberOfProcessors { get; internal set; }
/// <summary>
/// Array of <see cref="Processor"/> objects describing each processor on the system.
/// </summary>
[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")]
public Processor[] CsProcessors { get; internal set; }
/// <summary>
/// Array of free-form strings that an OEM defines.
/// For example, an OEM defines the part numbers for system reference
/// documents, manufacturer contact information, and so on.
/// </summary>
[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")]
public string[] CsOEMStringArray { get; internal set; }
/// <summary>
/// If True, the computer is part of a domain.
/// If the value is NULL, the computer is not in a domain or the status is unknown.
/// </summary>
public bool? CsPartOfDomain { get; internal set; }
/// <summary>
/// Time delay before a reboot is initiated, in milliseconds.
/// It is used after a system power cycle, local or remote system reset,
/// and automatic system reset. A value of –1 (minus one) indicates that
/// the pause value is unknown.
/// </summary>
public long? CsPauseAfterReset { get; internal set; }
/// <summary>
/// Type of the computer in use, such as laptop, desktop, or tablet.
/// </summary>
public PCSystemType? CsPCSystemType { get; internal set; }
/// <summary>
/// Type of the computer in use, such as laptop, desktop, or tablet.
/// </summary>
public PCSystemTypeEx? CsPCSystemTypeEx { get; internal set; }
/// <summary>
/// Array of the specific power-related capabilities of a logical device.
/// </summary>
[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")]
public PowerManagementCapabilities[] CsPowerManagementCapabilities { get; internal set; }
/// <summary>
/// If True, device can be power-managed, for example, a device can be
/// put into suspend mode, and so on.
/// </summary>
/// <remarks>
/// This property does not indicate that power management features are
/// enabled currently, but it does indicate that the logical device is
/// capable of power management
/// </remarks>
public bool? CsPowerManagementSupported { get; internal set; }
/// <summary>
/// System hardware security setting for Power-On Password Status.
/// </summary>
// public PowerOnPasswordStatus? CsPowerOnPasswordStatus { get; internal set; }
public HardwareSecurity? CsPowerOnPasswordStatus { get; internal set; }
/// <summary>
/// Current power state of a computer and its associated operating system.
/// </summary>
public PowerState? CsPowerState { get; internal set; }
/// <summary>
/// State of the power supply or supplies when last booted.
/// </summary>
// public PowerSupplyState? CsPowerSupplyState { get; internal set; }
public SystemElementState? CsPowerSupplyState { get; internal set; }
/// <summary>
/// Contact information for the primary system owner.
/// For example, phone number, email address, and so on.
/// </summary>
public string CsPrimaryOwnerContact { get; internal set; }
/// <summary>
/// Name of the primary system owner.
/// </summary>
public string CsPrimaryOwnerName { get; internal set; }
/// <summary>
/// Indicates if the computer system can be reset.
/// </summary>
public ResetCapability? CsResetCapability { get; internal set; }
/// <summary>
/// Number of automatic resets since the last reset.
/// A value of –1 (minus one) indicates that the count is unknown.
/// </summary>
public short? CsResetCount { get; internal set; }
/// <summary>
/// Number of consecutive times a system reset is attempted.
/// A value of –1 (minus one) indicates that the limit is unknown.
/// </summary>
public short? CsResetLimit { get; internal set; }
/// <summary>
/// Array that specifies the roles of a system in the information
/// technology environment.
/// </summary>
[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")]
public string[] CsRoles { get; internal set; }
/// <summary>
/// Statis pf the computer system.
/// </summary>
public string CsStatus { get; internal set; }
/// <summary>
/// Array of the support contact information for the Windows operating system.
/// </summary>
[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")]
public string[] CsSupportContactDescription { get; internal set; }
/// <summary>
/// The family to which a particular computer belongs.
/// A family refers to a set of computers that are similar but not
/// identical from a hardware or software point of view.
/// </summary>
public string CsSystemFamily { get; internal set; }
/// <summary>
/// Identifies a particular computer configuration for sale.
/// It is sometimes also called a product ID or purchase order number.
/// </summary>
public string CsSystemSKUNumber { get; internal set; }
/// <summary>
/// System running on the Windows-based computer.
/// </summary>
public string CsSystemType { get; internal set; }
/// <summary>
/// Thermal state of the system when last booted.
/// </summary>
// public ThermalState? CsThermalState { get; internal set; }
public SystemElementState? CsThermalState { get; internal set; }
/// <summary>
/// Total size of physical memory.
/// </summary>
/// <remarks>
/// Be aware that, under some circumstances, this property may not
/// return an accurate value for the physical memory. For example,
/// it is not accurate if the BIOS is using some of the physical memory
/// </remarks>
public ulong? CsTotalPhysicalMemory { get; internal set; }
/// <summary>
/// Size of physically installed memory, as reported by the Windows API
/// function GetPhysicallyInstalledSystemMemory.
/// </summary>
public ulong? CsPhysicallyInstalledMemory { get; internal set; }
/// <summary>
/// Name of a user that is logged on currently.
/// </summary>
/// <remarks>
/// In a terminal services session, CsUserName is the name of the user
/// that is logged on to the console—not the user logged on during the
/// terminal service session
/// </remarks>
public string CsUserName { get; internal set; }
/// <summary>
/// Event that causes the system to power up.
/// </summary>
public WakeUpType? CsWakeUpType { get; internal set; }
/// <summary>
/// Name of the workgroup for this computer.
/// </summary>
public string CsWorkgroup { get; internal set; }
#endregion Computer System
#region Operating System
/// <summary>
/// Name of the operating system.
/// </summary>
public string OsName { get; internal set; }
/// <summary>
/// Type of operating system.
/// </summary>
public OSType? OsType { get; internal set; }
/// <summary>
/// SKU number for the operating system.
/// </summary>
public OperatingSystemSKU? OsOperatingSystemSKU { get; internal set; }
/// <summary>
/// Version number of the operating system.
/// </summary>
public string OsVersion { get; internal set; }
/// <summary>
/// String that indicates the latest service pack installed on a computer.
/// If no service pack is installed, the string is NULL.
/// </summary>
public string OsCSDVersion { get; internal set; }
/// <summary>
/// Build number of the operating system.
/// </summary>
public string OsBuildNumber { get; internal set; }
/// <summary>
/// Array of <see cref="HotFix"/> objects containing information about
/// any Quick-Fix Engineering patches (Hot Fixes) applied to the operating
/// system.
/// </summary>
[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")]
public HotFix[] OsHotFixes { get; internal set; }
/// <summary>
/// Name of the disk drive from which the Windows operating system starts.
/// </summary>
public string OsBootDevice { get; internal set; }
/// <summary>
/// Physical disk partition on which the operating system is installed.
/// </summary>
public string OsSystemDevice { get; internal set; }
/// <summary>
/// System directory of the operating system.
/// </summary>
public string OsSystemDirectory { get; internal set; }
/// <summary>
/// Letter of the disk drive on which the operating system resides.
/// </summary>
public string OsSystemDrive { get; internal set; }
/// <summary>
/// Windows directory of the operating system.
/// </summary>
public string OsWindowsDirectory { get; internal set; }
/// <summary>
/// Code for the country/region that an operating system uses.
/// </summary>
/// <remarks>
/// Values are based on international phone dialing prefixes—also
/// referred to as IBM country/region codes
/// </remarks>
public string OsCountryCode { get; internal set; }
/// <summary>
/// Number, in minutes, an operating system is offset from Greenwich
/// mean time (GMT). The number is positive, negative, or zero.
/// </summary>
public short? OsCurrentTimeZone { get; internal set; }
/// <summary>
/// Language identifier used by the operating system.
/// </summary>
/// <remarks>
/// A language identifier is a standard international numeric abbreviation
/// for a country/region. Each language has a unique language identifier (LANGID),
/// a 16-bit value that consists of a primary language identifier and a secondary
/// language identifier
/// </remarks>
public string OsLocaleID { get; internal set; } // From Win32_OperatingSystem.Locale
/// <summary>
/// The culture name, such as "en-US", derived from the <see cref="OsLocaleID"/> property.
/// </summary>
public string OsLocale { get; internal set; }
/// <summary>
/// Operating system version of the local date and time-of-day.
/// </summary>
public DateTime? OsLocalDateTime { get; internal set; }
/// <summary>
/// Date and time the operating system was last restarted.
/// </summary>
public DateTime? OsLastBootUpTime { get; internal set; }
/// <summary>
/// The interval between the time the operating system was last
/// restarted and the current time.
/// </summary>
public TimeSpan? OsUptime { get; internal set; }
/// <summary>
/// Type of build used for the operating system.
/// </summary>
public string OsBuildType { get; internal set; }
/// <summary>
/// Code page value the operating system uses.
/// </summary>
public string OsCodeSet { get; internal set; }
/// <summary>
/// If true, then the data execution prevention hardware feature is available.
/// </summary>
public bool? OsDataExecutionPreventionAvailable { get; internal set; }
/// <summary>
/// When the data execution prevention hardware feature is available,
/// this property indicates that the feature is set to work for 32-bit
/// applications if true.
/// </summary>
public bool? OsDataExecutionPrevention32BitApplications { get; internal set; }
/// <summary>
/// When the data execution prevention hardware feature is available,
/// this property indicates that the feature is set to work for drivers
/// if true.
/// </summary>
public bool? OsDataExecutionPreventionDrivers { get; internal set; }
/// <summary>
/// Indicates which Data Execution Prevention (DEP) setting is applied.
/// The DEP setting specifies the extent to which DEP applies to 32-bit
/// applications on the system. DEP is always applied to the Windows kernel.
/// </summary>
public DataExecutionPreventionSupportPolicy? OsDataExecutionPreventionSupportPolicy { get; internal set; }
/// <summary>
/// If true, the operating system is a checked (debug) build.
/// </summary>
public bool? OsDebug { get; internal set; }
/// <summary>
/// If True, the operating system is distributed across several computer
/// system nodes. If so, these nodes should be grouped as a cluster.
/// </summary>
public bool? OsDistributed { get; internal set; }
/// <summary>
/// Encryption level for secure transactions: 40-bit, 128-bit, or n-bit.
/// </summary>
public OSEncryptionLevel? OsEncryptionLevel { get; internal set; }
/// <summary>
/// Increased priority given to the foreground application.
/// </summary>
public ForegroundApplicationBoost? OsForegroundApplicationBoost { get; internal set; }
/// <summary>
/// Total amount, in kilobytes, of physical memory available to the
/// operating system.
/// </summary>
/// <remarks>
/// This value does not necessarily indicate the true amount of
/// physical memory, but what is reported to the operating system
/// as available to it.
/// </remarks>
public ulong? OsTotalVisibleMemorySize { get; internal set; }
/// <summary>
/// Number, in kilobytes, of physical memory currently unused and available.
/// </summary>
public ulong? OsFreePhysicalMemory { get; internal set; }
/// <summary>
/// Number, in kilobytes, of virtual memory.
/// </summary>
public ulong? OsTotalVirtualMemorySize { get; internal set; }
/// <summary>
/// Number, in kilobytes, of virtual memory currently unused and available.
/// </summary>
public ulong? OsFreeVirtualMemory { get; internal set; }
/// <summary>
/// Number, in kilobytes, of virtual memory currently in use.
/// </summary>
public ulong? OsInUseVirtualMemory { get; internal set; }
/// <summary>
/// Total swap space in kilobytes.
/// </summary>
/// <remarks>
/// This value may be NULL (unspecified) if the swap space is not
/// distinguished from page files. However, some operating systems
/// distinguish these concepts. For example, in UNIX, whole processes
/// can be swapped out when the free page list falls and remains below
/// a specified amount
/// </remarks>
public ulong? OsTotalSwapSpaceSize { get; internal set; }
/// <summary>
/// Total number of kilobytes that can be stored in the operating system
/// paging files—0 (zero) indicates that there are no paging files.
/// Be aware that this number does not represent the actual physical
/// size of the paging file on disk.
/// </summary>
public ulong? OsSizeStoredInPagingFiles { get; internal set; }
/// <summary>
/// Number, in kilobytes, that can be mapped into the operating system
/// paging files without causing any other pages to be swapped out.
/// </summary>
public ulong? OsFreeSpaceInPagingFiles { get; internal set; }
/// <summary>
/// Array of file paths to the operating system's paging files.
/// </summary>
[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")]
public string[] OsPagingFiles { get; internal set; }
/// <summary>
/// Version of the operating system's Hardware Abstraction Layer (HAL)
/// </summary>
public string OsHardwareAbstractionLayer { get; internal set; }
/// <summary>
/// Indicates the install date.
/// </summary>
public DateTime? OsInstallDate { get; internal set; }
/// <summary>
/// Name of the operating system manufacturer.
/// For Windows-based systems, this value is "Microsoft Corporation"
/// </summary>
public string OsManufacturer { get; internal set; }
/// <summary>
/// Maximum number of process contexts the operating system can support.
/// </summary>
public uint? OsMaxNumberOfProcesses { get; internal set; }
/// <summary>
/// Maximum number, in kilobytes, of memory that can be allocated to a process.
/// </summary>
public ulong? OsMaxProcessMemorySize { get; internal set; }
/// <summary>
/// Array of Multilingual User Interface Pack (MUI Pack) languages installed
/// on the computer.
/// </summary>
[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")]
public string[] OsMuiLanguages { get; internal set; }
/// <summary>
/// Number of user licenses for the operating system.
/// </summary>
public uint? OsNumberOfLicensedUsers { get; internal set; }
/// <summary>
/// Number of process contexts currently loaded or running on the operating system.
/// </summary>
public uint? OsNumberOfProcesses { get; internal set; }
/// <summary>
/// Number of user sessions for which the operating system is storing
/// state information currently.
/// </summary>
public uint? OsNumberOfUsers { get; internal set; }
/// <summary>
/// Company name for the registered user of the operating system.
/// </summary>
public string OsOrganization { get; internal set; }
/// <summary>
/// Architecture of the operating system, as opposed to the processor.
/// </summary>
public string OsArchitecture { get; internal set; }
/// <summary>
/// Language version of the operating system installed.
/// </summary>
public string OsLanguage { get; internal set; }
/// <summary>
/// Array of <see cref="OSProductSuite"/> objects indicating installed
/// and licensed product additions to the operating system.
/// </summary>
[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")]
public OSProductSuite[] OsProductSuites { get; internal set; }
/// <summary>
/// Additional description for the current operating system version.
/// </summary>
public string OsOtherTypeDescription { get; internal set; }
/// <summary>
/// If True, the physical address extensions (PAE) are enabled by the
/// operating system running on Intel processors.
/// </summary>
public bool? OsPAEEnabled { get; internal set; }
/// <summary>
/// Specifies whether the operating system booted from an external USB device.
/// If true, the operating system has detected it is booting on a supported
/// locally connected storage device.
/// </summary>
public bool? OsPortableOperatingSystem { get; internal set; }
/// <summary>
/// Specifies whether this is the primary operating system.
/// </summary>
public bool? OsPrimary { get; internal set; }
/// <summary>
/// Additional system information.
/// </summary>
public ProductType? OsProductType { get; internal set; }
/// <summary>
/// Name of the registered user of the operating system.
/// </summary>
public string OsRegisteredUser { get; internal set; }
/// <summary>
/// Operating system product serial identification number.
/// </summary>
public string OsSerialNumber { get; internal set; }
/// <summary>
/// Major version of the service pack installed on the computer system.
/// </summary>
public ushort? OsServicePackMajorVersion { get; internal set; }
/// <summary>
/// Minor version of the service pack installed on the computer system.
/// </summary>
public ushort? OsServicePackMinorVersion { get; internal set; }
/// <summary>
/// Current status.
/// </summary>
public string OsStatus { get; internal set; }
/// <summary>
/// Product suites available on the operating system.
/// </summary>
[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")]
public OSProductSuite[] OsSuites { get; internal set; }
/// <summary>
/// Server level of the operating system, if the operating system is a server.
/// </summary>
public ServerLevel? OsServerLevel { get; internal set; }
#endregion Operating System
#region Misc Info
/// <summary>
/// Layout of the (first) keyboard attached to the system.
/// </summary>
public string KeyboardLayout { get; internal set; }
/// <summary>
/// Name of the system's current time zone.
/// </summary>
public string TimeZone { get; internal set; }
/// <summary>
/// Path to the system's logon server.
/// </summary>
public string LogonServer { get; internal set; }
/// <summary>
/// Power platform role.
/// </summary>
public PowerPlatformRole? PowerPlatformRole { get; internal set; }
/// <summary>
/// If true, a HyperVisor was detected.
/// </summary>
public bool? HyperVisorPresent { get; internal set; }
/// <summary>
/// If a HyperVisor is not present, indicates the state of the
/// requirement that the Data Execution Prevention feature is available.
/// </summary>
public bool? HyperVRequirementDataExecutionPreventionAvailable { get; internal set; }
/// <summary>
/// If a HyperVisor is not present, indicates the state of the
/// requirement that the processor supports address translation
/// extensions used for virtualization.
/// </summary>
public bool? HyperVRequirementSecondLevelAddressTranslation { get; internal set; }
/// <summary>
/// If a HyperVisor is not present, indicates the state of the
/// requirement that the firmware has enabled virtualization
/// extensions.
/// </summary>
public bool? HyperVRequirementVirtualizationFirmwareEnabled { get; internal set; }
/// <summary>
/// If a HyperVisor is not present, indicates the state of the
/// requirement that the processor supports Intel or AMD Virtual
/// Machine Monitor extensions.
/// </summary>
public bool? HyperVRequirementVMMonitorModeExtensions { get; internal set; }
/// <summary>
/// Indicates the status of the Device Guard features.
/// </summary>
public DeviceGuardSmartStatus? DeviceGuardSmartStatus { get; internal set; }
/// <summary>
/// Required Device Guard security properties.
/// </summary>
[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")]
public DeviceGuardHardwareSecure[] DeviceGuardRequiredSecurityProperties { get; internal set; }
/// <summary>
/// Available Device Guard security properties.
/// </summary>
[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")]
public DeviceGuardHardwareSecure[] DeviceGuardAvailableSecurityProperties { get; internal set; }
/// <summary>
/// Configured Device Guard security services.
/// </summary>
[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")]
public DeviceGuardSoftwareSecure[] DeviceGuardSecurityServicesConfigured { get; internal set; }
/// <summary>
/// Running Device Guard security services.
/// </summary>
[SuppressMessage("Microsoft.Performance", "CA1819:PropertiesShouldNotReturnArrays")]
public DeviceGuardSoftwareSecure[] DeviceGuardSecurityServicesRunning { get; internal set; }
/// <summary>
/// Status of the Device Guard Code Integrity policy enforcement.
/// </summary>
public DeviceGuardConfigCodeIntegrityStatus? DeviceGuardCodeIntegrityPolicyEnforcementStatus { get; internal set; }
/// <summary>
/// Status of the Device Guard user mode Code Integrity policy enforcement.
/// </summary>
public DeviceGuardConfigCodeIntegrityStatus? DeviceGuardUserModeCodeIntegrityPolicyEnforcementStatus { get; internal set; }
#endregion Misc Info
}
#endregion Classes comprising the output object
#region Enums used in the output objects
/// <summary>
/// System hardware security settings for administrator password status.
/// </summary>
public enum AdminPasswordStatus
{
/// <summary>
/// Feature is disabled.
/// </summary>
Disabled = 0,
/// <summary>
/// Feature is Enabled.
/// </summary>
Enabled = 1,
/// <summary>
/// Feature is not implemented.
/// </summary>
NotImplemented = 2,
/// <summary>
/// Status is unknown.
/// </summary>
Unknown = 3
}
/// <summary>
/// Actions related to the BootOptionOn* properties of the Win32_ComputerSystem
/// CIM class.
/// </summary>
[SuppressMessage("Microsoft.Design", "CA1008:EnumsShouldHaveZeroValue", Justification = "The underlying MOF definition does not contain a zero value. The converter method will handle it appropriately.")]
public enum BootOptionAction
{
// <summary>
// This value is reserved
// </summary>
// Reserved = 0,
/// <summary>
/// Boot into operating system.
/// </summary>
OperatingSystem = 1,
/// <summary>
/// Boot into system utilities.
/// </summary>
SystemUtilities = 2,
/// <summary>
/// Do not reboot.
/// </summary>
DoNotReboot = 3
}
/// <summary>
/// Indicates the state of a system element.
/// </summary>
[SuppressMessage("Microsoft.Design", "CA1008:EnumsShouldHaveZeroValue", Justification = "The underlying MOF definition does not contain a zero value. The converter method will handle it appropriately.")]
public enum SystemElementState
{
/// <summary>
/// The element state is something other than those in this Enum.
/// </summary>
Other = 1,
/// <summary>
/// The element state is unknown.
/// </summary>
Unknown = 2,
/// <summary>
/// The element is in Safe state.
/// </summary>
Safe = 3,
/// <summary>
/// The element is in Warning state.
/// </summary>
Warning = 4,
/// <summary>
/// The element is in Critical state.
/// </summary>
Critical = 5,
/// <summary>
/// The element is in Non-Recoverable state.
/// </summary>
NonRecoverable = 6
}
/// <summary>
/// Specifies the processor architecture.
/// </summary>
public enum CpuArchitecture
{
/// <summary>
/// Architecture is Intel x86.
/// </summary>
x86 = 0,
/// <summary>
/// Architecture is MIPS.
/// </summary>
MIPs = 1,
/// <summary>
/// Architecture is DEC Alpha.
/// </summary>
Alpha = 2,
/// <summary>
/// Architecture is Motorola PowerPC.
/// </summary>
PowerPC = 3,
/// <summary>
/// Architecture is ARM.
/// </summary>
ARM = 5,
/// <summary>
/// Architecture is Itanium-based 64-bit.
/// </summary>
ia64 = 6,
/// <summary>
/// Architecture is Intel 64-bit.
/// </summary>
x64 = 9
}
/// <summary>
/// Specifies a CPU's availability and status.
/// </summary>
[SuppressMessage("Microsoft.Design", "CA1008:EnumsShouldHaveZeroValue", Justification = "The underlying MOF definition does not contain a zero value. The converter method will handle it appropriately.")]
public enum CpuAvailability
{
/// <summary>
/// A state other than those specified in CpuAvailability.
/// </summary>
Other = 1,
/// <summary>
/// Availability status is unknown.
/// </summary>
Unknown = 2,
/// <summary>
/// The device is running or at full power.
/// </summary>
RunningOrFullPower = 3,
/// <summary>
/// Device is in a Warning state.
/// </summary>
Warning = 4,
/// <summary>
/// Availability status is In Test.
/// </summary>
InTest = 5,
/// <summary>
/// Status is not applicable to this device.
/// </summary>
NotApplicable = 6,
/// <summary>
/// The device is powered off.
/// </summary>
PowerOff = 7,
/// <summary>
/// Availability status is Offline.
/// </summary>
OffLine = 8,
/// <summary>
/// Availability status is Off-Duty.
/// </summary>
OffDuty = 9,
/// <summary>
/// Availability status is Degraded.
/// </summary>
Degraded = 10,
/// <summary>
/// Availability status is Not Installed.
/// </summary>
NotInstalled = 11,
/// <summary>
/// Availability status is Install Error.
/// </summary>
InstallError = 12,
/// <summary>
/// The device is known to be in a power save state, but its exact status is unknown.
/// </summary>
PowerSaveUnknown = 13,
/// <summary>
/// The device is in a power save state, but is still functioning,
/// and may exhibit decreased performance.
/// </summary>
PowerSaveLowPowerMode = 14,
/// <summary>
/// The device is not functioning, but can be brought to full power quickly.
/// </summary>
PowerSaveStandby = 15,
/// <summary>
/// The device is in a power-cycle state.
/// </summary>
PowerCycle = 16,
/// <summary>
/// The device is in a warning state, though also in a power save state.
/// </summary>
PowerSaveWarning = 17,
/// <summary>
/// The device is paused.
/// </summary>
Paused = 18,
/// <summary>
/// The device is not ready.
/// </summary>
NotReady = 19,
/// <summary>
/// The device is not configured.
/// </summary>
NotConfigured = 20,
/// <summary>
/// The device is quiet.
/// </summary>
Quiesced = 21
}
/// <summary>
/// Specifies that current status of the processor.
/// </summary>
[SuppressMessage("Microsoft.Design", "CA1027:MarkEnumsWithFlags", Justification = "The underlying MOF definition is not a bit field.")]
public enum CpuStatus
{
/// <summary>
/// CPU status is Unknown.
/// </summary>
Unknown = 0,
/// <summary>
/// CPU status is Enabled.
/// </summary>
Enabled = 1,
/// <summary>
/// CPU status is Disabled by User via BIOS Setup.
/// </summary>
DisabledByUser = 2,
/// <summary>
/// CPU status is Disabled by BIOS.
/// </summary>
DisabledByBIOS = 3,
/// <summary>
/// CPU is Idle.
/// </summary>
Idle = 4,
// <summary>
// This value is reserved
// </summary>
// Reserved_5 = 5,
// <summary>
// This value is reserved
// </summary>
// Reserved_6 = 6,
/// <summary>
/// CPU is in another state.
/// </summary>
Other = 7
}
/// <summary>
/// Data Execution Prevention (DEP) settings.
/// </summary>
public enum DataExecutionPreventionSupportPolicy
{
// Unknown = -1,
/// <summary>
/// DEP is turned off for all 32-bit applications on the computer with no exceptions.
/// </summary>
AlwaysOff = 0,
/// <summary>
/// DEP is enabled for all 32-bit applications on the computer.
/// </summary>
AlwaysOn = 1,
/// <summary>
/// DEP is enabled for a limited number of binaries, the kernel, and all
/// Windows-based services. However, it is off by default for all 32-bit
/// applications. A user or administrator must explicitly choose either
/// the Always On or the Opt Out setting before DEP can be applied to
/// 32-bit applications.
/// </summary>
OptIn = 2,
/// <summary>
/// DEP is enabled by default for all 32-bit applications. A user or
/// administrator can explicitly remove support for a 32-bit
/// application by adding the application to an exceptions list.
/// </summary>
OptOut = 3
}
/// <summary>
/// Status of the Device Guard feature.
/// </summary>
public enum DeviceGuardSmartStatus
{
/// <summary>
/// Device Guard is off.
/// </summary>
Off = 0,
/// <summary>
/// Device Guard is Configured.
/// </summary>
Configured = 1,
/// <summary>
/// Device Guard is Running.
/// </summary>
Running = 2
}
/// <summary>
/// Configuration status of the Device Guard Code Integrity.
/// </summary>
public enum DeviceGuardConfigCodeIntegrityStatus
{
/// <summary>
/// Code Integrity is off.
/// </summary>
Off = 0,
/// <summary>
/// Code Integrity uses Audit mode.
/// </summary>
AuditMode = 1,
/// <summary>
/// Code Integrity uses Enforcement mode.
/// </summary>
EnforcementMode = 2
}
/// <summary>
/// Device Guard hardware security properties.
/// </summary>
[SuppressMessage("Microsoft.Design", "CA1008:EnumsShouldHaveZeroValue", Justification = "The underlying MOF definition does not contain a zero value. The converter method will handle it appropriately.")]
public enum DeviceGuardHardwareSecure
{
/// <summary>
/// Base Virtualization Support.
/// </summary>
BaseVirtualizationSupport = 1,
/// <summary>
/// Secure Boot.
/// </summary>
SecureBoot = 2,
/// <summary>
/// DMA Protection.
/// </summary>
DMAProtection = 3,
/// <summary>
/// Secure Memory Overwrite.
/// </summary>
SecureMemoryOverwrite = 4,
/// <summary>
/// UEFI Code Readonly.
/// </summary>
UEFICodeReadonly = 5,
/// <summary>
/// SMM Security Mitigations 1.0.
/// </summary>
SMMSecurityMitigations = 6,
/// <summary>
/// Mode Based Execution Control.
/// </summary>
ModeBasedExecutionControl = 7
}
/// <summary>
/// Device Guard software security properties.
/// </summary>
[SuppressMessage("Microsoft.Design", "CA1008:EnumsShouldHaveZeroValue", Justification = "The underlying MOF definition does not contain a zero value. The converter method will handle it appropriately.")]
public enum DeviceGuardSoftwareSecure
{
/// <summary>
/// Credential Guard.
/// </summary>
CredentialGuard = 1,
/// <summary>
/// Hypervisor enforced Code Integrity.
/// </summary>
HypervisorEnforcedCodeIntegrity = 2
}
/// <summary>
/// Role of a computer in an assigned domain workgroup.
/// </summary>
public enum DomainRole
{
/// <summary>
/// Standalone Workstation.
/// </summary>
StandaloneWorkstation = 0,
/// <summary>
/// Member Workstation.
/// </summary>
MemberWorkstation = 1,
/// <summary>
/// Standalone Server.
/// </summary>
StandaloneServer = 2,
/// <summary>
/// Member Server.
/// </summary>
MemberServer = 3,
/// <summary>
/// Backup Domain Controller.
/// </summary>
BackupDomainController = 4,
/// <summary>
/// Primary Domain Controller.
/// </summary>
PrimaryDomainController = 5
}
/// <summary>
/// Specifies a firmware type.
/// </summary>
public enum FirmwareType
{
/// <summary>
/// The firmware type is unknown.
/// </summary>
Unknown = 0,
/// <summary>
/// The computer booted in legacy BIOS mode.
/// </summary>
Bios = 1,
/// <summary>
/// The computer booted in UEFI mode.
/// </summary>
Uefi = 2,
/// <summary>
/// Not implemented.
/// </summary>
Max = 3
}
/// <summary>
/// Increase in priority given to the foreground application.
/// </summary>
public enum ForegroundApplicationBoost
{
/// <summary>
/// The system boosts the quantum length by 6.
/// </summary>
None = 0,
/// <summary>
/// The system boosts the quantum length by 12.
/// </summary>
Minimum = 1,
/// <summary>
/// The system boosts the quantum length by 18.
/// </summary>
Maximum = 2
}
/// <summary>
/// Hardware security settings for the reset button on a computer.
/// </summary>
public enum FrontPanelResetStatus
{
/// <summary>
/// Reset button is disabled.
/// </summary>
Disabled = 0,
/// <summary>
/// Reset button is enabled.
/// </summary>
Enabled = 1,
/// <summary>
/// Hardware security settings are not implement.
/// </summary>
NotImplemented = 2,
/// <summary>
/// Unknown security setting.
/// </summary>
Unknown = 3
}
/// <summary>
/// Indicates a hardware security setting.
/// </summary>
public enum HardwareSecurity
{
/// <summary>
/// Hardware security is disabled.
/// </summary>
Disabled = 0,
/// <summary>
/// Hardware security is enabled.
/// </summary>
Enabled = 1,
/// <summary>
/// Hardware security is not implemented.
/// </summary>
NotImplemented = 2,
/// <summary>
/// Hardware security setting is unknown.
/// </summary>
Unknown = 3
}
/// <summary>
/// State of the network adapter connection to the network.
/// </summary>
public enum NetConnectionStatus
{
/// <summary>
/// Adapter is disconnected.
/// </summary>
Disconnected = 0,
/// <summary>
/// Adapter is connecting.
/// </summary>
Connecting = 1,
/// <summary>
/// Adapter is connected.
/// </summary>
Connected = 2,
/// <summary>
/// Adapter is disconnecting.
/// </summary>
Disconnecting = 3,
/// <summary>
/// Adapter hardware is not present.
/// </summary>
HardwareNotPresent = 4,
/// <summary>
/// Adapter hardware is disabled.
/// </summary>
HardwareDisabled = 5,
/// <summary>
/// Adapter has a hardware malfunction.
/// </summary>
HardwareMalfunction = 6,
/// <summary>
/// Media is disconnected.
/// </summary>
MediaDisconnected = 7,
/// <summary>
/// Adapter is authenticating.
/// </summary>
Authenticating = 8,
/// <summary>
/// Authentication has succeeded.
/// </summary>
AuthenticationSucceeded = 9,
/// <summary>
/// Authentication has failed.
/// </summary>
AuthenticationFailed = 10,
/// <summary>
/// Address is invalid.
/// </summary>
InvalidAddress = 11,
/// <summary>
/// Credentials are required.
/// </summary>
CredentialsRequired = 12,
/// <summary>
/// Other unspecified state.
/// </summary>
Other = 13
}
/// <summary>
/// Encryption level for secure transactions: 40-bit, 128-bit, or n-bit.
/// </summary>
public enum OSEncryptionLevel
{
/// <summary>
/// 40-bit encryption.
/// </summary>
Encrypt40Bits = 0,
/// <summary>
/// 128-bit encryption.
/// </summary>
Encrypt128Bits = 1,
/// <summary>
/// N-bit encryption.
/// </summary>
EncryptNBits = 2
}
/// <summary>
/// Indicates installed and licensed system product additions to the operating system.
/// </summary>
[SuppressMessage("Microsoft.Design", "CA1008:EnumsShouldHaveZeroValue", Justification = "The underlying MOF definition does not contain a zero value. The converter method will handle it appropriately.")]
[FlagsAttribute]
public enum OSProductSuite
{
/// <summary>
/// Microsoft Small Business Server was once installed, but may have
/// been upgraded to another version of Windows.
/// </summary>
SmallBusinessServer = 0x0001,
/// <summary>
/// Windows Server 2008 Enterprise is installed.
/// </summary>
Server2008Enterprise = 0x0002,
/// <summary>
/// Windows BackOffice components are installed.
/// </summary>
BackOfficeComponents = 0x0004,
/// <summary>
/// Communication Server is installed.
/// </summary>
CommunicationsServer = 0x0008,
/// <summary>
/// Terminal Services is installed.
/// </summary>
TerminalServices = 0x0010,
/// <summary>
/// Microsoft Small Business Server is installed with the restrictive
/// client license.
/// </summary>
SmallBusinessServerRestricted = 0x0020,
/// <summary>
/// Windows Embedded is installed.
/// </summary>
WindowsEmbedded = 0x0040,
/// <summary>
/// A Datacenter edition is installed.
/// </summary>
DatacenterEdition = 0x0080,
/// <summary>
/// Terminal Services is installed, but only one interactive session is supported.
/// </summary>
TerminalServicesSingleSession = 0x0100,
/// <summary>
/// Windows Home Edition is installed.
/// </summary>
HomeEdition = 0x0200,
/// <summary>
/// Web Server Edition is installed.
/// </summary>
WebServerEdition = 0x0400,
/// <summary>
/// Storage Server Edition is installed.
/// </summary>
StorageServerEdition = 0x2000,
/// <summary>
/// Compute Cluster Edition is installed.
/// </summary>
ComputeClusterEdition = 0x4000
}
/// <summary>
/// Indicates the operating system Stock Keeping Unit (SKU)
/// </summary>
public enum OperatingSystemSKU
{
/// <summary>
/// The SKU is undefined.
/// </summary>
Undefined = 0,
/// <summary>
/// SKU is Ultimate Edition.
/// </summary>
UltimateEdition = 1,
/// <summary>
/// SKU is Home Basic Edition.
/// </summary>
HomeBasicEdition = 2,
/// <summary>
/// SKU is Home Premium Edition.
/// </summary>
HomePremiumEdition = 3,
/// <summary>
/// SKU is Enterprise Edition.
/// </summary>
EnterpriseEdition = 4,
/// <summary>
/// SKU is Home Basic N Edition.
/// </summary>
HomeBasicNEdition = 5,
/// <summary>
/// SKU is Business Edition.
/// </summary>
BusinessEdition = 6,
/// <summary>
/// SKU is Standard Server Edition.
/// </summary>
StandardServerEdition = 7,
/// <summary>
/// SKU is Datacenter Server Edition.
/// </summary>
DatacenterServerEdition = 8,
/// <summary>
/// SKU is Small Business Server Edition.
/// </summary>
SmallBusinessServerEdition = 9,
/// <summary>
/// SKU is Enterprise Server Edition.
/// </summary>
EnterpriseServerEdition = 10,
/// <summary>
/// SKU is Starter Edition.
/// </summary>
StarterEdition = 11,
/// <summary>
/// SKU is Datacenter Server Core Edition.
/// </summary>
DatacenterServerCoreEdition = 12,
/// <summary>
/// SKU is Standard Server Core Edition.
/// </summary>
StandardServerCoreEdition = 13,
/// <summary>
/// SKU is Enterprise Server Core Edition.
/// </summary>
EnterpriseServerCoreEdition = 14,
/// <summary>
/// SKU is Enterprise Server IA64 Edition.
/// </summary>
EnterpriseServerIA64Edition = 15,
/// <summary>
/// SKU is Business N Edition.
/// </summary>
BusinessNEdition = 16,
/// <summary>
/// SKU is Web Server Edition.
/// </summary>
WebServerEdition = 17,
/// <summary>
/// SKU is Cluster Server Edition.
/// </summary>
ClusterServerEdition = 18,
/// <summary>
/// SKU is Home Server Edition.
/// </summary>
HomeServerEdition = 19,
/// <summary>
/// SKU is Storage Express Server Edition.
/// </summary>
StorageExpressServerEdition = 20,
/// <summary>
/// SKU is Storage Standard Server Edition.
/// </summary>
StorageStandardServerEdition = 21,
/// <summary>
/// SKU is Storage Workgroup Server Edition.
/// </summary>
StorageWorkgroupServerEdition = 22,
/// <summary>
/// SKU is Storage Enterprise Server Edition.
/// </summary>
StorageEnterpriseServerEdition = 23,
/// <summary>
/// SKU is Server For Small Business Edition.
/// </summary>
ServerForSmallBusinessEdition = 24,
/// <summary>
/// SKU is Small Business Server Premium Edition.
/// </summary>
SmallBusinessServerPremiumEdition = 25,
/// <summary>
/// SKU is to be determined.
/// </summary>
TBD = 26,
/// <summary>
/// SKU is Windows Enterprise.
/// </summary>
WindowsEnterprise = 27,
/// <summary>
/// SKU is Windows Ultimate.
/// </summary>
WindowsUltimate = 28,
/// <summary>
/// SKU is Web Server (core installation)
/// </summary>
WebServerCore = 29,
/// <summary>
/// SKU is Server Foundation.
/// </summary>
ServerFoundation = 33,
/// <summary>
/// SKU is Windows Home Server.
/// </summary>
WindowsHomeServer = 34,
/// <summary>
/// SKU is Windows Server Standard without Hyper-V.
/// </summary>
WindowsServerStandardNoHyperVFull = 36,
/// <summary>
/// SKU is Windows Server Datacenter without Hyper-V (full installation)
/// </summary>
WindowsServerDatacenterNoHyperVFull = 37,
/// <summary>
/// SKU is Windows Server Enterprise without Hyper-V (full installation)
/// </summary>
WindowsServerEnterpriseNoHyperVFull = 38,
/// <summary>
/// SKU is Windows Server Datacenter without Hyper-V (core installation)
/// </summary>
WindowsServerDatacenterNoHyperVCore = 39,
/// <summary>
/// SKU is Windows Server Standard without Hyper-V (core installation)
/// </summary>
WindowsServerStandardNoHyperVCore = 40,
/// <summary>
/// SKU is Windows Server Enterprise without Hyper-V (core installation)
/// </summary>
WindowsServerEnterpriseNoHyperVCore = 41,
/// <summary>
/// SKU is Microsoft Hyper-V Server.
/// </summary>
MicrosoftHyperVServer = 42,
/// <summary>
/// SKU is Storage Server Express (core installation)
/// </summary>
StorageServerExpressCore = 43,
/// <summary>
/// SKU is Storage Server Standard (core installation)
/// </summary>
StorageServerStandardCore = 44,
/// <summary>
/// SKU is Storage Server Workgroup (core installation)
/// </summary>
StorageServerWorkgroupCore = 45,
/// <summary>
/// SKU is Storage Server Enterprise (core installation)
/// </summary>
StorageServerEnterpriseCore = 46,
/// <summary>
/// SKU is Windows Small Business Server 2011 Essentials.
/// </summary>
WindowsSmallBusinessServer2011Essentials = 50,
/// <summary>
/// SKU is Small Business Server Premium (core installation)
/// </summary>
SmallBusinessServerPremiumCore = 63,
/// <summary>
/// SKU is Windows Server Hyper Core V.
/// </summary>
WindowsServerHyperCoreV = 64,
/// <summary>
/// SKU is Windows Thin PC.
/// </summary>
WindowsThinPC = 87,
/// <summary>
/// SKU is Windows Embedded Industry.
/// </summary>
WindowsEmbeddedIndustry = 89,
/// <summary>
/// SKU is Windows RT.
/// </summary>
WindowsRT = 97,
/// <summary>
/// SKU is Windows Home.
/// </summary>
WindowsHome = 101,
/// <summary>
/// SKU is Windows Professional with Media Center.
/// </summary>
WindowsProfessionalWithMediaCenter = 103,
/// <summary>
/// SKU is Windows Mobile.
/// </summary>
WindowsMobile = 104,
/// <summary>
/// SKU is Windows Embedded Handheld.
/// </summary>
WindowsEmbeddedHandheld = 118,
/// <summary>
/// SKU is Windows IoT (Internet of Things) Core.
/// </summary>
WindowsIotCore = 123
}
/// <summary>
/// Type of operating system.
/// </summary>
public enum OSType
{
/// <summary>
/// OS is unknown.
/// </summary>
Unknown = 0,
/// <summary>
/// OS is one other than covered by this Enum.
/// </summary>
Other = 1,
/// <summary>
/// OS is MacOS.
/// </summary>
MACROS = 2,
/// <summary>
/// OS is AT&T UNIX.
/// </summary>
ATTUNIX = 3,
/// <summary>
/// OS is DG/UX.
/// </summary>
DGUX = 4,
/// <summary>
/// OS is DECNT.
/// </summary>
DECNT = 5,
/// <summary>
/// OS is Digital UNIX.
/// </summary>
DigitalUNIX = 6,
/// <summary>
/// OS is OpenVMS.
/// </summary>
OpenVMS = 7,
/// <summary>
/// OS is HP-UX.
/// </summary>
HPUX = 8,
/// <summary>
/// OS is AIX.
/// </summary>
AIX = 9,
/// <summary>
/// OS is MVS.
/// </summary>
MVS = 10,
/// <summary>
/// OS is OS/400.
/// </summary>
OS400 = 11,
/// <summary>
/// OS is OS/2.
/// </summary>
OS2 = 12,
/// <summary>
/// OS is Java Virtual Machine.
/// </summary>
JavaVM = 13,
/// <summary>
/// OS is MS-DOS.
/// </summary>
MSDOS = 14,
/// <summary>
/// OS is Windows 3x.
/// </summary>
WIN3x = 15,
/// <summary>
/// OS is Windows 95.
/// </summary>
WIN95 = 16,
/// <summary>
/// OS is Windows 98.
/// </summary>
WIN98 = 17,
/// <summary>
/// OS is Windows NT.
/// </summary>
WINNT = 18,
/// <summary>
/// OS is Windows CE.
/// </summary>
WINCE = 19,
/// <summary>
/// OS is NCR System 3000.
/// </summary>
NCR3000 = 20,
/// <summary>
/// OS is NetWare.
/// </summary>
NetWare = 21,
/// <summary>
/// OS is OSF.
/// </summary>
OSF = 22,
/// <summary>
/// OS is DC/OS.
/// </summary>
DC_OS = 23,
/// <summary>
/// OS is Reliant UNIX.
/// </summary>
ReliantUNIX = 24,
/// <summary>
/// OS is SCO UnixWare.
/// </summary>
SCOUnixWare = 25,
/// <summary>
/// OS is SCO OpenServer.
/// </summary>
SCOOpenServer = 26,
/// <summary>
/// OS is Sequent.
/// </summary>
Sequent = 27,
/// <summary>
/// OS is IRIX.
/// </summary>
IRIX = 28,
/// <summary>
/// OS is Solaris.
/// </summary>
Solaris = 29,
/// <summary>
/// OS is SunOS.
/// </summary>
SunOS = 30,
/// <summary>
/// OS is U6000.
/// </summary>
U6000 = 31,
/// <summary>
/// OS is ASERIES.
/// </summary>
ASERIES = 32,
/// <summary>
/// OS is Tandem NSK.
/// </summary>
TandemNSK = 33,
/// <summary>
/// OS is Tandem NT.
/// </summary>
TandemNT = 34,
/// <summary>
/// OS is BS2000.
/// </summary>
BS2000 = 35,
/// <summary>
/// OS is Linux.
/// </summary>
LINUX = 36,
/// <summary>
/// OS is Lynx.
/// </summary>
Lynx = 37,
/// <summary>
/// OS is XENIX.
/// </summary>
XENIX = 38,
/// <summary>
/// OS is VM/ESA.
/// </summary>
VM_ESA = 39,
/// <summary>
/// OS is Interactive UNIX.
/// </summary>
InteractiveUNIX = 40,
/// <summary>
/// OS is BSD UNIX.
/// </summary>
BSDUNIX = 41,
/// <summary>
/// OS is FreeBSD.
/// </summary>
FreeBSD = 42,
/// <summary>
/// OS is NetBSD.
/// </summary>
NetBSD = 43,
/// <summary>
/// OS is GNU Hurd.
/// </summary>
GNUHurd = 44,
/// <summary>
/// OS is OS 9.
/// </summary>
OS9 = 45,
/// <summary>
/// OS is Mach Kernel.
/// </summary>
MACHKernel = 46,
/// <summary>
/// OS is Inferno.
/// </summary>
Inferno = 47,
/// <summary>
/// OS is QNX.
/// </summary>
QNX = 48,
/// <summary>
/// OS is EPOC.
/// </summary>
EPOC = 49,
/// <summary>
/// OS is IxWorks.
/// </summary>
IxWorks = 50,
/// <summary>
/// OS is VxWorks.
/// </summary>
VxWorks = 51,
/// <summary>
/// OS is MiNT.
/// </summary>
MiNT = 52,
/// <summary>
/// OS is BeOS.
/// </summary>
BeOS = 53,
/// <summary>
/// OS is HP MPE.
/// </summary>
HP_MPE = 54,
/// <summary>
/// OS is NextStep.
/// </summary>
NextStep = 55,
/// <summary>
/// OS is PalmPilot.
/// </summary>
PalmPilot = 56,
/// <summary>
/// OS is Rhapsody.
/// </summary>
Rhapsody = 57,
/// <summary>
/// OS is Windows 2000.
/// </summary>
Windows2000 = 58,
/// <summary>
/// OS is Dedicated.
/// </summary>
Dedicated = 59,
/// <summary>
/// OS is OS/390.
/// </summary>
OS_390 = 60,
/// <summary>
/// OS is VSE.
/// </summary>
VSE = 61,
/// <summary>
/// OS is TPF.
/// </summary>
TPF = 62
}
/// <summary>
/// Specifies the type of the computer in use, such as laptop, desktop, or Tablet.
/// </summary>
public enum PCSystemType
{
/// <summary>
/// System type is unspecified.
/// </summary>
Unspecified = 0,
/// <summary>
/// System is a desktop.
/// </summary>
Desktop = 1,
/// <summary>
/// System is a mobile device.
/// </summary>
Mobile = 2,
/// <summary>
/// System is a workstation.
/// </summary>
Workstation = 3,
/// <summary>
/// System is an Enterprise Server.
/// </summary>
EnterpriseServer = 4,
/// <summary>
/// System is a Small Office and Home Office (SOHO) Server.
/// </summary>
SOHOServer = 5,
/// <summary>
/// System is an appliance PC.
/// </summary>
AppliancePC = 6,
/// <summary>
/// System is a performance server.
/// </summary>
PerformanceServer = 7,
/// <summary>
/// Maximum enum value.
/// </summary>
Maximum = 8
}
/// <summary>
/// Specifies the type of the computer in use, such as laptop, desktop, or Tablet.
/// This is an extended version of PCSystemType.
/// </summary>
// TODO: conflate these two enums???
public enum PCSystemTypeEx
{
/// <summary>
/// System type is unspecified.
/// </summary>
Unspecified = 0,
/// <summary>
/// System is a desktop.
/// </summary>
Desktop = 1,
/// <summary>
/// System is a mobile device.
/// </summary>
Mobile = 2,
/// <summary>
/// System is a workstation.
/// </summary>
Workstation = 3,
/// <summary>
/// System is an Enterprise Server.
/// </summary>
EnterpriseServer = 4,
/// <summary>
/// System is a Small Office and Home Office (SOHO) Server.
/// </summary>
SOHOServer = 5,
/// <summary>
/// System is an appliance PC.
/// </summary>
AppliancePC = 6,
/// <summary>
/// System is a performance server.
/// </summary>
PerformanceServer = 7,
/// <summary>
/// System is a Slate.
/// </summary>
Slate = 8,
/// <summary>
/// Maximum enum value.
/// </summary>
Maximum = 9
}
/// <summary>
/// Specifies power-related capabilities of a logical device.
/// </summary>
public enum PowerManagementCapabilities
{
/// <summary>
/// Unknown capability.
/// </summary>
Unknown = 0,
/// <summary>
/// Power management not supported.
/// </summary>
NotSupported = 1,
/// <summary>
/// Power management features are currently disabled.
/// </summary>
Disabled = 2,
/// <summary>
/// The power management features are currently enabled,
/// but the exact feature set is unknown or the information is unavailable.
/// </summary>
Enabled = 3,
/// <summary>
/// The device can change its power state based on usage or other criteria.
/// </summary>
PowerSavingModesEnteredAutomatically = 4,
/// <summary>
/// The power state may be set through the Win32_LogicalDevice class.
/// </summary>
PowerStateSettable = 5,
/// <summary>
/// Power may be done through the Win32_LogicalDevice class.
/// </summary>
PowerCyclingSupported = 6,
/// <summary>
/// Timed power-on is supported.
/// </summary>
TimedPowerOnSupported = 7
}
/// <summary>
/// Specified power states.
/// </summary>
public enum PowerState
{
/// <summary>
/// Power state is unknown.
/// </summary>
Unknown = 0,
/// <summary>
/// Full power.
/// </summary>
FullPower = 1,
/// <summary>
/// Power Save - Low Power mode.
/// </summary>
PowerSaveLowPowerMode = 2,
/// <summary>
/// Power Save - Standby.
/// </summary>
PowerSaveStandby = 3,
/// <summary>
/// Unknown Power Save mode.
/// </summary>
PowerSaveUnknown = 4,
/// <summary>
/// Power Cycle.
/// </summary>
PowerCycle = 5,
/// <summary>
/// Power Off.
/// </summary>
PowerOff = 6,
/// <summary>
/// Power Save - Warning.
/// </summary>
PowerSaveWarning = 7,
/// <summary>
/// Power Save - Hibernate.
/// </summary>
PowerSaveHibernate = 8,
/// <summary>
/// Power Save - Soft off.
/// </summary>
PowerSaveSoftOff = 9
}
/// <summary>
/// Specifies the primary function of a processor.
/// </summary>
[SuppressMessage("Microsoft.Design", "CA1008:EnumsShouldHaveZeroValue", Justification = "The underlying MOF definition does not contain a zero value. The converter method will handle it appropriately.")]
public enum ProcessorType
{
/// <summary>
/// Processor ype is other than provided in these enumeration values.
/// </summary>
Other = 1,
/// <summary>
/// Processor type is.
/// </summary>
Unknown = 2,
/// <summary>
/// Processor is a Central Processing Unit (CPU)
/// </summary>
CentralProcessor = 3,
/// <summary>
/// Processor is a Math processor.
/// </summary>
MathProcessor = 4,
/// <summary>
/// Processor is a Digital Signal processor (DSP)
/// </summary>
DSPProcessor = 5,
/// <summary>
/// Processor is a Video processor.
/// </summary>
VideoProcessor = 6
}
/// <summary>
/// Specifies a computer's reset capability.
/// </summary>
[SuppressMessage("Microsoft.Design", "CA1008:EnumsShouldHaveZeroValue", Justification = "The underlying MOF definition does not contain a zero value. The converter method will handle it appropriately.")]
public enum ResetCapability
{
/// <summary>
/// Capability is a value other than provided in these enumerated values.
/// </summary>
Other = 1,
/// <summary>
/// Reset capability is unknown.
/// </summary>
Unknown = 2,
/// <summary>
/// Capability is disabled.
/// </summary>
Disabled = 3,
/// <summary>
/// Capability is enabled.
/// </summary>
Enabled = 4,
/// <summary>
/// Capability is not implemented.
/// </summary>
NotImplemented = 5
}
/// <summary>
/// Specifies the kind of event that causes a computer to power up.
/// </summary>
[SuppressMessage("Microsoft.Design", "CA1008:EnumsShouldHaveZeroValue", Justification = "The underlying MOF definition does not contain a zero value. The converter method will handle it appropriately.")]
public enum WakeUpType
{
// <summary>
// This value is reserved
// </summary>
// Reserved = 0,
/// <summary>
/// An event other than specified in this enumeration.
/// </summary>
Other = 1,
/// <summary>
/// Event type is unknown.
/// </summary>
Unknown = 2,
/// <summary>
/// Event is APM timer.
/// </summary>
APMTimer = 3,
/// <summary>
/// Event is a Modem Ring.
/// </summary>
ModemRing = 4,
/// <summary>
/// Event is a LAN Remove.
/// </summary>
LANRemote = 5,
/// <summary>
/// Event is a power switch.
/// </summary>
PowerSwitch = 6,
/// <summary>
/// Event is a PCI PME# signal.
/// </summary>
PCIPME = 7,
/// <summary>
/// AC power was restored.
/// </summary>
ACPowerRestored = 8
}
/// <summary>
/// Indicates the OEM's preferred power management profile.
/// </summary>
public enum PowerPlatformRole
{
/// <summary>
/// The OEM did not specify a specific role.
/// </summary>
Unspecified = 0,
/// <summary>
/// The OEM specified a desktop role.
/// </summary>
Desktop = 1,
/// <summary>
/// The OEM specified a mobile role (for example, a laptop)
/// </summary>
Mobile = 2,
/// <summary>
/// The OEM specified a workstation role.
/// </summary>
Workstation = 3,
/// <summary>
/// The OEM specified an enterprise server role.
/// </summary>
EnterpriseServer = 4,
/// <summary>
/// The OEM specified a single office/home office (SOHO) server role.
/// </summary>
SOHOServer = 5,
/// <summary>
/// The OEM specified an appliance PC role.
/// </summary>
AppliancePC = 6,
/// <summary>
/// The OEM specified a performance server role.
/// </summary>
PerformanceServer = 7, // v1 last supported
/// <summary>
/// The OEM specified a tablet form factor role.
/// </summary>
Slate = 8, // v2 last supported
/// <summary>
/// Max enum value.
/// </summary>
MaximumEnumValue
}
/// <summary>
/// Additional system information, from Win32_OperatingSystem.
/// </summary>
public enum ProductType
{
/// <summary>
/// Product type is unknown.
/// </summary>
Unknown = 0, // this value is not specified in Win32_OperatingSystem, but may prove useful
/// <summary>
/// System is a workstation.
/// </summary>
WorkStation = 1,
/// <summary>
/// System is a domain controller.
/// </summary>
DomainController = 2,
/// <summary>
/// System is a server.
/// </summary>
Server = 3
}
/// <summary>
/// Specifies the system server level.
/// </summary>
public enum ServerLevel
{
/// <summary>
/// An unknown or unrecognized level was detected.
/// </summary>
Unknown = 0,
/// <summary>
/// Nano server.
/// </summary>
NanoServer,
/// <summary>
/// Server core.
/// </summary>
ServerCore,
/// <summary>
/// Server core with management tools.
/// </summary>
ServerCoreWithManagementTools,
/// <summary>
/// Full server.
/// </summary>
FullServer
}
/// <summary>
/// State of a software element.
/// </summary>
public enum SoftwareElementState
{
/// <summary>
/// Software element is deployable.
/// </summary>
Deployable = 0,
/// <summary>
/// Software element is installable.
/// </summary>
Installable = 1,
/// <summary>
/// Software element is executable.
/// </summary>
Executable = 2,
/// <summary>
/// Software element is running.
/// </summary>
Running = 3
}
#endregion Enums used in the output objects
#endregion Output components
#region Native
internal static partial class Native
{
private static class PInvokeDllNames
{
public const string GetPhysicallyInstalledSystemMemoryDllName = "api-ms-win-core-sysinfo-l1-2-1.dll";
public const string PowerDeterminePlatformRoleExDllName = "api-ms-win-power-base-l1-1-0.dll";
public const string GetFirmwareTypeDllName = "api-ms-win-core-kernel32-legacy-l1-1-1";
}
public const int LOCALE_NAME_MAX_LENGTH = 85;
public const uint POWER_PLATFORM_ROLE_V1 = 0x1;
public const uint POWER_PLATFORM_ROLE_V2 = 0x2;
public const uint S_OK = 0;
/// <summary>
/// Import WINAPI function PowerDeterminePlatformRoleEx.
/// </summary>
/// <param name="version">The version of the POWER_PLATFORM_ROLE enumeration for the platform.</param>
/// <returns>POWER_PLATFORM_ROLE enumeration.</returns>
[LibraryImport(PInvokeDllNames.PowerDeterminePlatformRoleExDllName, EntryPoint = "PowerDeterminePlatformRoleEx")]
public static partial uint PowerDeterminePlatformRoleEx(uint version);
/// <summary>
/// Retrieve the amount of RAM physically installed in the computer.
/// </summary>
/// <param name="MemoryInKilobytes"></param>
/// <returns></returns>
[LibraryImport(PInvokeDllNames.GetPhysicallyInstalledSystemMemoryDllName)]
[return: MarshalAs(UnmanagedType.Bool)]
public static partial bool GetPhysicallyInstalledSystemMemory(out ulong MemoryInKilobytes);
/// <summary>
/// Retrieve the firmware type of the local computer.
/// </summary>
/// <param name="firmwareType">
/// A reference to a <see cref="FirmwareType"/> enumeration to contain
/// the resultant firmware type
/// </param>
/// <returns></returns>
[LibraryImport(PInvokeDllNames.GetFirmwareTypeDllName)]
[return: MarshalAs(UnmanagedType.Bool)]
public static partial bool GetFirmwareType(out FirmwareType firmwareType);
/// <summary>
/// Gets the data specified for the passed in property name from the
/// Software Licensing API.
/// </summary>
/// <param name="licenseProperty">Name of the licensing property to get.</param>
/// <param name="propertyValue">Out parameter for the value.</param>
/// <returns>An hresult indicating success or failure.</returns>
[LibraryImport("slc.dll", StringMarshalling = StringMarshalling.Utf16)]
internal static partial int SLGetWindowsInformationDWORD(string licenseProperty, out int propertyValue);
}
#endregion Native
}
#endif
|