'术语 'New-ComplianceTag' 未被识别为 cmdlet、函数、脚本文件或可运行程序的名称

问题描述

应该怎么做,如何消除这个 System.Management.Automation.CommandNotFoundException 错误 当我尝试使用 c# 在 powershell 中调用此命令时 但是当我直接在 powershell 中执行时,我工作正常。 enter image description here

解决方法

这是用于安全与合规中心的 Exchange Online cmdlet。 Exchange Online 模块从 Microsoft 远程加载 cmdlet。它只会加载您有权访问的 cmdlet。

我最好的猜测是您缺少此 cmdlet/ 设置的权限。