As many of you have seen that starting 1 October 2022, Microsoft will start disabling Basic Auth on Tenants. This means disruption for many users that make use of EAS and are using the native mail applications on Android and iOS.

I put together a script that will help you find all these mailboxes with ActiveSync enabled and if you have multiple states or countries, you will get the output per country and you can filter excel by True or False or Country. The script is straight forward, you can modify it to suit your needs:


$EASCheck = Get-ADUser -Searchbase "OU=Users,DC=thexchangelab,DC=com" -Server -Filter * -Properties * | select userprincipalname,C

$EASEnabledTotal = @()

ForEach ($e in $EASCheck)


$easenabled = Get-CASMailbox -Identity $e.userprincipalname | Select Displayname,primarysmtpaddress,activesyncenabled

Foreach ($u in $easenabled){

        $Userobject = New-Object PSobject

        $UserObject | add-member  -membertype NoteProperty -name "Userprincipalname" -Value $e.Userprincipalname

        $UserObject | add-member  -membertype NoteProperty -name "Country" -Value $e.C

        $UserObject | add-member  -membertype NoteProperty -name "Displayname" -Value $u.Displayname

       $UserObject | add-member  -membertype NoteProperty -name "primarysmtpaddress" -Value $u.primarysmtpaddress

        $UserObject | add-member  -membertype NoteProperty -name "activesyncenabled" -Value $u.activesyncenabled

        $EASEnabledTotal += $Userobject}


$EASEnabledTotal | Export-Csv "C:\Temp\ASCNT01Sep.csv"

Here are some notes about the script.

  • Connect-ExchangeOnline is needed for you to connect to your tenant
  • The Get-ADUser command will need to be updated to the OU where you want the script to query against.
  • The “C” Select object is for the country if you have multiple regions.
  • The rest is self explanatory.
  • I exported the information to a csv file in the location C:\temp but you can change this to any location you need to.

Hope it helps with get the members in your organization that need to update mobile applications and move to Modern Auth.

Discover more from Everything-PowerShell

Subscribe now to keep reading and get access to the full archive.

Continue reading