Get all E3 User with Intune open selected

lalajee 1,811 Reputation points
2023-11-16T12:08:21.39+00:00

Hi,

Is it possible to get list of all users who has Intune Option Turn on

I like to get all user which have E3 with Intune Option turn on

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,108 questions
Microsoft Intune
Microsoft Intune
A Microsoft cloud-based management solution that offers mobile device management, mobile application management, and PC management capabilities.
4,589 questions
PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,232 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Crystal-MSFT 45,086 Reputation points Microsoft Vendor
    2023-11-17T02:57:37.75+00:00

    @lalajee, Thanks or posting in Q&A. Based on my testing, to query the user who has Microsoft Intune license assigned, you can run the following PowerShell commands and enter Global administrator account to query the information:

    install-module MSOnline
    import-module MSOnline
    Connect-MsolService
    
    $Users = Get-MsolUser -All
    Write-Host "The user who has Intune license assigned"
    foreach ($User in $Users) 
    {
    
              $ServiceStatus = $user.licenses.ServiceStatus
              $ProvisionName = $ServiceStatus | Where {$_.ServicePlan.ServiceName -eq "INTUNE_A" }
    
              $Data = [PSCustomObject]@{
                   "USER" = $User.UserPrincipalName
                   "Software" = $ProvisionName.ServicePlan.ServiceName
                   "Status" = $ProvisionName.ProvisioningStatus
              }
    
              if($Data.Status -eq "Success" -or $Data.Status -eq "PendingInput")
              {
              Write-Host $Data.USER+ $Data.Software
                          }
              }
    

    User's image

    Hope the above information can help.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


  2. Nick Eckermann 461 Reputation points
    2023-11-17T16:38:54.9466667+00:00

    I would recommend you move to group-based licensing so you can control this better. Direct licensing with some selections for some users and not for others can be a pain.

    https://learn.microsoft.com/en-us/entra/fundamentals/concept-group-based-licensing

    You can migrate them, but make sure you plan accordingly. You can look at the script examples to help with the migration.

    https://learn.microsoft.com/en-us/entra/identity/users/licensing-groups-migrate-users
    https://learn.microsoft.com/en-us/entra/identity/users/licensing-ps-examples

    As far as fixing the script for just E3 users

    Run Get-MsolAccountSku to find your E3 SKU name

    Then modify this section.

    $Users = Get-MsolUser -All | Where-Object {$_.Licenses.AccountSkuId -eq 'tenantName:SKU'}