powershell - 我从哪里获得 Powershell Cmdlet Remove-UserPhoto

标签 powershell active-directory azure-active-directory user-profile

我在网络上的任何地方都找不到这个,我需要一个答案,所以我可以从我们的 Azure AD 帐户的配置文件中删除所有用户照片。 Microsoft 非常友好地记录如何使用 Get-UserPhotoRemove-UserPhoto ,但没有说明如何实际获取 Cmdlet。

我事件去了他们的文档页面 connecting to Azure Active Directory in Powershell ,但这也无济于事。它允许我下载 AzureAD 模块(认为我需要它来运行那些 Cmdlet),但没有运气。任何人都告诉我如何获得包含这些命令的模块?

更新问题:
我们只使用 Office 365。我们没有任何现场 Exchange 服务器,那么如果没有它,我应该如何执行 Exchange PowerShell 脚本呢?任何管理员将如何做到这一点?我很难相信我是唯一需要从 Office 365 中的配置文件中删除照片并希望以自动化方式执行此操作的白痴。

我看到的另一个问题是,当我浏览到我们的用户列表时,照片没有出现在 Azure 的用户列表中。但是,如果我去随机的 O365 应用程序(例如 Teams),就会出现个人资料图片。

最佳答案

您需要连接到远程 Exchange Online session :

$credential = Get-Credential
$exchangeSession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri "https://outlook.office365.com/powershell-liveid/" -Credential $credential -Authentication "Basic" -AllowRedirection
Import-PSSession $exchangeSession

一旦你这样做,你将导入包含 Remove-UserPhoto 的模块。 cmdlet 并且将能够做你想做的事。

关于powershell - 我从哪里获得 Powershell Cmdlet Remove-UserPhoto,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45218680/

相关文章:

powershell - 相当于 gpresult/r 与 powershell 没有广告模块

c# - 脚本通过 PowerShell 控制台正确运行,通过 C# 运行时失败

powershell - 如何让 Powershell 在计划任务中执行?

powershell - 为什么我在文本文件中没有输出文件或没有内容?

c# - 使用 System.DirectoryServices.xxx 是否可以确定用户可以管理哪些 AD 组?

c# - 使用 c# 的 Active Directory 属性列表

同一应用程序中的 Azure AD B2B 和 B2C

azure - 在自定义政策中更改 azure ad b2c 的背景图像

azure - 请求 Azure 服务管理 API 范围有限的 Azure Active Directory token

powershell - 使用 -Command 和 -File 开关从命令行 (cmd.exe) 运行 Powershell.exe?