Monthly Archives: November 2017

Quick Script: Office 365 License Information for Skype and Teams

I found myself in need of a specific script during a tenant migration, one that only included information about Skype for Business Online and Microsoft Teams.  There wasn’t anything out there that exactly matched what I needed, so I created the following with a bit of reverse engineering and help from support.office.com.  If the script is at all helpful, please feel free to use it, hack it up, send me improvements, whatever you’d like.

The outputs of the script is a CSV and a GridView showing the results of the license data.  The names of the licenses are a bit cryptic, but I’ll summarize them below:

  • TEAMS1- Microsoft Teams
  • MCOSTANDARD – Skype for Business Plan 2
  • MCOMEETADV – Audio Conferencing (formerly PSTN Conferencing)
  • MCOEV – Phone System (formerly Cloud PBX)
  • MCOPSTN1 – Domestic Calling Plan
  • MCOPSTN2 – International Calling Plan
  • MCOPSTNPP – Communication Credits

I’m not certain I grabbed all of the values, so please comment and help me improve the script.

The script itself should be run after you connect to your tenant via PowerShell.  If you’re not sure how, read the following article: https://technet.microsoft.com/en-us/library/dn975125.aspx but in a nutshell, you’ll need to download a PowerShell module and run the Connect-MsolService command.

Once you’re connected, the script to run is here:

$LICENSEOBJECT = @()
$ALLUSERS=Get-MSOLUser -all
$ALLUSERSCOUNT=$ALLUSERS.COUNT
$COUNTER=0

foreach($msolUser in $ALLUSERS)
 {
  $COUNTER++
  $MCOEV=""
  $MCOMEETADV=""
  $MCOSTANDARD=""
  $MCOPSTN1=""
  $MCOPSTN2=""
  $MCOPSTNPP=""  
  $TEAMS1=""

  $UserInfo = Get-MSOLUser -UserPrincipalName $msolUser.UserPrincipalName
  foreach($license in $msolUser.Licenses)
   {
    if ($license.servicestatus|where {$_.serviceplan.servicename -like "MCOEV"}) 
     {
      $MCOEV=$license.servicestatus|where {$_.serviceplan.servicename -like "MCOEV"}
     }
       
    if ($license.servicestatus|where {$_.serviceplan.servicename -like "MCOMEETADV"}) 
     {
      $MCOMEETADV=$license.servicestatus|where {$_.serviceplan.servicename -like "MCOMEETADV"}
     }
     
    if ($license.servicestatus|where {$_.serviceplan.servicename -like "MCOSTANDARD"})
     {
      $MCOSTANDARD=$license.servicestatus|where {$_.serviceplan.servicename -like "MCOSTANDARD"}
     }

    if ($license.servicestatus|where {$_.serviceplan.servicename -like "MCOPSTN1"})
     {
      $MCOPSTN1=$license.servicestatus|where {$_.serviceplan.servicename -like "MCOPSTN1"}
     }

    if ($license.servicestatus|where {$_.serviceplan.servicename -like "MCOPSTN2"})
     {
      $MCOPSTN2=$license.servicestatus|where {$_.serviceplan.servicename -like "MCOPSTN2"}
     }

    if ($license.servicestatus|where {$_.serviceplan.servicename -like "MCOPSTNPP"})
     {
      $MCOPSTNPP=$license.servicestatus|where {$_.serviceplan.servicename -like "MCOPSTNPP"}
     }

    if ($license.servicestatus|where {$_.serviceplan.servicename -like "TEAMS1"})
     {
      $TEAMS1=$license.servicestatus|where {$_.serviceplan.servicename -like "TEAMS1"}
     }
   }

   $LICENSEOBJECT += New-Object PsObject -Property @{
    "DisplayName"="$($UserInfo.DisplayName)"
    "UserPrincipalName"="$($Msoluser.UserPrincipalName)"
    "TEAMS1"=$TEAMS1.ProvisioningStatus
    "MCOEV"=$MCOEV.ProvisioningStatus
    "MCOMEETADV"=$MCOMEETADV.ProvisioningStatus
    "MCOSTANDARD"=$MCOSTANDARD.ProvisioningStatus
    "MCOPSTN1"=$MCOPSTN1.ProvisioningStatus
    "MCOPSTN2"=$MCOPSTN2.ProvisioningStatus
    "MCOPSTNPP"=$MCOPSTNPP.ProvisioningStatus
   }

   write "Processing $($UserInfo.DisplayName) $COUNTER \ $ALLUSERSCOUNT"
 }

#This line creates a CSV for your personal use
$LICENSEOBJECT | SELECT DisplayName,UserPrincipalName,TEAMS1,M* | export-csv License.csv -NoTypeInformation

#This line outputs the data into Out-Gridview
$LICENSEOBJECT | SELECT DisplayName,UserPrincipalName,TEAMS1,M* | Out-GridView