Forum Discussion
tobyliu
Oct 20, 2020Copper Contributor
What is the Microsoft Teams Protection PowerShell in Microsoft 365 organization?
Exchange Online Protection PowerShell has a url: https://ps.protection.outlook.com/powershell-liveid/ or https://ps.protection.outlook.de/powershell-liveid/ But i want ...
VasilMichev
Oct 21, 2020MVP
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?AdminDomain=domain.com one.
tobyliu
Oct 21, 2020Copper Contributor
WSManConnectionInfo connectionInfo = new WSManConnectionInfo(
new Uri("https://admin0e.online.lync.com/OcsPowershellOAuth?
AdminDomain=tenant.onmicrosoft.com"),
"http://schemas.microsoft.com/powershell/Microsoft.Teams",
TeamPSHelper.credential)
{
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);
//TeamPSHelper.GetTeamSettingsCmdlet(runspace);
TeamPSHelper.DisconnectTeamSessionCmdlet(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?AdminDomain=domain.com" is invalid?