Find available phone numbers with Get-TeamsNumbers.ps1

I believe assigning phone numbers in Microsoft Teams can waste hours for an organization with multiple ranges and locations. What if you could run a PowerShell routine to find the next available number in a number range and at the same time know how many numbers you have left?😱 Now you can, with Get-TeamsNumbers.ps1. Watch my full session from Commsverse21 at the bottom of this post where I demo this script routine.

Fun fact: This script is based on my very popular phone number management routine I crated for Skype for Business Server 2015 called Get-SfBNumbers.ps1.

Disclaimer: This tool is provided as is and you are free to re-use the routines found in the script for your own use, but should not be incorporated in commercial products without author’s consent. If you got any feedback on the script let me know on Twitter.

Get started

  • Download the script from GithHub.
  • I prefer to open it in PowerShell ISE.
  • Add your number ranges and numbers in retention.
Figure 1: Add your ranges and numbers you want to reserve. If the script give and Int32 error on the range, I have experienced that the formatting of the above code can be wrong, try typing it manually instead of copying it
  • Before you run the script, make sure you Connect-MicrosoftTeams with the latest version.
    • You need to be either Teams Communications Administrator, Teams Administrator or Global Admin to run the script.
    • The numbers cannot be discovered via GraphAPI, only via the Teams PowerShell module.
  • Save the script and run it directly in PowerShell ISE.
    • Use examples to see how it can be run as normal ps1 script.
    • I prefer to run it in ISE because then you can play with the $Reports variable which I will show you later.
  • Keep in mind that it may run for a while if you have thousands of users.
  • Already after first run, you should get some good results as shown below.
    • The routine works for number used through Calling Plans, Operator Connect and Direct Routing.
Figure 2: Notice that there are 42 numbers in retention, these are classified as Gold and Silver numbers. You can add your own numbers in retention as well. You see total numbers available which is useful in order to know that you have enough numbers.

What it does

  • Uses Get-CsOnlineUser to fetch all users and accounts with a populated LineURI.
    • This includes Auto Attendands, Call Queues, Meeting Rooms, Common Area Phones and all other objects with a phone number.
  • Creates a complete overview of all numbers and number ranges.
    • Exports to csv C:\_Report\PhoneNumbers<Date>.csv so that you can import it to Excel.
    • Prints a GridView so that you can do a direct sort and search.
    • Prints the summary of all ranges to console.
    • What the script does can be controlled in the parameters section at the top of the script.
Figure 3: All settings can be specified in the parameter section

Find all available numbers for a range

The advantage of running the script in ISE is that you get access to all the variables the script uses. A very useful variable is the $Report variable. Notice that all number ranges has an Identity and has and attribute called AllAvailableNumbers. You can use these to get all numbers and then start assigning them in bulk to users. In Figure 2 we see the number range has Identity set to 2 which we can use like this:

Figure 4: Getting all available numbers as an array which again can be used for bulk assignment

Automatic retention of numbers

There might be numbers you don’t want to give to normal users, but you want to reserve for Auto Attendants, Call Queues or VIP users. The script automatically classifies Gold and Silver numbers based on regex. I have not created this regex myself, it is based on the script routine Paul Valiant provided for me back in 2015. It still works well :) My slide from my talk at Microsoft Ignite 2015 is still valid, when explaining Gold and Silver numbers.

Figure 5: Examples for Gold, Silver, Bronze and cultural numbers you should consider not to assign to users.

You can reserve your own numbers at the top section of the script, and notice that you can add your own comment and it wont be offered as the next number

Figure 6: The comment will also show in your csv export and GridView output.

Attend my session at Commsverse to learn more

I am speaking at Commsverse 15-16th of September 2021 about phone number management. In that session I will explain this script routine, but go even further and show how it can be used in automation and how to troubleshoot phone numbers for users and explain why country code is key for Microsoft Teams Phone System. Read more here.

Watch my full session from Commsverse21 where I demo this script routine

Managing phone numbers for users when using Direct Routing, the new Operator connect or event through Calling Plans? MVP Ståle Hansen got you covered. Learn his routine for automating numbers, identifying Gold, Silver and Bronze numbers and even reserving single numbers for re-use.

What you will learn
– How to automate finding available numbers for new users
– How to reserve numbers for future use
– Assign and troubleshoot phone numbers for users.

Goodbye Skype for Business Online, you wont be missed

July 31st 2021 is the date when Skype for Business Online (SfBO) was decommissioned. It was a good run, but we wont be missing the service. Why? Because Microsoft Teams is a more modern, cloud native service which has proven itself during difficult times with over 250 Million Monthly active users.

I wrote an article on what will happen and how you can jumpstart the process yourself at Practical 365. I also talk about what is possible when Teams is the only choice in Microsoft 365.

Read my full article at Practical 365 on what the SfBO decommission means for you and how to get started with the move today:

Skype for Business Server (SfBS) is still an option

But you should set up hybrid and consider moving your meetings to Teams. Then you will get the best of both worlds, local telephony, familiar chat in SfBS and modern meetings in Teams. The key element to a hybrid setup is that it is all federation traffic between your on-premises environment and Microsoft 365. If you have configured federation in your environment today, then you have all components in place. There are two caveats though:

  1. The Edge server needs to resolve its federation DNS records, it is therefore recommended to make sure you use a public DNS server on the public network leg on the Edge server. This is because the sip domain is shared between SfBO and SfBS.
  2. All Front-End servers with users need to have access to SfBO services. It is recommended to open all FQDN’s and IP address from the Front-End server to SfBO and as specified in the URLs and IP documentation for Teams and Skype. You should also open for authentication services at ID 56 and 59 in the table. This is because the Front-End servers log on SfBO when you move users online. They need to be able to authenticate and connect to the online services. It is not enough to open for just one server since it is the server where the user is homed that opens the connection.

If you want to migrate from Skype for Business Server with telephony to Teams and Direct Routing the process might include the following steps:

  • Implement SfB hybrid.
  • Validate PowerShell connectivity from one of the Front-End servers.
    • Required to be able to move users.
    • Remember that you must use the Teams PowerShell module as the SfBO PowerShell module has been retired
  • Implement the SBC.
  • Set up and validate Direct Routing.
  • Move users to the cloud using the direct to Teams PowerShell switch.
    • This will move the users directly from SfBS to the Teams service.
  • Assign OnlineVoiceRoutingPolicy to the migrated users-
  • Finalize the migration.
  • Reconfigure internal and external DNS with pointers to SfBO, such as, CNAME records and federation SRV records.
  • Turn off the SfBSs for 1-2 weeks.
  • If there are no reports of service issues, you are ready to remove all SfB users by running the Disable-CsUser cmdlet, which removes all SfB attributes from user accounts.
  • Start the decommission process by clearing out the SfB servers in topology builder and publish the topology. This will clean up Active Directory for references to servers and roles.
  • Replicate the Configuration Store.
  • Run setup on all SfBSs and uninstall roles.
  • Disjoin all servers from Active Directory.
  • Decommission all SfBS servers.
  • This article documents these steps

How to configure policy settings for Microsoft Teams Webinars

If you have not used webinars in Microsoft Teams yet, you need to configure some policy settings. Webinars are enabled in your tenant by default, but the ability for external people to register for your events or view the engagement report is disabled. Meetings support up to 1000 attendees for enterprise customers and 300 attendees for M365 Business Premium customers, but the overflow setting is disabled by default. At GA these settings could only be configured using PowerShell, here is how you do it.

#Install latest Teams PowerShell module
#The force switch enables you to install the newest version if you have an older version already installed
Install-Module MicrosoftTeams -force

#Connect to Microsoft Teams
#Minimum requirement is that your user is enabled with the Teams Communications Administrator Role
#Teams Administrator and Global Administrator role works too

#Default config
Get-CsTeamsMeetingPolicy | Format-List Identity, AllowEngagementReport, WhoCanRegister, AllowPrivateMeetingScheduling, StreamingAttendeeMode 

Identity                      : Global
AllowEngagementReport         : Disabled
WhoCanRegister                : EveryoneInCompany
AllowPrivateMeetingScheduling : True
StreamingAttendeeMode         : Disabled

#New config
Set-CsTeamsMeetingPolicy -Identity Global -AllowEngagementReport Enabled -WhoCanRegister Everyone -AllowPrivateMeetingScheduling $True -StreamingAttendeeMode Enabled

Get-CsTeamsMeetingPolicy | Format-List Identity, AllowEngagementReport, WhoCanRegister, AllowPrivateMeetingScheduling, StreamingAttendeeMode 

Identity                      : Global
AllowEngagementReport         : Enabled
WhoCanRegister                : Everyone
AllowPrivateMeetingScheduling : True
StreamingAttendeeMode         : Enabled

Now you are ready to run public webinars, get the engagement report and even have more than 1000 attendees using the overflow to live event feature from user number 1001. You may want to create a separate Teams Meeting Policy for those booking webinars, and not user global as I have done in the above example.

In our environment we were running on AllOn built in policy and it turns out that you cannot set this setting on built in policies, only on custom policies and Global. Also the AllOn MeetingPolicy is depricated so do not use that one. If you are like us, using an old built on policy and want to set global Teams meeting policy, you can either do it manually per user in the Teams Admin Center or you can use powershell and loop through users and revert back to the global policy. If you are not specifying a UPN in the below command, it will loop through all your users and set global policy on all of them, be careful when doing this in production. Setting the policy to $Null will revert you back to a global policy.

Get-CsOnlineuser <UPN> | Grant-CsTeamsMeetingPolicy -PolicyName $Null

Fellow Office 365 for ITPros author, Tony Redmond has a well written blogpost explaining the settings in detail. Teams Meetings Get Webinar Capability (

Cloud-based mailbox storage and Exchange hybrid attack surface reduction with Teams calendar and Outlook Mobile

Secure Remote Work from Anywhere is the trend of 2021! This trend has forced more companies over to Microsoft Teams for meetings and wanting to utilize conditional access, MFA and Outlook Mobile for on-premises hosted users. They are not ready to migrate everything to Microsoft 365 but want to use the secure remote work components. Meetings in Teams and MFA for Outlook Mobile are the main drivers.

The questions are, what is stored in Microsoft 365 when the mailbox is still on-premises and can we limit the attack surface for Exchange on-premises in this setup? The answers has two parts.

Part 1: When user is still on-premises, does not use Outlook Mobile but uses calendaring in Microsoft Teams

The great news is that the Teams clients connects via the Teams Backend Service to EWS to get calendar data. This means that you do not need to expose the on-premises Autodiscover and EWS to the clients for calendaring in Teams to work. It is enough to limit access to known Microsoft IP ranges found in the Office 365 URLs and IP address ranges article. The Teams Backend Service will den relay the parsed calendar data to the Teams client requesting the data. I got this information from a very informative and detailed TechCommunit article by MVP Thomas Stensitzki Microsoft Teams and on-premises mailboxes: Part 2 – Teams Calendar App Troubleshooting. Also read How Exchange and Microsoft Teams interact for a general understanding

Nothing is stored in Microsoft 365 in this scenario, except for personal chat activity for compliance reasons. How can you know? You can run a content search against the user and verify that no calendar events are stored in Exchange Online. You can navigate to Microsoft 365 Compliance Center and go to Content Search and click New search. In the keyword field you type a title of a calendar event for the user you want to search. Then you find the actual user you want to search and click Save & Run. Note that you need to have Compliance Administrator role assigned to your admin user and you need and exchange license with online mailbox for result preview to work.

The result should be empty and you have validated that no calendar data is cached in the cloud-based mailbox. To see Teams chats and meetings stored for compliance reasons you can add Kind:MicrosoftTeam as a keyword. Then re-run the search and validate that you can find the Teams data stored for compliance reasons. The Add App Content for On-Premises Users checkbox specifies that you are searching the cloud-based mailbox of the user. Read more about this process here.

What is a cloud-based mailbox?

  • It is created to store compliance records for Microsoft Teams personal chat and meeting activity
  • It is not possible to log on or access the mailbox in any scenario
  • It requires at least an Exchange Online Plan 1 license assigned to the user
  • It is used to cache emails for 28 days when you use Outlook Mobile to access the on-premises mailbox
    • includes four weeks of email, all calendar data, all contact data, and out-of-office status, source
    • If you do a search further back than 28 days, the resulting data is stored for 1 day, source
    • Outlook Mobile on iOS caches attachment for only 7 days, source

Part 2: When user is still on-premises and uses Outlook Mobile

The Outlook Mobile client does not connect directly to the Exchange on-premises mailbox, but via the cloud-based mailbox. It uses the AutoDetect service, not to be confused with the on-premises Autodiscover URL, to connect to the on-premises mailbox. The cloud-based mailbox then uses Autodiscover to find the ActiveSync URL and syncs 28 days of the users mailbox data. If the user on Outlook Mobile does a search further back than 28 days, the cloud-based mailbox will cache the on-premises query results for one day before it is deleted. Read about the connection flow here

Source: Using hybrid Modern Authentication with Outlook for iOS and Android | Microsoft Docs

This means that you do not need to expose the on-premises Autodiscover and ActiveSync to the mobile clients directly. It is enough to limit access to known Microsoft IP ranges found in the Office 365 URLs and IP address ranges article. If you do a Content Search on a user that uses Outlook Mobile, you will find the cached data. Hybrid Modern Authentication (HMA) is a requirement for Outlook Mobile and on-premises mailboxes. HMA and Outlook Mobile explained are in detail in the Using hybrid Modern Authentication with Outlook for iOS and Android article.

Be aware of the following

  • Hybrid Modern Authentication prerequisites
  • The Outlook Mobile global address list (GAL) is based on objects synced to Azure AD
    • This means you need to sync out all objects that needs to be searchable from Outlook Mobile including shared mailboxes in Azure AD Connect
  • Meeting rooms needs to be synced out and if you use room finder, make sure you sync out the distribution lists building the room lists.
  • Recommendation is to migrate from Skype for Business Server to Teams if possible in this scenario
    • If that is not a possibility, make sure the Skype for Business client supports ADAL logon because it connects to Exchange On-Premises calendar through EWS which is set up with HMA
      • Use the AllowAdalForNonLyncIndependentOfLync setting as described here
    • If you are not migrating to Teams and want to use Skype for Business Mobile app, the recommendation is to set up HMA for Skype for Business Server too, as described in this article
      • This enabled MFA and conditional access to be utilized for the SfB mobile client
      • The mobile client still connects via the SfB reverse proxy so it still needs to be exposed to the internet, you cannot lock it down as you can for Exchange.
      • There is no support for Lync Server 2010 or 2013 in the hybrid environment when using HMA

What about desktops and secure remote work?

The Teams clients connect to the Teams Backend Service to get the calendar. Outlook however requires a direct connectivity to Exchange on-premises. The assumption is that VPN is used in these scenarios for desktops together with split tunneling so that Teams media and calendaring goes directly to cloud and does not put unnecessary load on internal infrastructure. If you want to expose your Outlook Web App outside of VPN, simplest solution is to use Azure AD Application proxy.


Can you lock down your on-premises environment for Exchange and use Secure Remote Work with Teams and Outlook Mobile? Yes! Absolutely. Is this the secure remote work approach we recommend moving forward for those not ready to migrate yet? Yes! Absolutely :)

Set the custom Focusing status in Microsoft Teams from To Do using Power Automate

I am happy to announce that I have a free NoCode alternative for setting the Focusing status in Microsoft Teams! This is a follow up post to one of my most popular blog posts in 2020, Set the custom Focusing status in Microsoft Teams using Power Automate invoked through PowerShell.

Update 06.10.20: Updated the flow to better handle expected failure, should now exit as success if the task has no number. Download and import the Power Automate flow from GitHub. Found a logical issue 08.10.20, the Flow is now updated👍

The Focusing custom Teams status can only be set by MyAnalytics via a calendar event called ‘Focus time‘. I have not been able to recreate this calendar event type manually, so it must be something in the header. During a ‘Focus time‘ calendar event, the Teams client sets the status to Do Not Disturb with a custom name called Focusing. Personally, I don’t like the current way MyAnalytics schedules this event since it is two hours long and weeks in advance. I need a way to set this status at the time I am focusing, to mute distractions and tell my peers that I am in a focus, deep work, flow Pomodoro sprint. This is why I created this routine.

Here is how to get started with Focusing custom Teams status

  • Create the ‘Focus time‘ calendar event in MyAnalytics
  • Navigate to your personal dashboard at
    • See prerequisites further down in the blogpost
  • Click on Focus in the left menu
  • Click book now to get a ‘Focus time‘ event in your calendar which will set your Teams client in Focusing status for the duration of the calendar event
  • When this is done, it is possible to leave the plan under plan configuration or by using the below link, to avoid getting future calendar events like this.

How it works and watch the YouTube explainer video

Watch the YouTube video where I demonstrate how the routine works and how to get started

Instead of using the premium HTTP request trigger, I now use the free NoCode Microsoft To Do trigger. When a new task is created, the Power Automate flow runs, finds your default calendar, finds an existing Focus time calendar event in your language and sets the time for your Pomodoro sprint duration. It even has an option to use IFTTT to mute your phone during the sprint.


I am a Pomodoro Technique enthusiast. During a Pomodoro sprint it is important to mute distractions. This worked fine with custom presence states in Skype for Business, which is one of my most popular blog posts to date. I also published a very popular blog post on a routine to use HTTP request trigger in Power Automate to set the Focusing custom mode in Microsoft Teams. The problem with that routine is that it required coding and you needed to trigger it in PowerShell using a premium trigger. To Do triggers are included in most Office 365 SKU’s. Download and import the Power Automate flow from GitHub to see how the flow is built.

  • Make sure all prerequisites are met as the described below
  • Open Microsoft To Do
  • In any list, you create a new task and in the subject you put the time interval you want to do a Pomodoro sprint to achieve deep work/flow state/focus time
    • This technique even works from mobile and web!
    • I recommend you create a Pomodoro list in To Do to keep them all in the same place and so they don’t clutter your actual Tasks
  • Up to 3 minutes later, the Power Automate flow will trigger
    • I have tuned the timers in such a way that both the calendar event and the IFTTT trigger will start at the time you created the To Do task, and not when the flow is triggered
  • The flow will then access your primary calendar and create a copy of the current Focus time event and call it “Old Focus time” for historical purposes
    • This works regardless of language of the calendar and the Focus time calendar event, I check for primary calendar and use criteria to find the correct calendar event
  • Then the flow will get the latest Focus time event and update it with the time your To Do task was created and end the event using the number you put in the To Do task subject
  • When the calendar event is created, Teams will almost instantly update it’s status and put you in to the custom Focusing status, which has the same capabilities as if you set yourself to Do Not Disturb
  • When the calendar event is done, you will revert back to the correct status for your current time, busy if you are busy in calendar or available if you do not have anything else in your calendar
  • Now you can go to your meeting or evaluate which task is most important for you and trigger a new Pomodoro sprint :)


  • Calendar must be in Exchange Online
  • You must have MyAnalytics as part of your license and enabled
    • Schedule 1 period with MyAnalytics to get the calendar event
    • Available in Enterprise SKU’s
    • I recommend to turn it off again after the first run, so that you calendar does not get flooded with weekly Focusing time events
  • Download and import the Power Automate flow from GitHub
    • Go to Power Automate in
    • Navigate to My flows and click Import
    • No changes are needed in the actual flow after import is finished
  • Find one of your Focus time calendar event and set priority to low
    • This can only be done in Outlook desktop client
  • In order to find the correct calendar entry we are checking for the following
    • Priority low
    • Category: Green Category
      • In my tests the category will be named Green even though you are using a different language
    • We find the first one and edit that event, to make sure we are not editing all events
      • The flow stops after one event is edited
  • Optional bonus, not required
    • If you install the flow app on your mobile, you can get a notification on you mobile when the Pomodoro sprint starts and when it stops
    • You an use that notification to trigger an IFTTT action on Android and iOS to set them to do not disturb at the start and turn it off again
    • I even use the IFTTT trigger to control a hue light in my office, set it to red during the Pomodoro sprint and green when finishing :)
    • Read more about IFTTT triggers for pomodoro sprint here
    • In order to enable the IFTTT part of the flow, you need to go in and edit it and set the IFTTTIntegration variable to 1. It is set to 0, disabled, by default

Power Automate techniques I used to accomplish this flow

In the coming weeks I will publish separate blog posts on how I created a universal flow which works out of the box in any environment. In the meantime you can download the flow from GitHub and take a look

  • How to find the default Outlook calendar for a person regardless of language
  • How to find the default Microsoft To Do tasks list for a person regardless of language
  • How to find a specific calendar event based on category
  • How I used ticks() to find time difference in Power Automate and what I used it for
  • Substring() techniques in Power Automate
  • If() in Power Automate
  • Math is hard in Power Automate, here is how i used sub(), div(), addminutes() and length()
  • Named variables and comments in Power Automate

Use Power Automate to send Teams messages to To Do #NoCode

I am a productivity enthusiast. I use Microsoft To Do for my individual task management. When someone has a task for me in Microsoft Teams I need to get them in to To Do. MVP Vesa Nopanen created a Power Automate routine for doing this which works great. In his blog post, he talks about how to create it and how to share it with select users within your organization. I have tuned this routine to make it universally available so that no changes to the code is need for it to run in your organization. How? Read on

I created the universal routine which you can download from GitHub and try for yourself. Just import it, authorize access to Microsoft Teams and Microsoft To Do and you are good to go. Check out Vesa’s blogpost for how to share it in the organization

Originally the routine checked for the name of your tasks folder, but I found a way to do that programmatically, since the name of the folder is different depending on your language. The flow will look up the lists in user context and from there we can check which is the default one. Tasks is always the default one.

I did one more thing. When capturing the text to go in the task, I wanted to limit the length of the subject to 150 characters.

  1. I had to convert the output from Teams to plain text
  2. Then I checked the length of the body
    • if it was short than 150 characters, I used that as length,
    • if the body was more than 150 characters I limited it to 150.
    • if(lessOrEquals(length(outputs(‘Html_to_text’)?[‘body’]),150),length(outputs(‘Html_to_text’)?[‘body’]),150)
  3. Finally I created a string variable which is no longer than 150 characters and used it in the subject.
    • substring(outputs(‘Html_to_text’)?[‘body’],0,outputs(‘Compose’))

That’s it, simple and effective. You can download the flow from GitHub, make sure you read the original blog post for full details. MVP Yannick Reekmans has a different take to accomplish this using a graph approach. You still need the above routine to get the default task list.

When importing the flow, you need to have these connectors available so that you can complete the import. All connectors are part of your Office 365 subscription

Set the custom Focusing status in Microsoft Teams from PowerShell using Power Automate

I am a Pomodoro Technique enthusiast. During a Pomodoro sprint it is important to mute distractions. This worked fine with custom presence states in Skype for Business, which is one of my most popular blog posts to date, on a daily basis. With Microsoft Teams, this has been a challenge, until now.

The Focusing custom Teams status can only be set by MyAnalytics via a calendar event called ‘Focus time‘. I have not been able to recreate this calendar event type manually, so it must be something in the header. During a ‘Focus time calendar event, the Teams client sets the status to Do Not Disturb with a custom name called Focusing.

Here is how to get started with Focusing custom Teams status

You can schedule such a calendar event at will using PowerShell and PowerAutomate

Personally, I prefer to manually control when my Teams client gets set to Focusing state. MyAnalytics schedules the calendar event as two hours long when calendar is open and weeks in advance. I needed a way to set this status at the time I am of my choosing when I was actually focusing, to mute distractions and tell my peers that I am in a focus, deep work, flow Pomodoro sprint. I found a way to use Power Automate to control set the Focusing status at will.

The Teams Focusing status fits well with the PowerShell Pomodoro Timer. Update 05.10.20: the status updates instantly after the calendar event is added to your Outlook

Watch the 3 first minutes showing the focusing status in action!

How I solved it

I trigger a Power Automate flow using a HTTP request trigger using Invoke-WebRequest in PowerShell. The flow takes two inputs, duration and a secret. If the secret is correct, to make sure the flow can’t be easily hacked, it gets my calendar and searches for calendar event with subject ‘Focus time’. It takes the first entry and changes start time and stop time for the event using the duration I have set, usually 25 minutes. Now I have a ‘Focus time’ calendar event that is set at the same time as my Pomodoro sprint with the same duration. After 1-3 minutes, my status will be updated to Focusing. After 25 minutes, plus 1-3 minutes, my status will be reset. BOOM, how cool is that!?


Update 05.10.20: I have created a free way to do this using Microsoft To Do task as a trigger. No need for code adjustment, just download and use it. Read more here! If you want to use premium Power Automate trigger and PowerShell to set the status keep on reading :)

Update 08.01.21: Together with MVPs Dux Raymond Sy and Loryan Strant, I have created a Pomodoro YouTube series where we discuss the Teams custom focusing status and multiple ways to solve this. Check it out!

  • Calendar must be in Exchange Online
  • You must have MyAnalytics as part of your license and enabled
    • Schedule 1 period with MyAnalytics to get the calendar event
    • Available in Enterprise SKU’s
  • You must have Power Automate license and ability to use Premium triggers
    • The trigger used is HTTP request and is a Premium trigger
    • You may find that you can use other free triggers as well
    • Premium triggers are included in Dynamics 365 SKU’s
    • Premium triggers are not included in Microsoft 365 SKU’s
    • The standalone $15 Per User plan can run Premium triggers
  • If you want to use a trigger included in your Office 365 plan, check out my other method, using Microsoft To Do task as trigger

Creating the calendar event and importing the Power Automate flow

  • Create the calendar event in MyAnalytics
  • Import the flow in your Power Automate
    • Watch the full walkthrough of the import of the flow at 3:39 in the YouTube video
    • Download the file here
    • Navigate to your personal Power Automate dashboard at
    • Go to My flows in the left menu and click Import
    • Click Upload and choose the zip file
    • To be able to complete the import you must click the wrench in the first line and choose Create as new under Setup
    • Next you must create the Outlook connector by clicking on the wrench in the second line for Related resources
      • Click Create new
      • Scroll down to Office 365 Outlook, click Create and authenticate as your user
      • Now you have created the Outlook connector, go back to the flow import website and select you new connector and Save
      • Import the flow by clicking Import
      • The import should be successful, navigate to My flows
    • Edit your new flow called HTTPSTriggerUniversalPomodoroFocustime.
    • Now, let’s go through it and update the flow for your environment

Configuring the Power Automate flow

Click Edit on the flow and expand When a HTTP request is received and copy the HTTP POST URL and save it for later

Expand Condition and change MySecret to your own and take note of it

If no is there to trigger if the secret is wrong, it is a small security measure so that people not easily can steal you flow URL, but they also need the secret, or you can change it if it does get lost

That is the only change you need to make to the flow because the flow will find your default calendar. Since the name of your primary calendar may be different in your language, we are looking for the calendar for your user with isRemovable=False

But there is one more thing, we want to edit one of the calendar ‘Focus Time’ calendar events created by MyAnalytics. We want to set the event to workingElswhere or has priority of low. In this way we have more control over which event we are manipulating.

That’s it! You are now ready to invoke your flow. In PowerShell you need to run the following code

[int]$Minutes = 25 #Duration of your Pomodoro Session, default is 25 minutes
[string]$Secret = "MySecret" #Secret for the flow trigger
[string]$AutomateURI = "YourFlowTriggerURI" #The URI used in the webrequest to your flow

#Invoking PowerAutomate to change set current time on your Focus time calendar event, default length is 25 minutes
    $body = @()
    $body = @"
Invoke-RestMethod -Method Post -Body $Body -Uri $AutomateURI -ContentType "application/json"

Go back to Power Automate and validate that the flow ran, check your Outlook calendar that the ‘Focus time’ event was moved to now the status should change almost instantly. When the calendar time is over, your status will be reset and you are available again.

The practical approach with the Pomodoro PowerShell timer

With the ability to control the status in Teams, I believe the Pomodoro PowerShell timer is feature complete. One thing is to be unavailable and reduce distractions, but it is very important to automatically become available again. The reason for WHY you would use this kind of timer and automation is to avoid getting distracted which breaks your flow and deep work. Research shows that it takes between 7-30 minutes to get back in to flow after you have seen just one email or message. Here is what the script does

  • Starts presentation mode to block popups on your computer
  • Hides badges on taskbar so that you do not get distracted by seeing that you have a new mail, task or chat
  • Opens you favorite flow and deep work Spotify playlist so that you do not spend time figuring out what to listen to
  • Uses IFTTT to mute your phone, works with Android and iOS
  • Finally set your status in Teams to Focusing
  • After the Pomodoro sprint is over, everything will be turned back on again
  • Watch my demo (and live commentary) of the script in the YouTube video :)

Below is a sample code to run the Start-SimplePmodoro.ps1 script which you can download from GitHub

Start-SimplePomodoro `
-SpotifyPlayList spotify:playlist:XXXXXXXXXXXXXXXXXX `
-IFTTTMuteTrigger pomodoro_start `
-IFTTTUnMuteTrigger pomodoro_stop `
-Secret YourFlowSecret  `
-AutomateURI YourAutomateURI `

Watch how to get started with the Pomodoro PowerShell script at 3:39 in the YouTube video

Why is it important to automatically become available?

You have been gone for 25 minutes, use the pause to check if anyone has been trying to reach you, re-prioritize your tasks, get more coffee and then dive in to a new Pomodoro sprint. After 25 minutes it is OK to get distracted, but if nothing happens, just stay in the flow you jump started and get stuff done. Download the Pomodoro PowerShell timer from GitHub

Discover all headsets used in #MicrosoftTeams PowerBI report

Part of succeeding with Microsoft Teams in the organization is to use certified for Microsoft Teams devices. I wrote about this in my article Why certified for Microsoft Teams devices are important. To succeed with this we need visibility and knowledge about what is being used in our environment.

I have created a simple PowerBI report for this. Download it here. The report will find which devices are used within your organization. The report uses the CQD connector for PowerBI and you can publish it and add it as a tab in Teams.

The report connects directly to the CQD database which is the only supported way. Because of this, the user who accesses the report in Teams needs one of the following admin roles assigned.

  • Global Administrator
  • Global Reader
  • Skype for Business Administrator
  • Teams Service Administrator
  • Teams Communications Administrator
  • Teams Communications Support Engineer
  • Teams Communications Support Specialist
  • Reports Reader

To just see the devices used without getting the UPNs of the users, you can use the Reports Reader or Teams Communications Support Specialist roles.

The report

By specifying the Second UPN you can see what kind of devices individuals in your organization are using. You will find that there are multiple entries of the same devices because Second Capture Dev name is different. There is currently no way of using regex to mitigate this. Second Capture Dev is the microphone used in the audio conversations and is an indication of device used regardless of PSTN, Teams call, or conference.

Default input device, Audio and Realtek High Definition Audio are typically indications of using jack based or laptop speakers as the mic. In the picture below you see that CloudWay are mostly using certified devices👍

The report is based on Audio Call Count and Second Capture Dev from the CQD database


  • Download the CQD PowerBI reports created by Microsoft
    • Read more about them and get the reports here
  • Download and install PowerBI desktop
  • Download the GetDeviceReport from GitHub
  • Assign PowerBI PRO license, to be able to publish the report online
  • Assign at least Teams Communications Support Specialist admin role to be able to connect and read the CQD database

Setting up the report, publish it to PowerBI and adding it as a tab in Teams

  • Make sure you have or create the folder
    • [Documents]\Power BI Desktop\Custom Connectors
  • Copy the MicrosoftCallQuality.pqx to the above folder
    • This file is in the zip package you downloaded called
    • This gives you the Microsoft Call Quality (Beta) connector in the PowerBI desktop app
  • To build a report and run queries, you will first need to connect to the CQD data source.
  • Follow the steps below to connect:
    • In the Home tab of Power BI Desktop, click on Get Data.
    • The Get Data window should appear at this point. Navigate to Online Services, then select Microsoft Call Quality (Beta) and hit Connect.
    • You will be prompted to log in
    • The next prompt will give you the option between two Data Connectivity modes.
      • Select DirectQuery, which is the only supported way to connect to CQD, and hit OK
    • Finally, you will be given a final prompt showing you the entire data model for CQD.
      • No data will be visible at this point, only the data model for CQD.
      • Select Load to complete the setup process.
    • At this point, Power BI will load the data model onto the right side of the window.
      • The page will remain otherwise blank, and no queries will be loaded by default.
      • Proceed to Building Queries below to build a query and return data.
    • Now you are ready to open the PowerBI report you downloaded from GitHub
      • Open GetDevice.pbix, see it load in PowerBI desktop
      • Next, we need to publish the report by clicking Publish in the top menu to the left
      • In the Publish to PowerBI window, you should see the Teams you are an owner of as workspaces
      • Choose one and click Select
    • When it is finished publishing you can go the Team, find a channel and add PowerBI report as a tab
      • In the workspace, you have published to, find the report and click Save
    • You have now imported one of the CQD PowerBI reports
    • Everyone that wants to see the report in Teams needs to have one of the admin roles mentioned previously
    • The report may take some time to load and this is because it is getting the data in real time. There is no supported way to pre-load the data at the moment

Need more Microsoft Teams insights like this? Check out the monthly updated book Office 365 for IT Pros where I write the calling and meetings chapter.

Updated my #Pomodoro #PowerShell timer

Ever been so busy you can’t get anything done? What do I do during those times? Spend time optimizing my productivity routine of course. June 2020 was super busy period for me and I found that my PowerShell Pomodoro timer needed some tuning to be easier to use. Download the updated script from GitHub. I have done the following changes

  • Hide Badges on taskbar buttons
  • Create a shortcut to start it in a fast and simple way
  • Fixed so that presentationsettings.exe works in 64bit PowerShell
  • Read my original post about this script
  • Pomodoro is a technique to induce flow in a busy workday through single tasking. Read more at the end of this blogpost

Hide badges on taskbar buttons

Instead of stopping Microsoft Teams, I hide the badges on taskbar buttons such as Outlook, Teams and Microsoft To Do. You must have access to changing the registry for this to work which was the best approach I could find.

#Hide badge or stop Teams
if ($Teamsmode -notmatch "HideBadge"){
    #Stop Microsoft Teams
    Write-Host "Closing Microsoft Teams" -ForegroundColor Green
    Get-Process -Name Teams -ErrorAction SilentlyContinue | Stop-Process -ErrorAction SilentlyContinue
    #Hiding badges on taskbar buttons such as Outlook, Teams and ToDo
    Write-Host "Hiding badges on taskbar buttons" -ForegroundColor Green
    Set-Itemproperty -path 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced' -Name 'TaskbarBadges' -value '0'
    Stop-Process -ProcessName explorer

During hide badge you will not see status in the taskbar icons, which helps you keep focus during the Pomodoro sprint.

When the Pomodoro sprint is finished, it will show badges again

Showing badge on taskbar app is new in Microsoft To Do and can be turned on or off under settings, I prefer to turn it off

Create a shortcut to start it in a fast and simple way

In order to start the script in an fast and simple way, you can create a shortcut to the script.

  1. On you desktop, right click and select new shortcut
  2. In the shortcut target box, type the following:
    • powershell.exe -noexit -ExecutionPolicy Bypass -File
  3. File is the path where you stored the Start-SimplePomodoro.ps1
    • “C:\Users\UserName\OneDrive – CloudWay\Dokumenter\GitHub\MyScripts\Start-SimplePomodoro\Start-MySimplePomodoro.ps1”
  4. I have crated an Icon you can use for the shortcut which you can find on GitHub
  5. If you pin it to you taskbar, you can easily start your Pomodoro sprint

Fixed so that presentationsettings.exe works in 64bit PowerShell

I use presentationsettings.exe to put the computer in presentation mode which supresses popups from all you applications and Windows 10. This is an 32bit application. I found that 64bit PowerShell could not find this due to the feature, File System Redirector. I found a workaround and incorporated it in the script so that it works wherever you are running it

Write-Host "Starting presentation mode" -ForegroundColor Green
if (Test-Path "C:\Windows\sysnative\PresentationSettings.exe"){Start-Process "C:\Windows\sysnative\PresentationSettings.exe" /start -NoNewWindow}
else {presentationsettings /start}

By pointing 64bit PowerShell to the path C:\Windows\sysnative\ I was able to run 32bit apps like PresentationSettings.

The result

Download the script from GitHub

The goal is to induce the flow state in a busy workday

Multitasking is a myth. The goal is to reach the flow state by focusing on one task at a time. Have you ever started writing an email, thought you sent it and eagerly waiting for a response, only to find it incomplete and unsent at the end of the day? This is one of the perils of multitasking.

The Pomodoro Technique is a great methodology to induce flow in a busy workday. It is all about avoiding distractions for 15-25 minutes and focus on one task at a time. This is a short enough period in the day that you can squeeze it in before a meeting. It is incredible what you can get done 15-25 minutes. The goal is to not get distracted and it takes about 7 minutes of focus before you reach your flow state.

If you want to succeed with Pomodoro, you need to make yourself unavailable. Equally important, you need to make yourself available again when those 25 minutes have passed. That is why we created the Pomodoro PowerShell tool, and why I love the simplicity of this approach.

Watch an outtake from my session at Microsoft Ignite 2017 on single-tasking

Learn more on my thinking around single-tasking and tools available to succeed with the flow state, from this outtake of my OneNote LifeHacks talk at Microsoft Ignite 2017

Happy deep work!

Why certified for #MicrosoftTeams devices are important

Part of succeeding with Microsoft Teams in the organization is to use certified for Microsoft Teams devices. There is a difference between consumer devices and business headsets. The major difference for headsets is noise cancelling in the microphone and cameras support the Teams video codec.

A consumer headset is prone to amplify the sounds around you, business headsets focus on your voice and work better in noisy environments. Most importantly, headsets certified for Microsoft Teams support wideband audio with the SILK codec used in all Teams clients, which means you sound better for your audience than with a consumer headset. All certified for Teams devices will be updated to support the new SATIN codec coming in Q2 2020.

Devices certified for Microsoft Teams are all listed and updated at Some of the advantages for the end-users are:

For an administrator the advantages are:

What about certified for Skype for Business devices?

They support the SILK codec too, so all good, but they may not have newer functionality like the Teams button found on certified for Teams devices. You can even use certified for Lync 2013 devices. Everything older than that is not OK, like Lync 2010 and OCS 2007 certified devices. Reason? No support for wideband SILK codec. Keep this in mind if you have upgraded from OCS and Lync to Skype for Business to Microsoft Teams.

It is common to find consumer devices in business environments, because the awareness of the the above features are low. But this is important, because if we have done all the network optimization and made sure users are adopting Teams, the last mile with a proper device is where we fail too often. Use my CQD PowerBI report to identify devices used in your environment and correlate the findings with devices listed at

Want a PRO headset for focus while working and travelling that is certified? Check out this video where I run 5 stress tests on two high end focus headset which are certified for Microsoft Teams

Need more Microsoft Teams insights like this? Check out the monthly updated book Office 365 for IT Pros where I write the calling and meetings chapter.