Office 365 Licensing

Welcome Forums General PowerShell Q&A Office 365 Licensing

Viewing 6 reply threads
  • Author
    Posts
    • #176014
      Participant
      Topics: 1
      Replies: 3
      Points: 36
      Rank: Member

      Is there any way to find how many users are provisioned in office 365 licensing and how many users are pending on Office 365 License.

       

      I found something like this

      $collections = @()
      Get-MsolUser -All | ? {$_.isLicensed -eq $true} |%{
       foreach($l in $_.Licenses.ServiceStatus)
       {
        $data = New-Object psObject -Property @{
        ObjectID = $_.ObjectID
        UPN = $_.UserPrincipalName
        ServiceName = $l.ServicePlan.ServiceName
        ServiceStatus = $l.ProvisioningStatus
        }
       $collections += $data
       }
      }
      $collections | Export-Csv C:TempLicenseInformation.csv -NoTypeInformation
      
    • #176242
      Participant
      Topics: 10
      Replies: 116
      Points: 450
      Helping Hand
      Rank: Contributor

      Hi V3manku,

      To adequately help, you'll need to specify more detail.

      Are you wanting to find out the number of Office 365 provisioned/pending? All apps (SKUs) or just Office? What type of output are you expecting, a table with total counts? There are multiple types of ProvisioningStatus available, which are you wanting (Success, PendingActivation, PendingProvisioning, Disabled, all of them, etc.)?

    • #176260
      Participant
      Topics: 1
      Replies: 3
      Points: 36
      Rank: Member

      Hi Aaron

      Thank you for your reply. Here is the situation –

      1. My provisioning script provisioned assigned 600  E3 licenses and i could see E3 license in the negative (any number, let's say 600).
      2. There is no way for me to find out how many licenses are assigned each day so i can see from reporting perspective.

      Now i want to find how – i will get reporting of my Office 365 E3 or E1 licenses. Also If if office 365 shows 10 users are pending on liceses, how will i find those pending users.

      Thank you in advance, i really appreciate your reply.

    • #176302
      Participant
      Topics: 10
      Replies: 116
      Points: 450
      Helping Hand
      Rank: Contributor

      If I understand you correctly, the example script below should get the information you're after:

      # Output account SKUs owned by company
      Get-MsolAccountSku
      
      AccountSkuId                                ActiveUnits WarningUnits ConsumedUnits
      ------------                                ----------- ------------ -------------
      tenantname:STREAM                           1000000     0            0
      tenantname:POWERAPPS_INDIVIDUAL_USER        10000       0            18
      tenantname:STANDARDWOFFPACK_IW_FACULTY      500000      0            50
      tenantname:WINDOWS_STORE                    25          0            0
      tenantname:STANDARDWOFFPACK_STUDENT         201         0            0
      tenantname:STANDARDWOFFPACK_IW_STUDENT      1000000     0            224
      tenantname:FLOW_FREE                        10000       0            11
      tenantname:POWERAPPS_VIRAL                  10000       0            12
      tenantname:M365EDU_A3_FACULTY               1           0            1
      tenantname:STANDARDWOFFPACK_FACULTY         50          0            0
      

      To check user accounts that have "STANDARDWOFFPACK_IW_FACULTY" (Office Pro Plus A1 for faculty) assigned, simply run this code:

      $skuPartNumber = 'STANDARDWOFFPACK_IW_FACULTY'
      $assignedProPlusA1Licenses = Get-MsolUser | Where-Object -FilterScript { $_.Licenses.AccountSku.SkuPartNumber -match 'STANDARDWOFFPACK_IW_FACULTY' }
      
      # Output the UPNs with the assigned license
      $assignedProPlusA1Licenses
      
      # Confirm the count of licenses matches the ConsumedUnits
      $assignedProPlusA1Licenses.Count

      You can also loop through all the SKUs in the Get-MsolAccountSku output and group them by license (E1 or E3).

      Edit: no changes, just corrected formatting.

    • #176413
      Participant
      Topics: 1
      Replies: 3
      Points: 36
      Rank: Member

      Thanks Aaron, somehow i am not able to attach a picture. You must have seen in licensing view , its says let's say 600 users need valid licenses. I want to find those users pending on Licenses.

    • #176527
      Jon
      Participant
      Topics: 13
      Replies: 221
      Points: 117
      Rank: Participant
      
      $cred = get-credential
      
      Connect-MsolService -Credential $cred
      
      $Users = Get-Msoluser -all
      
      $results = ForEach ($user in $users) {
      ForEach ($license in $user.licenses.servicestatus) {
      $props = @{'UPN'=$user.userprincipalname
      'Name' = $license.ServicePlan.ServiceName
      'Status' = $license.ProvisioningStatus}
      
      New-Object -Type PSObject -Prop $props
      }
      }
      
      $results | where {$_.status -like "*pending*"}
      
      

      You can do whatever you want with the results variable, the where filter I used was just an example

    • #178407
      Participant
      Topics: 1
      Replies: 3
      Points: 36
      Rank: Member

      Thank you so much Aaron for solution. Awesome , apologies for delayed response.

Viewing 6 reply threads
  • You must be logged in to reply to this topic.