Finding Unlicensed Users in O365

Use these commands to check which users don’t have a license or need a different license. This is different from the search/filter in the Admin portal because it checks for the LicenseReconciliationNeeded attribute rather than IsLicensed. For example if you have a user with an Azure AD P2 license but they need an Exchange Online license the admin portal doesn’t give you a good way to filter this out.

#get connected

#show list of users that we need to license
get-msoluser -All | where {$_.LicenseReconciliationNeeded -eq $true}

#show the availible licenses that we have in the tenant, we are going to be looking for the E3 license "tenantnamehere:ENTERPRISEPACK"

#assign a usage location to the users we are going to license
get-msoluser -All | where {$_.LicenseReconciliationNeeded -eq $true} |Set-MsolUser -UsageLocation "US"

#assign the licenses to the users
get-msoluser -All | where {$_.LicenseReconciliationNeeded -eq $true} |Set-MsolUserLicense -AddLicenses "tenantnamehere:ENTERPRISEPACK"

Your users should be all set with their new licenses.

Finding SMTP Relay Senders

To start with check to see if is still live, this site has a more comprehensive look at what we are doing here.

Here is the sort version of what you need to do.
#Show current settings for connectors listening on port 25

Get-ReceiveConnector |where {$_.Bindings -like "*:25"} |ft Identity,ProtocolLoggingLevel

#Set logging to verbose for all of those connectors, make sure you aren't low on free space. It shoudn't take up much but make sure

Get-ReceiveConnector |where {$_.Bindings -like "*:25"} |ft Identity,ProtocolLoggingLevel |Set-ReceiveConnector -ProtocolLoggingLevel verbose

#Wait a day or whatever interval you think is sufficient to get a connection from all the lines of business apps

#Install Log Parser 2.2 on your hub transport servers

#Browse to your log dir, on my server I had to elevate permissions before it would let me navigate to the dir

#Open CMD and browse to the log dir
cd "D:\Program Files\Microsoft\Exchange Server\V14\TransportRoles\Logs\ProtocolLog\SmtpReceive"

#Run the following cmd
"C:\Program Files (x86)\Log Parser 2.2\logparser.exe" "SELECT EXTRACT_PREFIX(remote-endpoint,0,':') as IP,REVERSEDNS(EXTRACT_PREFIX(remote-endpoint,0,':')) as Name,Count(*) as Hits from *.log WHERE data LIKE '%EHLO%' GROUP BY IP ORDER BY Hits DESC" -i:CSV -nSkipLines:4 -rtp:-1

#It should return a table like this

After performing these steps on all of the hub transport servers that are relay targets you would want to update these devices to send though your new relay. Once they are all updated you can clear the logs and re-run this process to make sure it all worked.

O365 – Tenant Name Checker

Over the years I have had the opportunity to work on quite a few Office 365 migrations and setups. This post covers somethings that I have found useful to ensuring a successful migration and making day 2 operations easier.

Picking the Name

So the tenant name ( does’t show up in too many places but it will be visible to some users. Mainly when you are looking at Team sites or SharePoint, but also in the aliases for hybrid setups. Bottom line you won’t have to type it in all the time but you probably don’t want to pick something like ( because someone will eventually ask and you can’t change it, ever. This tool will let you quickly check the available tenant names without having to go through the setup processes, you can send this over to the people that care and get them to pick the name for you. As you can see myfavpet is available and ready for your new migration 🙂


*I’m not sure exactly who the source is, but thank you to who ever is working at NOBL.TECH that created this!