Filtering shared mailboxes from MgUser results
I have a tenant that has multiple brands, with each brand denoted by a domain. I am trying to put together a script to list the licenses for each user, including their brand name. This has been successful so far.
The only thing I can't figure out is how to filter out the shared mailboxes from the get-MgUser list to apply the rest f the script to.
Below is what I have, and it breaks when I add the filter to the get-mguser prompt. Without the filter, it works, but includes all mailboxes.
Error received when running code block:
"Get-MgUser_List: Property 'mailboxtype' does not exist as a declared property or extension property."
Connect-MgGraph -Scope User.Read.All
$Users = Get-MgUser -filter "mailboxtype ne 'shared'" -All
$output = @()
$domain = ""
$brand = ""
$location = ""
$locations = @()
$brands = @()
$Licenses = ""
$brandusers = ""
$users | ForEach-Object {
$domain=($_.UserPrincipalName -split"@")[1]
$brand = ($domain -split "\.")[0]
$location=Get-MgUser -userid $_.UserPrincipalName -Property Department | select Department
$Licenses=get-mguserlicensedetail -userid $_.UserPrincipalName | select SkuPartNumber
#echo $Licenses