title: PowerShell Windows License Type
body: <p>I am trying to pull the Windows license type, I can do it with the following command but it takes forever, is there a quicker PowerShell command for accomplishing this?</p>
  
  <p>See code below for what I've tried.</p>
  
  <pre><code>(Get-CimInstance SoftwareLicensingProduct |
      Where-Object -FilterScript { ($_.Description -like "W*" -and $_.licensestatus -eq 1 ) } |
          Select-Object -first 1 -ExpandProperty Description ) -replace '.*(VOLUME_MAK|OEM_SLP|RETAIL|OEM_COA_NSLP|OEM_COA_SLP).*', '$1'
  </code></pre>
  
  <p>I get the expected result but it is slow.</p>