I was looking for an easy way to distribute Teams Voice policies for several users. I came up with the idea of doing this via PowerShell.

 

In this article, I describe the functionality of my PowerShell script, which I wrote and made available to all of you on my GitHub repository.

 

I hope it helps you and I wish you a lot of fun with it:

 

After the script is started, a first question is asked, asking whether we want to connect to our Microsoft Teams tenant via PowerShell.

 

If this connection already exists, we can continue with “N”.

 

Otherwise, we select the option “Y”.

Now we check whether the corresponding PowerShell module is already installed on the current device.

If this is not the case, this script installs the latest version of the Microsoft Teams PowerShell module.

If the corresponding module is already installed, the script checks whether there is a newer version. If so, it will be installed automatically. If not, the connection is established and the credentials are requested.
The login process also supports accounts with activated multi-factor authenticator.
The next step is to upload the CSV that is needed to set the policy. This is a CSV with the affected users.

 

The script also lists what the CSV file must look like so that the script functions correctly.

After the successful import, we can check the entries from the CSV again. If they are not correct, we select the option “N” to upload another CSV file.

 

However, if the information in the CSV file is correct, we can continue with “Y”.

Now we must enter the corresponding voice policy. It is important that the name is spelled correctly.
Imletzten Schritt werden nun the work is carried out.

This means that all users from the CSV file are assigned to the defined voice policy.

As always, this script is available for free to anyone who needs it. You can download it from my GitHub repository and use it.

 

Also as always, I assume no responsibility for possible misconfigurations and strongly recommend to use the first run of this script in a LAB or test environment.

 

This script can be used and adapted indefinitely, but not sold to third parties.

 

Link to the Script on GitHub