Identifying Operating System Details

by Jul 7, 2020

WMI returns a cryptic number when you ask for operating system details:

 
PS> Get-CimInstance -ClassName Win32_OperatingSystem | 
      Select-Object -ExpandProperty SuiteMask
272 
 

SuiteMask really is a bitmask where each bit stands for a specific detail. To turn this into readable text, use a flag enumeration:

$SuiteMask = @{
  Name = 'SuiteMaskText'
  Expression = {
    [Flags()] Enum EnumSuiteMask
    {
      SmallBusinessServer             = 1
      Server2008Enterprise            = 2
      BackOfficeComponents            = 4
      CommunicationsServer            = 8
      TerminalServices                = 16
      SmallBusinessServerRestricted   = 32
      WindowsEmbedded                 = 64
      DatacenterEdition               = 128
      TerminalServicesSingleSession   = 256
      HomeEdition                     = 512
      WebServerEdition                = 1024
      StorageServerEdition            = 8192
      ComputeClusterEdition           = 16384
    }
    
    [EnumSuiteMask][int]$_.SuiteMask
  }  
}

Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object -Property Caption, SuiteMask, $SuiteMask

This adds a calculated SuiteMaskText property which lists the installed operating system extensions:

 
Caption                  SuiteMask                                   SuiteMaskText
-------                  ---------                                   -------------
Microsoft Windows 10 Pro       272 TerminalServices, TerminalServicesSingleSession  
 


Twitter This Tip! ReTweet this Tip!