VoIP:Teams:Powershell: Difference between revisions

From VTX Public Wiki

m (→‎MicrosoftTeams : Install the module: Add optional info to 1st uninstall)
(→‎Powershell Module Management: Now install version 2.0.0)
Line 35: Line 35:


{{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}}
{{Warning|1=New MicrosoftTeams modules 2.0.0 is not yet compatible with our script, so please stick with version 1.1.6 until ready}}
* '''Problematic''': You would like to install the MicrosoftTeams powershell module
* '''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
* '''Additional Information''' : please refer to https://docs.microsoft.com/en-us/microsoftteams/teams-powershell-install
Line 41: Line 40:
# (optional) Uninstall the old SkypeOnlineConnector Powershell module in [[{{FULLPAGENAME}}#.28old.29_SkypeOnlineConnector_:_Uninstall_the_module]]
# (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
# 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"'''
# Use the powershell commands below to install the module '''"Install-Module MicrosoftTeams -RequiredVersion 2.0.0"'''
# Accept to install the module from Powershell PSRepository
# Accept to install the module from Powershell PSRepository




''Install the MicrosoftTeams 1.1.6 version''
''Install the MicrosoftTeams 2.0.0 version (later version might work, but we validated this one)''
<source lang="powershell">
<source lang="powershell">
PS C:\WINDOWS\system32> Install-Module MicrosoftTeams -RequiredVersion 1.1.6
PS C:\WINDOWS\system32> Install-Module MicrosoftTeams -RequiredVersion 2.0.0


Untrusted repository
Untrusted repository
Line 62: Line 61:
ModuleType Version Name ExportedCommands
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
---------- ------- ---- ----------------
Binary 1.1.6 MicrosoftTeams {Add-TeamUser, Connect-MicrosoftTeams, Disconnect-Microsof...
Binary 2.0.0 MicrosoftTeams {Add-TeamUser, Connect-MicrosoftTeams, Disconnect-Microsof...


</source>
</source>





''Install last stable version ( warning, it will install version 2.0.0 that is not yet compatible with our scripts)''
<source lang="powershell">
PS C:\WINDOWS\system32> Install-Module MicrosoftTeams

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 C:\WINDOWS\system32> Get-Module -ListAvailable MicrosoftTeams


Directory: C:\Program Files\WindowsPowerShell\Modules


ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Binary 2.0.0 MicrosoftTeams {Add-TeamUser, Connect-MicrosoftTeams, Disconnect-Microsof...
</source>




Line 105: Line 82:




''Normal output if you have install the version 1.1.6''
''Normal output if you have install the version 2.0.0''
<source lang="powershell">
<source lang="powershell">
PS C:\WINDOWS\system32> Get-Module -ListAvailable MicrosoftTeams
PS C:\WINDOWS\system32> Get-Module -ListAvailable MicrosoftTeams
Line 115: Line 92:
ModuleType Version Name ExportedCommands
ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
---------- ------- ---- ----------------
Binary 1.1.6 MicrosoftTeams {Add-TeamUser, Connect-MicrosoftTeams, Disconnect-Microsof...
Binary 2.0.0 MicrosoftTeams {Add-TeamUser, Connect-MicrosoftTeams, Disconnect-Microsof...
</source>
</source>


Line 130: Line 107:
---------- ------- ---- ----------------
---------- ------- ---- ----------------
Binary 2.0.0 MicrosoftTeams {Add-TeamUser, Connect-MicrosoftTeams, Disconnect-Microsof...
Binary 2.0.0 MicrosoftTeams {Add-TeamUser, Connect-MicrosoftTeams, Disconnect-Microsof...
Binary 1.1.6 MicrosoftTeams {Add-TeamUser, Connect-MicrosoftTeams, Disconnect-Microsof...<<
Binary 1.1.6 MicrosoftTeams {Add-TeamUser, Connect-MicrosoftTeams, Disconnect-Microsof...
</source>
</source>


Line 159: Line 136:
</source>
</source>




==== MicrosoftTeams : Uninstall version 2.0.0 and keep only version 1.1.6 ====

* '''Problem''': Version 2.0.0 of the MicrosoftTeams module is not yet compatible with our script
* '''Workaround''': Install version 1.1.6 and remove version 2.0.0, cf below
* '''Solution''': We are working on an upgrade of our script to make them compatible with version 2.0.0


''Uninstall a specific version of the module (remove 2.0.0 version and keep only 1.1.6)''
<source lang="powershell">
PS C:\WINDOWS\system32> Get-Module -ListAvailable MicrosoftTeams
PS C:\WINDOWS\system32> Install-Module MicrosoftTeams -RequiredVersion 1.1.6
PS C:\WINDOWS\system32> Uninstall-Module MicrosoftTeams -RequiredVersion 2.0.0
</source>


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

Revision as of 15:28, 21 April 2021

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 2.0.0"
  4. Accept to install the module from Powershell PSRepository


Install the MicrosoftTeams 2.0.0 version (later version might work, but we validated this one)

PS C:\WINDOWS\system32> Install-Module MicrosoftTeams -RequiredVersion 2.0.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 C:\WINDOWS\system32> Get-Module -ListAvailable MicrosoftTeams


    Directory: C:\Program Files\WindowsPowerShell\Modules


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


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 2.0.0

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


    Directory: C:\Program Files\WindowsPowerShell\Modules


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


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
---------- -------    ----                                ----------------
Binary     2.0.0      MicrosoftTeams                      {Add-TeamUser, Connect-MicrosoftTeams, Disconnect-Microsof...
Binary     1.1.6      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]

  • Information: Using this command you can update all VTX powershell scripts to last version
  1. Open a powershell shell
  2. Copy paste the commands 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
wget https://wiki.vtx.ch/media/VTX_Connect_Teams_Assign_Resource_Numbers.ps1 -outfile VTX_Connect_Teams_Assign_Resource_Numbers.ps1