WMI Queries to pull available and total licenses and calculate % usage. Filtering out $_.totallicenses -ne "0" -and $_.availablelicenses -ne "4294967295" is just a quick way of identifying built-in licenses.
Note: If you're having issues with components showing up unknown, try extending the timeout on template. Default is 300 seconds. I have found going to 600 to help when running PowerShell queries.