Installation
You need the built-in PowerShell, version 5, because PowerShell Core, a.k.a. PowerShell 6, doesn’t work yet. If in doubt, check the version with:
$PSVersionTable.PSVersion
You need to install a bunch of stuff:
- Visual C++ 2017 x64 Redistributable
- Microsoft Online Services Sign-In Assistant for IT Professionals RTW
- Skype for Business Online Windows PowerShell Module
Then run PowerShell as admin, and enable running scripts. Also install the MSOnline
module:
Set-ExecutionPolicy RemoteSigned
Install-Module MSOnline
Install-Module MicrosoftTeams
Exit from admin PowerShell.
Connecting
Skype for Business
This is the one you’ll use the most. Start regular (non-admin) PowerShell, then open your session:
Import-Module SkypeOnlineConnector
$sfboSession = New-CsOnlineSession
Import-PSSession $sfboSession
When finished, remove the session (this is important, otherwise you might run out of your session pool for a while):
Remove-PSSession $Session
For a complete list of commands, see Skype for Business PowerShell.
Microsoft Teams
Pretty straight-forward:
Connect-MicrosoftTeams
For the command reference, refer to Microsoft Teams PowerShell.