A small PowerShell script that lists all users that have the specified Office 365 AccountSkuid enabled on their account.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
<# .Synopsis Get-Office365AccountSkuLicensedUsers .DESCRIPTION The Get-Office365AccountSkuLicensedUsers cmdlet retrieves the users that have a specific Office 365 subscription (AccountSkuId) assigned. .EXAMPLE Get-Office365LicenseInfo .PARAMETER AccountSkuId The name of an Office 365 AccountSkuId A list of known AccountSkuId's pre-populated. Extend the list if needed, a list of known AccountSkuIDs can be found here: # http://blogs.technet.com/b/treycarlee/archive/2013/11/01/list-of-powershell-licensing-sku-s-for-office-365.aspx Other usefull sources related to licensing # https://technet.microsoft.com/en-us/library/dn771771.aspx # https://technet.microsoft.com/en-us/library/dn771773.aspx Version 1.1 - added ENTERPRISEWITHSCAL license option #> function Get-Office365AccountSkuLicensedUsers { [CmdletBinding()] [Alias()] Param ( # AccountSkuId [Parameter(Mandatory=$true, ParameterSetName = "AccountSkuId", ValueFromPipelineByPropertyName=$true, Position=0)] [ValidateSet("ENTERPRISEPACK","RIGHTSMANAGEMENT","AAD_PREMIUM","PLANNERSTANDALONE","POWER_BI_STANDARD","ENTERPRISEWITHSCAL")] $AccountSkuId ) Begin { } Process { If ($PSBoundParameters.ContainsKey("AccountSkuId")) { $AccountSkuIdUsers = Get-MsolUser | Select-Object DisplayName,UserPrincipalName -ExpandProperty Licenses | Where-Object {$_.AccountSkuId -like "*$AccountSkuId*"} $AccountSkuIdUsers | Select-Object DisplayName,UserPrincipalName } } End { } } |