Thursday, 26 December 2024

Get the License Assign Date

 # "MCOEV" : Audio Conferencing
# "MCOMEETADV" : Phone System

Connect-MsolService Connect-AzureAD Connect-MicrosoftTeams

#For One User - Get the License AssignDate
$sku ="MCOEV" $user = "user@email.com" $upn = Get-MsolUser -UserPrincipalName $user
$ServicePlanId = Get-AzureADSubscribedSku | ? {$_.SkuPartNumber -like "*$sku*"} | select -expand Serviceplans | select -expand ServicePlanId
$data = (Get-AzureADUser -SearchString $upn.ImmutableId).AssignedPlans |?{$_.ServicePlanId -match $ServicePlanId}

$Property=[pscustomobject][ordered]@{     User = $upn.DisplayName     UserPrincipalName = $upn.UserPrincipalName     License = "AudioConferencing"     AssignDate = $data.AssignedTimestamp     Status = $data.CapabilityStatus     ServicePlanId = $data.ServicePlanId }
$property

#For Entrire Tenant - Get the License AssignDate
$sku = "MCOMEETADV"
$upn = Get-MsolUser -all
#(Get-AzureADGroup -Filter "DisplayName eq 'LG-APP-AZZ-LIC-M365-AUDIOCONF-INTEROP'"| Get-AzureADGroupMember).UserPrincipalName |%{($_ -split '[@]')[0]}
$CurrentDate = ((Get-Date).GetDateTimeFormats())[4]
foreach($u in $upn){
$ServicePlanId = Get-AzureADSubscribedSku | ? {$_.SkuPartNumber -like "*$sku*"} | select -expand Serviceplans | select -expand ServicePlanId
$data = (Get-AzureADUser -SearchString $u.ImmutableId).AssignedPlans |?{$_.ServicePlanId -match $ServicePlanId}

    $Property=[pscustomobject][ordered]@{         User = $u.DisplayName         UserPrincipalName = $u.UserPrincipalName         License = "AudioConferencing"         AssignDate = $data.AssignedTimestamp         Status = $data.CapabilityStatus         ServicePlanId = $data.ServicePlanId     }
    $property | Export-Csv "C:\Sumant\Output\SkypeP4.csv" -NoTypeInformation -Append
    #$property | Export-Csv "C:\Sumant\Output\$CurrentDate _AudioConfReport.csv" -NoTypeInformation -Append
}

 

--------------------------------- End ---------------------------------

No comments:

Post a Comment