VoIP:Teams:Powershell: Difference between revisions

From VTX Public Wiki

(→‎MicrosoftTeams : Install the module: Add a picture of the install)
 
(14 intermediate revisions by the same user not shown)
Line 1: Line 1:
== Powershell version ==
==Powershell version==


{{Notice|1=Powershell 7 is known to have problem with MicrosoftTeams module, please prefer to use embedded Powershell version 5.1 by default, cf https://docs.microsoft.com/en-us/microsoftteams/teams-powershell-install }}
{{Notice|1=Powershell 7 is known to have problem with MicrosoftTeams module, please prefer to use embedded Powershell version 5.1 by default, cf https://docs.microsoft.com/en-us/microsoftteams/teams-powershell-install }}


=== What is my Powershell version ? ===
===What is my Powershell version ?===




* '''Problematic''': You would like to know which powershell version you are using
*'''Problematic''': You would like to know which powershell version you are using
* '''Solution''': Start a Powershell shell and type the command "$PSVersionTable.PSVersion"
*'''Solution''': Start a Powershell shell and type the command "$PSVersionTable.PSVersion"


<source lang="powershell">
<source lang="powershell">
Line 16: Line 16:
</source>
</source>


=== Install Powershell ===
===Install Powershell===


{{Notice|1=Powershell 7 is known to have problem with MicrosoftTeams module, please prefer to use embedded Powershell version 5.1 by default, cf https://docs.microsoft.com/en-us/microsoftteams/teams-powershell-install }}
{{Notice|1=Powershell 7 is known to have problem with MicrosoftTeams module, please prefer to use embedded Powershell version 5.1 by default, cf https://docs.microsoft.com/en-us/microsoftteams/teams-powershell-install }}


* '''Problematic''': When you use your start menu, you do not find powershell, so you would like to install it
*'''Problematic''': When you use your start menu, you do not find powershell, so you would like to install it
* '''Solution''': Download and Install Powershell on your PC https://docs.microsoft.com/en-us/powershell/scripting/install/installing-windows-powershell
*'''Solution''': Download and Install Powershell on your PC https://docs.microsoft.com/en-us/powershell/scripting/install/installing-windows-powershell




== Powershell Module Management ==
==Powershell Module Management==


=== MicrosoftTeams Module ===
===MicrosoftTeams Module===


{{Warning|1=This new powershell module MicrosoftTeams is known to have problem with Powershell version 7, please use OS embedded version 5.1 !}}
{{Warning|1=This new powershell module MicrosoftTeams is known to have problem with Powershell version 7, please use OS embedded version 5.1 !}}


* '''Information''': Microsoft is slowly replacing Skype for Business Online Powershell module with a new one MicrosoftTeams. This new module includes the same connection modules with some additional commands dedicated for Teams. https://docs.microsoft.com/en-us/microsoftteams/teams-powershell-install
*'''Information''': Microsoft is slowly replacing Skype for Business Online Powershell module with a new one MicrosoftTeams. This new module includes the same connection modules with some additional commands dedicated for Teams. https://docs.microsoft.com/en-us/microsoftteams/teams-powershell-install


==== MicrosoftTeams : Install the module ====
====MicrosoftTeams : Install the module====


{{Warning|1=Do not use Powershell version 7, use embedded version 5.1}}
{{Warning|1=Do not use Powershell version 7, use embedded version 5.1}}
* '''Problematic''': You would like to install the MicrosoftTeams powershell module
* '''Additional Information''' : please refer to https://docs.microsoft.com/en-us/microsoftteams/teams-powershell-install
* '''Solution''': Follow the procedure below
# Uninstall the old SkypeOnlineConnector Powershell module in [[{{FULLPAGENAME}}#.28old.29_SkypeOnlineConnector_:_Uninstall_the_module]]
# Open Start menu and search "powershell" ( click the small Arrow to open it in Administrator mode ) Make sure to run the embedded version
# Use the powershell commands below to install the module '''"Install-Module MicrosoftTeams"'''
# Accept to install the module from Powershell PSRepository


*'''Problematic''': You would like to install the MicrosoftTeams powershell module
*'''Additional Information''' : please refer to https://docs.microsoft.com/en-us/microsoftteams/teams-powershell-install
*'''Solution''': Follow the procedure below

#(optional) Uninstall the old SkypeOnlineConnector Powershell module in [[{{FULLPAGENAME}}#.28old.29_SkypeOnlineConnector_:_Uninstall_the_module]]
#Open Start menu and search "powershell" ( click the small Arrow to open it in Administrator mode ) Make sure to run the embedded version
#Use the powershell commands below to install the module '''"Install-Module MicrosoftTeams -RequiredVersion 4.5.0"''' (later version might work, but we validated this one)
#Accept to install the module from Powershell PSRepository


''Install the MicrosoftTeams 4.5.0 version''
<source lang="powershell">
<source lang="powershell">
PS C:\WINDOWS\system32> Install-Module MicrosoftTeams
PS H:\> Install-Module MicrosoftTeams -RequiredVersion 4.5.0


Untrusted repository
Untrusted repository
Line 51: Line 55:
'PSGallery'?
'PSGallery'?
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "N"): Y
[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "N"): Y
PS C:\WINDOWS\system32> Get-Module -ListAvailable MicrosoftTeams


Directory: C:\Program Files\WindowsPowerShell\Modules




PS H:\> Get-Module -ListAvailable MicrosoftTeams
Directory: H:\WindowsPowerShell\Modules
ModuleType Version Name ExportedCommands
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
---------- ------- ---- ----------------
Binary 1.1.6 MicrosoftTeams {Add-TeamUser, Connect-MicrosoftTeams, Disconnect-Microsof...
Script 4.5.0 MicrosoftTeams {Add-TeamChannelUser, Add-TeamUser, Connect-MicrosoftTeams...

</source>
</source>


Line 71: Line 74:
</table>
</table>


==== MicrosoftTeams : What is the installed version of the module ====
====MicrosoftTeams : What is the installed version of the module====


* '''Problematic''' : You would like to know which version of MicrosoftTeams you are running
*'''Problematic''' : You would like to know which version of MicrosoftTeams you are running
* '''Solution''': Use the command below "Get-Module -ListAvailable MicrosoftTeams"
*'''Solution''': Use the command below "Get-Module -ListAvailable MicrosoftTeams"
* '''Additional Information''': You can verify the changelog of the version in https://docs.microsoft.com/en-us/microsoftteams/teams-powershell-release-notes
*'''Additional Information''': You can verify the changelog of the version in https://docs.microsoft.com/en-us/microsoftteams/teams-powershell-release-notes




''Normal output if you have install the version 4.5.0''
<source lang="powershell">
PS H:\> Get-Module -ListAvailable MicrosoftTeams


Directory: C:\Program Files\WindowsPowerShell\Modules


ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Script 4.5.0 MicrosoftTeams {Add-TeamChannelUser, Add-TeamUser, Connect-MicrosoftTeams...
</source>


''Here is the output if you have 2 versions installed, you can use next section to delete the one you wish to remove''
<source lang="powershell">
<source lang="powershell">
PS C:\WINDOWS\system32> Get-Module -ListAvailable MicrosoftTeams
PS C:\WINDOWS\system32> Get-Module -ListAvailable MicrosoftTeams
Line 87: Line 105:
ModuleType Version Name ExportedCommands
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
---------- ------- ---- ----------------
Binary 1.1.6 MicrosoftTeams {Add-TeamUser, Connect-MicrosoftTeams, Disconnect-Microsof...
Script 4.5.0 MicrosoftTeams {Add-TeamChannelUser, Add-TeamUser, Connect-MicrosoftTeams...
Binary 2.0.0 MicrosoftTeams {Add-TeamUser, Connect-MicrosoftTeams, Disconnect-Microsof...
</source>
</source>


====MicrosoftTeams : Update the module to last version====


*'''Problematic''': You have see that there is a new powershell MicrosoftTeams module in https://docs.microsoft.com/en-us/microsoftteams/teams-powershell-release-notes and you would like to install it
==== MicrosoftTeams : Update the module to last version ====
*'''Solution''': Follow the procedure below


#Open Start menu and search "powershell" ( click the small Arrow to open it in Administrator mode ) Make sure to run the embedded version
* '''Problematic''': You have see that there is a new powershell MicrosoftTeams module in https://docs.microsoft.com/en-us/microsoftteams/teams-powershell-release-notes and you would like to install it
#Use the powershell commands below to remove the module "Update-Module MicrosoftTeams"
* '''Solution''': Follow the procedure below
# Open Start menu and search "powershell" ( click the small Arrow to open it in Administrator mode ) Make sure to run the embedded version
# Use the powershell commands below to remove the module "Update-Module MicrosoftTeams"


<source lang="powershell">
<source lang="powershell">
Line 103: Line 122:




==== MicrosoftTeams : Uninstall the module ====
====MicrosoftTeams : Uninstall the module====


* '''Problematic''': You would like to uninstall the MicrosoftTeams powershell module
*'''Problematic''': You would like to uninstall the MicrosoftTeams powershell module
* '''Additional Information''' : please refer to https://docs.microsoft.com/en-us/microsoftteams/teams-powershell-install
*'''Additional Information''' : please refer to https://docs.microsoft.com/en-us/microsoftteams/teams-powershell-install
* '''Solution''': Follow the procedure below
*'''Solution''': Follow the procedure below
# Open Start menu and search "powershell" ( click the small Arrow to open it in Administrator mode ) Make sure to run the embedded version
# Use the powershell commands below to remove the module "Uninstall-Module MicrosoftTeams"


#Open Start menu and search "powershell" ( click the small Arrow to open it in Administrator mode ) Make sure to run the embedded version
#Use the powershell commands below to remove the module "Uninstall-Module MicrosoftTeams"


''Uninstall all versions of the module''
<source lang="powershell">
<source lang="powershell">
PS C:\WINDOWS\system32> Uninstall-Module MicrosoftTeams
PS C:\WINDOWS\system32> Uninstall-Module MicrosoftTeams
Line 116: Line 138:




===(old) SkypeOnlineConnector / Skype for Business Online===


*'''Information''': The "Skype for Business Online" powershell module is being replaced with the MicrosoftTeams one, so please prefer using MicrosoftTeams now


=== (old) SkypeOnlineConnector / Skype for Business Online ===
====(old) SkypeOnlineConnector : Install the "Skype for Business Online" Powershell module====


* '''Information''': The "Skype for Business Online" powershell module is being replaced with the MicrosoftTeams one, so please prefer using MicrosoftTeams now
*'''Problematic''': You would like to install the old "Skype for Business Online" Powershell module
*'''Solution''': Follow the procedure below


#Download and execute SkypeOnlinePowerShell.exe from https://www.microsoft.com/en-us/download/details.aspx?id=39366
==== (old) SkypeOnlineConnector : Install the "Skype for Business Online" Powershell module ====
#Open a Powershell shell from start menu '''IN ADMINISTRATOR MODE'''

#Type the commands below to import the module and verify its version
* '''Problematic''': You would like to install the old "Skype for Business Online" Powershell module
* '''Solution''': Follow the procedure below
# Download and execute SkypeOnlinePowerShell.exe from https://www.microsoft.com/en-us/download/details.aspx?id=39366
# Open a Powershell shell from start menu '''IN ADMINISTRATOR MODE'''
# Type the commands below to import the module and verify its version


<source lang="powershell">
<source lang="powershell">
Line 136: Line 157:




==== (old) SkypeOnlineConnector : What is the version installed ? ====
====(old) SkypeOnlineConnector : What is the version installed ?====


''Here we can see that SkypeOnlineConnector in version 7.0.0.0 is installed''
''Here we can see that SkypeOnlineConnector in version 7.0.0.0 is installed''
Line 151: Line 172:
</source>
</source>


==== (old) SkypeOnlineConnector : Uninstall the module ====
====(old) SkypeOnlineConnector : Uninstall the module====


* '''Information''': Removing the module is recommended if you are now using the MicrosoftTeams module, because it provides the same fonctions in additional of new ones dedicated to MicrosoftTeams management
*'''Information''': Removing the module is recommended if you are now using the MicrosoftTeams module, because it provides the same fonctions in additional of new ones dedicated to MicrosoftTeams management
* '''Problematic''': You would like to uninstall the SkypeOnlineConnector module
*'''Problematic''': You would like to uninstall the SkypeOnlineConnector module
* '''Solution''': Follow the procedure below
*'''Solution''': Follow the procedure below

# Open Start menu and search for "remove" to access the Settings / Add or Remove programs
#Open Start menu and search for "remove" to access the Settings / Add or Remove programs
# Search "skype"
#Search "skype"
# Click the uninstall button on "Skype for Business Online Powershell" module
#Click the uninstall button on "Skype for Business Online Powershell" module
<table>
<table>
<tr><td>
<tr><td>
Line 165: Line 187:
</table>
</table>


== Powershell VTX Script Management ==
==Powershell VTX Script Management==


=== Update all VTX Powershell scripts to last version ===
===Update all VTX Powershell scripts to last version===


{{Notice|1=Before using any of the script, we advise you to simply run the script "VTX_Teams_Update_All_Scripts.ps1" to make sure to run last version}}
* '''Information''': Using this command you can update all VTX powershell scripts to last version
# Open a powershell shell
# Copy paste the commands below


*'''Problematic''': You would like to get the last version of all VTX Teams scripts
<source lang="powershell">
*'''Solution''': Simply follow the steps below
# Update all VTX powershell scripts to last version and save them in your User Desktop folder
$DesktopPath = [Environment]::GetFolderPath("Desktop")
cd $DesktopPath
wget https://wiki.vtx.ch/media/VTX_Teams_Create_Routing_Rules.ps1 -outfile VTX_Teams_Create_Routing_Rules.ps1
wget https://wiki.vtx.ch/media/VTX_Teams_Assign_Numbers.ps1 -outfile VTX_Teams_Assign_Numbers.ps1
wget https://wiki.vtx.ch/media/VTX_Teams_Delete_Routing_Rules.ps1 -outfile VTX_Teams_Delete_Routing_Rules.ps1


#Create a folder on your PC like "VTX Teams Scripts"
</source>
#Download https://wiki.vtx.ch/media/VTX_Teams_Update_All_Scripts.ps1 and put it in this folder ( Righ Click on the link and download the target file )
#Execute '''VTX_Teams_Update_All_Scripts.ps1''' in powershell ( right click on the script and select "Run with Powershell"
#In case of problem, you can use the table below to download each file one by one<br />
<table>
<tr><td>
[[Image:Teams-Script-Download-updater-03.png|thumb|800px|left|Teams Script - Use Updater]]
</td><td>
[[Image:Teams-Script-Download-updater-02.png|thumb|800px|left|Teams Script - Updater Output]]
</td></tr>
<tr><td>
[[Image:Teams-Script-Download-updater-01.png|thumb|800px|left|Teams Script - New Files downloaded]]
</td><td></td></tr>
</table>


{| class="wikitable"
|+'''VTX Teams Management Powershell Scriptst'''
!'''Usage'''
!'''Script Name'''
!'''Link'''
|-
|Download or update all scripts
|'''VTX_Teams_Update_All_Scripts.ps1'''
|wget https://wiki.vtx.ch/media/VTX_Teams_Update_All_Scripts.ps1
|-
|Create VTX Teams Direct Routing
to be used only ones at 1st setup
|'''VTX_Teams_Create_Routing_Rules.ps1'''
|wget https://wiki.vtx.ch/media/VTX_Teams_Create_Routing_Rules.ps1
|-
|Assign or Remove numbers to users
|'''VTX_Teams_Assign_Numbers.ps1'''
|wget https://wiki.vtx.ch/media/VTX_Teams_Assign_Numbers.ps1
|-
|<s>Assign or Remove numbers to resources</s>
not needed anymore, please use VTX_Teams_Assign_Numbers.ps1
|'''<s>VTX_Connect_Teams_Assign_Resource_Numbers.ps1</s>'''
|<s>wget https://wiki.vtx.ch/media/VTX_Connect_Teams_Assign_Resource_Numbers.ps1</s>
|-
|Unmap numbers for all users and resources
then, delete routing
|'''VTX_Teams_Delete_Routing_Rules.ps1'''
|wget https://wiki.vtx.ch/media/VTX_Teams_Delete_Routing_Rules.ps1
|}
<br />

Latest revision as of 15:45, 1 July 2022

Powershell version[edit | edit source]

What is my Powershell version ?[edit | edit source]

  • Problematic: You would like to know which powershell version you are using
  • Solution: Start a Powershell shell and type the command "$PSVersionTable.PSVersion"
PS H:\> $PSVersionTable.PSVersion
Major  Minor  Build  Revision
-----  -----  -----  --------
5      1      19041  610

Install Powershell[edit | edit source]


Powershell Module Management[edit | edit source]

MicrosoftTeams Module[edit | edit source]

MicrosoftTeams : Install the module[edit | edit source]

  1. (optional) Uninstall the old SkypeOnlineConnector Powershell module in VoIP:Teams:Powershell#.28old.29_SkypeOnlineConnector_:_Uninstall_the_module
  2. Open Start menu and search "powershell" ( click the small Arrow to open it in Administrator mode ) Make sure to run the embedded version
  3. Use the powershell commands below to install the module "Install-Module MicrosoftTeams -RequiredVersion 4.5.0" (later version might work, but we validated this one)
  4. Accept to install the module from Powershell PSRepository


Install the MicrosoftTeams 4.5.0 version

PS H:\> Install-Module MicrosoftTeams -RequiredVersion 4.5.0

Untrusted repository
You are installing the modules from an untrusted repository. If you trust this repository, change its
InstallationPolicy value by running the Set-PSRepository cmdlet. Are you sure you want to install the modules from
'PSGallery'?
[Y] Yes  [A] Yes to All  [N] No  [L] No to All  [S] Suspend  [?] Help (default is "N"): Y


PS H:\> Get-Module -ListAvailable MicrosoftTeams
    Directory: H:\WindowsPowerShell\Modules
ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     4.5.0      MicrosoftTeams                      {Add-TeamChannelUser, Add-TeamUser, Connect-MicrosoftTeams...


Start Powershell in Administrator mode
Powershell - Install MicrosoftTeams module

MicrosoftTeams : What is the installed version of the module[edit | edit source]


Normal output if you have install the version 4.5.0

PS H:\> Get-Module -ListAvailable MicrosoftTeams


    Directory: C:\Program Files\WindowsPowerShell\Modules


ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     4.5.0      MicrosoftTeams                      {Add-TeamChannelUser, Add-TeamUser, Connect-MicrosoftTeams...


Here is the output if you have 2 versions installed, you can use next section to delete the one you wish to remove

PS C:\WINDOWS\system32> Get-Module -ListAvailable MicrosoftTeams


    Directory: C:\Program Files\WindowsPowerShell\Modules


ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     4.5.0      MicrosoftTeams                      {Add-TeamChannelUser, Add-TeamUser, Connect-MicrosoftTeams...
Binary     2.0.0      MicrosoftTeams                      {Add-TeamUser, Connect-MicrosoftTeams, Disconnect-Microsof...

MicrosoftTeams : Update the module to last version[edit | edit source]

  1. Open Start menu and search "powershell" ( click the small Arrow to open it in Administrator mode ) Make sure to run the embedded version
  2. Use the powershell commands below to remove the module "Update-Module MicrosoftTeams"
PS C:\WINDOWS\system32> Update-Module MicrosoftTeams


MicrosoftTeams : Uninstall the module[edit | edit source]

  1. Open Start menu and search "powershell" ( click the small Arrow to open it in Administrator mode ) Make sure to run the embedded version
  2. Use the powershell commands below to remove the module "Uninstall-Module MicrosoftTeams"


Uninstall all versions of the module

PS C:\WINDOWS\system32> Uninstall-Module MicrosoftTeams


(old) SkypeOnlineConnector / Skype for Business Online[edit | edit source]

  • Information: The "Skype for Business Online" powershell module is being replaced with the MicrosoftTeams one, so please prefer using MicrosoftTeams now

(old) SkypeOnlineConnector : Install the "Skype for Business Online" Powershell module[edit | edit source]

  • Problematic: You would like to install the old "Skype for Business Online" Powershell module
  • Solution: Follow the procedure below
  1. Download and execute SkypeOnlinePowerShell.exe from https://www.microsoft.com/en-us/download/details.aspx?id=39366
  2. Open a Powershell shell from start menu IN ADMINISTRATOR MODE
  3. Type the commands below to import the module and verify its version
 PS C:\WINDOWS\system32> Set-ExecutionPolicy RemoteSigned -Force
 PS C:\WINDOWS\system32> Import-Module SkypeOnlineConnector


(old) SkypeOnlineConnector : What is the version installed ?[edit | edit source]

Here we can see that SkypeOnlineConnector in version 7.0.0.0 is installed

 PS C:\WINDOWS\system32> Import-Module SkypeOnlineConnector
 PS C:\WINDOWS\system32> Get-Module -ListAvailable  SkypeOnlineConnector

    Directory: C:\Program Files\Common Files\Skype for Business Online\Modules

ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     7.0.0.0    SkypeOnlineConnector                {Get-CsOnlinePowerShellEndpoint, Get-CsOnlinePowerShellAcc...

(old) SkypeOnlineConnector : Uninstall the module[edit | edit source]

  • Information: Removing the module is recommended if you are now using the MicrosoftTeams module, because it provides the same fonctions in additional of new ones dedicated to MicrosoftTeams management
  • Problematic: You would like to uninstall the SkypeOnlineConnector module
  • Solution: Follow the procedure below
  1. Open Start menu and search for "remove" to access the Settings / Add or Remove programs
  2. Search "skype"
  3. Click the uninstall button on "Skype for Business Online Powershell" module
Add or Remove - Uninstall SkypeOnlineConnector

Powershell VTX Script Management[edit | edit source]

Update all VTX Powershell scripts to last version[edit | edit source]

  • Problematic: You would like to get the last version of all VTX Teams scripts
  • Solution: Simply follow the steps below
  1. Create a folder on your PC like "VTX Teams Scripts"
  2. Download https://wiki.vtx.ch/media/VTX_Teams_Update_All_Scripts.ps1 and put it in this folder ( Righ Click on the link and download the target file )
  3. Execute VTX_Teams_Update_All_Scripts.ps1 in powershell ( right click on the script and select "Run with Powershell"
  4. In case of problem, you can use the table below to download each file one by one
Teams Script - Use Updater
Teams Script - Updater Output
Teams Script - New Files downloaded


VTX Teams Management Powershell Scriptst
Usage Script Name Link
Download or update all scripts VTX_Teams_Update_All_Scripts.ps1 wget https://wiki.vtx.ch/media/VTX_Teams_Update_All_Scripts.ps1
Create VTX Teams Direct Routing

to be used only ones at 1st setup

VTX_Teams_Create_Routing_Rules.ps1 wget https://wiki.vtx.ch/media/VTX_Teams_Create_Routing_Rules.ps1
Assign or Remove numbers to users VTX_Teams_Assign_Numbers.ps1 wget https://wiki.vtx.ch/media/VTX_Teams_Assign_Numbers.ps1
Assign or Remove numbers to resources

not needed anymore, please use VTX_Teams_Assign_Numbers.ps1

VTX_Connect_Teams_Assign_Resource_Numbers.ps1 wget https://wiki.vtx.ch/media/VTX_Connect_Teams_Assign_Resource_Numbers.ps1
Unmap numbers for all users and resources

then, delete routing

VTX_Teams_Delete_Routing_Rules.ps1 wget https://wiki.vtx.ch/media/VTX_Teams_Delete_Routing_Rules.ps1