PowerShell:尽管已加载二进制文件,但未找到 Cmdlet Connect-MicrosoftTeams

PowerShell: Cmdlet Connect-MicrosoftTeams not found although the binary is loaded

我在 PowerShell 中加载 MicrosoftTeams 模块时遇到问题。我使用 AllSigned 授权下载并导入了模块(没有错误):

PS C:\WINDOWS\system32> Install-Module -Name MicrosoftTeams
PS C:\WINDOWS\system32> Import-Module MicrosoftTeams

检查模块是否正确加载,我还打印了显示当前版本号的可用模块:

PS C:\WINDOWS\system32> get-module -listavailable


    Verzeichnis: C:\Program Files\WindowsPowerShell\Modules


ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     1.0.1      Microsoft.PowerShell.Operation.V... {Get-OperationValidation, Invoke-OperationValidation}
Binary     1.1.4      MicrosoftTeams                      {Add-TeamUser, Connect-MicrosoftTeams, Disconnect-Microsof...
Binary     1.0.0.1    PackageManagement                   {Find-Package, Get-Package, Get-PackageProvider, Get-Packa...
Script     3.4.0      Pester                              {Describe, Context, It, Should...}
Script     1.0.0.1    PowerShellGet                       {Install-Module, Find-Module, Save-Module, Update-Module...}
Script     2.0.0      PSReadline                          {Get-PSReadLineKeyHandler, Set-PSReadLineKeyHandler, Remov...

现在,我想使用 cmdlet Connect-MicrosoftTeams 连接到 Teams,该 cmdlet 明确列为此导入模块中的导出 cmdlet 之一。但不知何故,PowerShell 找不到命令:

PS C:\WINDOWS\system32> Connect-MicrosoftTeams
Connect-MicrosoftTeams : Die Benennung "Connect-MicrosoftTeams" wurde nicht als Name eines Cmdlet, einer Funktion,
einer Skriptdatei oder eines ausführbaren Programms erkannt. Überprüfen Sie die Schreibweise des Namens, oder ob der
Pfad korrekt ist (sofern enthalten), und wiederholen Sie den Vorgang.
In Zeile:1 Zeichen:1
+ Connect-MicrosoftTeams
+ ~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Connect-MicrosoftTeams:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

[对不起德国人:上面写着:该名称未被识别为 cmdlet 或函数名称。但是,如果您使用 PS]

,您可能知道该消息

现在,我的问题是:如何让 PS 识别命令以及如何找出错误所在?是否有列出当前 运行 脚本和可用命令的命令?或者有没有可能强制执行脚本?

我可以看到输出显示您已经成功安装了模块。但是,它似乎有一些问题。我建议你 re-install 看看效果如何:

  1. 运行 Windows PowerShell 作为管理员
  2. 运行 命令 Uninstall-Module MicrosoftTeams,关闭 PowerShell 并 re-open 一个新的 提升的 PowerShell 会话
  3. 运行 命令 Install-Module MicrosoftTeams,相关文档。 https://docs.microsoft.com/en-us/microsoftteams/teams-powershell-install

安装成功后,请关闭 PowerShell 并以管理员身份 re-open 一个新的提升权限的 PowerShell 会话,运行 Connect-MicrosoftTeams 再次看看它现在是否有效。如果仍然存在同样的问题,请附上整个输出的屏幕截图以供进一步检查。

我必须安装“Skype for Business Online,Windows PowerShell 模块”才能获取 Connect-MicrosoftTeams https://www.microsoft.com/en-us/download/details.aspx?id=39366