Office 365: How to get the suscription and services used by each Office 365 user in a tenant using PowerShell!

This time I am sharing a PowerShell script that allows to get the subscription and Office 365 Service Status for every user in an Office 365 tenant. The Office 365 service status information indicates if the user is assigned to the specific Office 365 service or not. You can download the PowerShell Script from the following location the TechNet Scrpts Gallery:How to ge the suscription and services used by each Office 365 user in a tenant!

   1: ############################################################################################################################################

   2: # Script that allows to get for every user in an Office 365 Tenant information about the subscription for the user and the services being used

   3: # All the information is exported to a CSV file

   4: # Required Parameters:

   5: #  -> $sUserName: User Name to connect to the SharePoint Admin Center.

   6: #  -> $sMessage: Message to show in the user credentials prompt.

   7: #  -> $sExportFile: CSV File.

   8: ############################################################################################################################################

   9:  

  10: $host.Runspace.ThreadOptions = "ReuseThread"

  11:  

  12: #Definition of the function that allows to get the subscription and service information for all the users in an Office 365 tenant

  13: function Get-Office365UsersAndLicenses

  14: {  

  15:     param ($sExportFile)  

  16:     try

  17:     {       

  18:         Write-Host "-----------------------------------------------------------"  -foregroundcolor Green

  19:         Write-Host "Getting for each Office 365 user the suscription information and the services in use." -foregroundcolor Green

  20:         Write-Host "-----------------------------------------------------------"  -foregroundcolor Green

  21:         $O365Users=Get-MsolUser | Select UserPrincipalName,DisplayName, @{Name="Assigned License"; Expression={$_.Licenses.AccountSkuId}}, @{Name="Yammer";Expression={$_.Licenses[0].ServiceStatus[0].ProvisioningStatus}}, @{Name="Office 365";Expression={$_.Licenses[0].ServiceStatus[1].ProvisioningStatus}}, @{Name="Office Professional";Expression={$_.Licenses[0].ServiceStatus[2].ProvisioningStatus}}, @{Name="Lync";Expression={$_.Licenses[0].ServiceStatus[3].ProvisioningStatus}}, @{Name="Office Web Apps";Expression={$_.Licenses[0].ServiceStatus[4].ProvisioningStatus}}, @{Name="SharePoint";Expression={$_.Licenses[0].ServiceStatus[5].ProvisioningStatus}}, @{Name="Exchange";Expression={$_.Licenses[0].ServiceStatus[6].ProvisioningStatus}}

  22:         $O365Users

  23:         $O365Users | export-csv -path $sExportFile -notype

  24:     }

  25:     catch [System.Exception]

  26:     {

  27:         write-host -f red $_.Exception.ToString()   

  28:     } 

  29: }

  30:  

  31: #Office 365 Connection Parameters

  32: $sUserName="<Office365User>@<Office365Domain>.onmicrosoft.com"

  33: $sMessage="Introduce your Office 365 Credentials"

  34: #Connection to Office 365

  35: $msolcred = get-credential -UserName $sUserName -Message $sMessage

  36: connect-msolservice -credential $msolcred

  37:  

  38: #Calling the function

  39: $ScriptDir = Split-Path -parent $MyInvocation.MyCommand.Path

  40: $sPath = Get-Location

  41: $sExportFile=$ScriptDir + "\" + "$path\$sSiteName" + "Office365_Users_And_Licenses.csv"

  42: Get-Office365UsersAndLicenses -sExportFile $sExportFile

  43:  

  44: ###################################################################################################################################

  45: #References:

  46: # -> http://technet.microsoft.com/es-es/library/dn771771.aspx

  47: # -> http://social.technet.microsoft.com/wiki/contents/articles/11349.office-365-license-users-for-office-365-workloads.aspx

  48: ###################################################################################################################################

References:

Office 365: Como listar la suscripción y servicios en uso para cada usuario de un tenant!

En esta ocasión os dejo un script que permite listar para cada usuario de un tenant de Office 365 la suscripción (o suscripciones) asociadas y el estado de los servicios de Office 365 que indica si es un servicio que está usando o no. Podéis descargaros el script desde el siguiente enlace de la galería de Scripts de TechNet:How to ge the suscription and services used by each Office 365 user in a tenant!

   1: ############################################################################################################################################

   2: # Script that allows to get for every user in an Office 365 Tenant information about the subscription for the user and the services being used

   3: # All the information is exported to a CSV file

   4: # Required Parameters:

   5: #  -> $sUserName: User Name to connect to the SharePoint Admin Center.

   6: #  -> $sMessage: Message to show in the user credentials prompt.

   7: #  -> $sExportFile: CSV File.

   8: ############################################################################################################################################

   9:  

  10: $host.Runspace.ThreadOptions = "ReuseThread"

  11:  

  12: #Definition of the function that allows to get the subscription and service information for all the users in an Office 365 tenant

  13: function Get-Office365UsersAndLicenses

  14: {  

  15:     param ($sExportFile)  

  16:     try

  17:     {       

  18:         Write-Host "-----------------------------------------------------------"  -foregroundcolor Green

  19:         Write-Host "Getting for each Office 365 user the suscription information and the services in use." -foregroundcolor Green

  20:         Write-Host "-----------------------------------------------------------"  -foregroundcolor Green

  21:         $O365Users=Get-MsolUser | Select UserPrincipalName,DisplayName, @{Name="Assigned License"; Expression={$_.Licenses.AccountSkuId}}, @{Name="Yammer";Expression={$_.Licenses[0].ServiceStatus[0].ProvisioningStatus}}, @{Name="Office 365";Expression={$_.Licenses[0].ServiceStatus[1].ProvisioningStatus}}, @{Name="Office Professional";Expression={$_.Licenses[0].ServiceStatus[2].ProvisioningStatus}}, @{Name="Lync";Expression={$_.Licenses[0].ServiceStatus[3].ProvisioningStatus}}, @{Name="Office Web Apps";Expression={$_.Licenses[0].ServiceStatus[4].ProvisioningStatus}}, @{Name="SharePoint";Expression={$_.Licenses[0].ServiceStatus[5].ProvisioningStatus}}, @{Name="Exchange";Expression={$_.Licenses[0].ServiceStatus[6].ProvisioningStatus}}

  22:         $O365Users

  23:         $O365Users | export-csv -path $sExportFile -notype

  24:     }

  25:     catch [System.Exception]

  26:     {

  27:         write-host -f red $_.Exception.ToString()   

  28:     } 

  29: }

  30:  

  31: #Office 365 Connection Parameters

  32: $sUserName="<Office365User>@<Office365Domain>.onmicrosoft.com"

  33: $sMessage="Introduce your Office 365 Credentials"

  34: #Connection to Office 365

  35: $msolcred = get-credential -UserName $sUserName -Message $sMessage

  36: connect-msolservice -credential $msolcred

  37:  

  38: #Calling the function

  39: $ScriptDir = Split-Path -parent $MyInvocation.MyCommand.Path

  40: $sPath = Get-Location

  41: $sExportFile=$ScriptDir + "\" + "$path\$sSiteName" + "Office365_Users_And_Licenses.csv"

  42: Get-Office365UsersAndLicenses -sExportFile $sExportFile

  43:  

  44: ###################################################################################################################################

  45: #References:

  46: # -> http://technet.microsoft.com/es-es/library/dn771771.aspx

  47: # -> http://social.technet.microsoft.com/wiki/contents/articles/11349.office-365-license-users-for-office-365-workloads.aspx

  48: ###################################################################################################################################

Referencias: