What is the Microsoft Teams Protection PowerShell in Microsoft 365 organization?

Occasional Contributor

Exchange Online Protection PowerShell has a url:





But i want to user power shell by remote host,i can`t find any Protection PowerShell url which can work success in Microsoft Teams.

I need the url to start code in c# project  with System.Management.Automation.Runspaces.WSManConnectionInfo(remoteUrl,shellUrl,credential);

Please help me to fix it.Thanks a lot~

4 Replies

There is none. Exchange/SfB use PowerShell remoting, Teams uses direct calls against the Graph API endpoints: https://docs.microsoft.com/en-us/graph/api/resources/teams-api-overview?view=graph-rest-1.0

@Vasil Michev  But i need to Manage the Policies about The Microsoft Teams,the Graph API don`t have any api about Set Team Policies.So i need to user Power shell remote host.The Policies Setting Power shell cmdlet is on the SFB power shell site


and only a little cmdlet on the Teams power shell site.


Policies are managed via SfB cmdlets, no need for anything Teams PowerSHell related there. If you want to establish a session outside of the module, use the https://admin0e.online.lync.com/OcsPowershellOAuth?AdminDomain=tenant.onmicrosoft.com endpoint, or the newer https://api.interfaces.records.teams.microsoft.com/OcsPowershellOAuth/admin0e.online.lync.com?AdminD... one.

@Vasil Michev 

WSManConnectionInfo connectionInfo = new WSManConnectionInfo(
    new Uri("https://admin0e.online.lync.com/OcsPowershellOAuth? 
    AuthenticationMechanism = AuthenticationMechanism.Basic,
    SkipCACheck = true,
    SkipCNCheck = true,
    MaximumConnectionRedirectionCount = 4
using (var runspace = RunspaceFactory.CreateRunspace(connectionInfo))
    runspace.Open();   // throw error at here !!!!!!!!!

    var result = TeamPSHelper.ConnectTeamSessionCmdlet(runspace);



I use this url to create runspace,but return error.Please help me to have a look error,why be error?the url "https://admin0e.online.lync.com/OcsPowershellOAuth?AdminDomain=tenant.onmicrosoft.com" or "https://api.interfaces.records.teams.microsoft.com/OcsPowershellOAuth/admin0e.online.lync.com?AdminD..." is invalid?