| | 72 | |
| | 73 | /// <summary> |
| | 74 | /// Gets the edition of Windows that is currently running. This will only |
| | 75 | /// return a valid result for operating systems later than or equal to |
| | 76 | /// Windows Vista (RTM). All other operating systems will return |
| | 77 | /// <see cref="WindowsEditions.Undefined"/>. |
| | 78 | /// </summary> |
| | 79 | public static WindowsEditions WindowsEdition |
| | 80 | { |
| | 81 | get |
| | 82 | { |
| | 83 | if (Environment.OSVersion.Platform != PlatformID.Win32NT || |
| | 84 | Environment.OSVersion.Version.Major < 6) |
| | 85 | { |
| | 86 | return WindowsEditions.Undefined; |
| | 87 | } |
| | 88 | |
| | 89 | WindowsEditions result; |
| | 90 | NativeMethods.GetProductInfo(6u, 1u, 0u, 0u, out result); |
| | 91 | return result; |
| | 92 | } |
| | 93 | } |
| | 94 | } |
| | 95 | |
| | 96 | public enum WindowsEditions |
| | 97 | { |
| | 98 | /// <summary> |
| | 99 | /// Business |
| | 100 | /// </summary> |
| | 101 | Business = 0x00000006, |
| | 102 | |
| | 103 | /// <summary> |
| | 104 | /// Business N |
| | 105 | /// </summary> |
| | 106 | BusinessN = 0x00000010, |
| | 107 | |
| | 108 | /// <summary> |
| | 109 | /// HPC Edition |
| | 110 | /// </summary> |
| | 111 | ClusterServer = 0x00000012, |
| | 112 | |
| | 113 | /// <summary> |
| | 114 | /// Server Datacenter (full installation) |
| | 115 | /// </summary> |
| | 116 | DatacenterServer = 0x00000008, |
| | 117 | |
| | 118 | /// <summary> |
| | 119 | /// Server Datacenter (core installation) |
| | 120 | /// </summary> |
| | 121 | DatacenterServerCore = 0x0000000C, |
| | 122 | |
| | 123 | /// <summary> |
| | 124 | /// Server Datacenter without Hyper-V (core installation) |
| | 125 | /// </summary> |
| | 126 | DatacenterServerCoreV = 0x00000027, |
| | 127 | |
| | 128 | /// <summary> |
| | 129 | /// Server Datacenter without Hyper-V (full installation) |
| | 130 | /// </summary> |
| | 131 | DatacenterServerV = 0x00000025, |
| | 132 | |
| | 133 | /// <summary> |
| | 134 | /// Enterprise |
| | 135 | /// </summary> |
| | 136 | Enterprise = 0x00000004, |
| | 137 | |
| | 138 | /// <summary> |
| | 139 | /// Enterprise E |
| | 140 | /// </summary> |
| | 141 | EnterpriseE = 0x00000046, |
| | 142 | |
| | 143 | /// <summary> |
| | 144 | /// Enterprise N |
| | 145 | /// </summary> |
| | 146 | EnterpriseN = 0x0000001B, |
| | 147 | |
| | 148 | /// <summary> |
| | 149 | /// Server Enterprise (full installation) |
| | 150 | /// </summary> |
| | 151 | EnterpriseServer = 0x0000000A, |
| | 152 | |
| | 153 | /// <summary> |
| | 154 | /// Server Enterprise (core installation) |
| | 155 | /// </summary> |
| | 156 | EnterpriseServerCore = 0x0000000E, |
| | 157 | |
| | 158 | /// <summary> |
| | 159 | /// Server Enterprise without Hyper-V (core installation) |
| | 160 | /// </summary> |
| | 161 | EnterpriseServerCoreV = 0x00000029, |
| | 162 | |
| | 163 | /// <summary> |
| | 164 | /// Server Enterprise for Itanium-based Systems |
| | 165 | /// </summary> |
| | 166 | EnterpriseServerIA64 = 0x0000000F, |
| | 167 | |
| | 168 | /// <summary> |
| | 169 | /// Server Enterprise without Hyper-V (full installation) |
| | 170 | /// </summary> |
| | 171 | EnterpriseServerV = 0x00000026, |
| | 172 | |
| | 173 | /// <summary> |
| | 174 | /// Home Basic |
| | 175 | /// </summary> |
| | 176 | HomeBasic = 0x00000002, |
| | 177 | |
| | 178 | /// <summary> |
| | 179 | /// Home Basic E |
| | 180 | /// </summary> |
| | 181 | HomeBasicE = 0x00000043, |
| | 182 | |
| | 183 | /// <summary> |
| | 184 | /// Home Basic N |
| | 185 | /// </summary> |
| | 186 | HomeBasicN = 0x00000005, |
| | 187 | |
| | 188 | /// <summary> |
| | 189 | /// Home Premium |
| | 190 | /// </summary> |
| | 191 | HomePremium = 0x00000003, |
| | 192 | |
| | 193 | /// <summary> |
| | 194 | /// Home Premium E |
| | 195 | /// </summary> |
| | 196 | HomePremiumE = 0x00000044, |
| | 197 | |
| | 198 | /// <summary> |
| | 199 | /// Home Premium N |
| | 200 | /// </summary> |
| | 201 | HomePremiumN = 0x0000001A, |
| | 202 | |
| | 203 | /// <summary> |
| | 204 | /// Microsoft Hyper-V Server |
| | 205 | /// </summary> |
| | 206 | HyperV = 0x0000002A, |
| | 207 | |
| | 208 | /// <summary> |
| | 209 | /// Windows Essential Business Server Management Server |
| | 210 | /// </summary> |
| | 211 | MediumBusinessServerManagement = 0x0000001E, |
| | 212 | |
| | 213 | /// <summary> |
| | 214 | /// Windows Essential Business Server Messaging Server |
| | 215 | /// </summary> |
| | 216 | MediumBusinessServerMessaging = 0x00000020, |
| | 217 | |
| | 218 | /// <summary> |
| | 219 | /// Windows Essential Business Server Security Server |
| | 220 | /// </summary> |
| | 221 | MediumBusinessServerSecurity = 0x0000001F, |
| | 222 | |
| | 223 | /// <summary> |
| | 224 | /// Professional |
| | 225 | /// </summary> |
| | 226 | Professional = 0x00000030, |
| | 227 | |
| | 228 | /// <summary> |
| | 229 | /// Professional E |
| | 230 | /// </summary> |
| | 231 | ProfessionalE = 0x00000045, |
| | 232 | |
| | 233 | /// <summary> |
| | 234 | /// Professional N |
| | 235 | /// </summary> |
| | 236 | ProfessionalN = 0x00000031, |
| | 237 | |
| | 238 | /// <summary> |
| | 239 | /// Windows Server 2008 for Windows Essential Server Solutions |
| | 240 | /// </summary> |
| | 241 | ServerForSmallBusiness = 0x00000018, |
| | 242 | |
| | 243 | /// <summary> |
| | 244 | /// Windows Server 2008 without Hyper-V for Windows Essential Server Solutions |
| | 245 | /// </summary> |
| | 246 | ServerForSmallBusinessV = 0x00000023, |
| | 247 | |
| | 248 | /// <summary> |
| | 249 | /// Server Foundation |
| | 250 | /// </summary> |
| | 251 | ServerFoundation = 0x00000021, |
| | 252 | |
| | 253 | /// <summary> |
| | 254 | /// Windows Small Business Server |
| | 255 | /// </summary> |
| | 256 | SmallBusinessServer = 0x00000009, |
| | 257 | |
| | 258 | /// <summary> |
| | 259 | /// Server Standard (full installation) |
| | 260 | /// </summary> |
| | 261 | StandardServer = 0x00000007, |
| | 262 | |
| | 263 | /// <summary> |
| | 264 | /// Server Standard (core installation) |
| | 265 | /// </summary> |
| | 266 | StandardServerCore = 0x0000000D, |
| | 267 | |
| | 268 | /// <summary> |
| | 269 | /// Server Standard without Hyper-V (core installation) |
| | 270 | /// </summary> |
| | 271 | StandardServerCoreV = 0x00000028, |
| | 272 | |
| | 273 | /// <summary> |
| | 274 | /// Server Standard without Hyper-V (full installation) |
| | 275 | /// </summary> |
| | 276 | StandardServerV = 0x00000024, |
| | 277 | |
| | 278 | /// <summary> |
| | 279 | /// Starter |
| | 280 | /// </summary> |
| | 281 | Starter = 0x0000000B, |
| | 282 | |
| | 283 | /// <summary> |
| | 284 | /// Starter E |
| | 285 | /// </summary> |
| | 286 | StarterE = 0x00000042, |
| | 287 | |
| | 288 | /// <summary> |
| | 289 | /// Starter N |
| | 290 | /// </summary> |
| | 291 | StarterN = 0x0000002F, |
| | 292 | |
| | 293 | /// <summary> |
| | 294 | /// Storage Server Enterprise |
| | 295 | /// </summary> |
| | 296 | StorageEnterpriseServer = 0x00000017, |
| | 297 | |
| | 298 | /// <summary> |
| | 299 | /// Storage Server Express |
| | 300 | /// </summary> |
| | 301 | StorageExpressServer = 0x00000014, |
| | 302 | |
| | 303 | /// <summary> |
| | 304 | /// Storage Server Standard |
| | 305 | /// </summary> |
| | 306 | StorageStandardServer = 0x00000015, |
| | 307 | |
| | 308 | /// <summary> |
| | 309 | /// Storage Server Workgroup |
| | 310 | /// </summary> |
| | 311 | StorageWorkgroupServer = 0x00000016, |
| | 312 | |
| | 313 | /// <summary> |
| | 314 | /// An unknown product |
| | 315 | /// </summary> |
| | 316 | Undefined = 0x00000000, |
| | 317 | |
| | 318 | /// <summary> |
| | 319 | /// Ultimate |
| | 320 | /// </summary> |
| | 321 | Ultimate = 0x00000001, |
| | 322 | |
| | 323 | /// <summary> |
| | 324 | /// Ultimate E |
| | 325 | /// </summary> |
| | 326 | UltimateE = 0x00000047, |
| | 327 | |
| | 328 | /// <summary> |
| | 329 | /// Ultimate N |
| | 330 | /// </summary> |
| | 331 | UltimateN = 0x0000001C, |
| | 332 | |
| | 333 | /// <summary> |
| | 334 | /// Web Server (full installation) |
| | 335 | /// </summary> |
| | 336 | WebServer = 0x00000011, |
| | 337 | |
| | 338 | /// <summary> |
| | 339 | /// Web Server (core installation) |
| | 340 | /// </summary> |
| | 341 | WebServerCore = 0x0000001D |