Lapas

otrdiena, 2014. gada 28. oktobris

Get list of all Office 365 users and their licenses

Here is PowerShell script to get list of all users and their licenses:

#######begin script#######

cls

Import-Module msonline

Connect-MsolService

Function Get-UserLicenseList {

$MasterList = @()

Get-MsolUser -All  | % {

$Object = New-Object PSObject -Property @{

DisplayName = $null

UserPrincipalName = $null

AssignedLicense = $null}

$Object.DisplayName = (Get-MsolUser -UserPrincipalName $_.UserPrincipalName).DisplayName

$Object.UserPrincipalName = (Get-MsolUser -UserPrincipalName $_.UserPrincipalName).UserPrincipalName

$Object.AssignedLicense = ((Get-MsolUser -UserPrincipalName $_.UserPrincipalName).licenses | select accountskuid).accountskuid

$MasterList += $Object}

$MasterList | Out-GridView

}

Get-UserLicenseList

#######end script#######


Source: comunity.office365.com

Nav komentāru:

Ierakstīt komentāru