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?
See code below for what I've tried.
(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'
I get the expected result but it is slow.