#Connect to EXO and MSOL
#Provide UPN as Input
$Upn= Import-Csv "CSV Path"
$out=$null
$out=[System.Collections.ArrayList]@()
Foreach($u in $Upn)
{
$data = Get-MailboxStatistics $u|Select DisplayName,TotalItemSize #@{n='TotalItemSize';e={(($_.totalitemsize) -split '[(]')[0]}}
$Property=[pscustomobject]@{
DisplayName = $data.DisplayName
UserprincipalName = $u
License = ((Get-MsolUser -UserPrincipalName $u).Licenses|?{$_.AccountSkuId -match "ENTERPRISEPACK"}).AccountSkuId
TotalSize = $data.TotalItemSize
}
$Out.Add($Property)
$Property | Export-Csv D:\lalit.csv -Append -NoTypeInformation
}
$out
No comments:
Post a Comment