powershell - 对于我以外的任何人,Office 365 Powershell 的 Set-UserPhoto 问题

标签 powershell office365 powershell-3.0

我是我们 365 环境的全局管理员,我在 powershell 中遇到了 Set-UserPhoto 命令的问题。如果我为自己的用户名运行它,它工作得很好,但如果我使用其他人的用户名运行它,它会出错。我需要给自己某种访问权限才能完成这项工作吗?我是 365 的域管理员和全局管理员,所以我应该可以做任何事情。

使用以下命令通过 PowerShell 3.0 连接:

$UserCredential = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/?proxyMethod=RPS -Credential $UserCredential -Authentication Basic -AllowRedirection
Import-PSSession $Session

我正在运行的命令:
Set-UserPhoto –Identity username -PictureData ([System.IO.File]::ReadAllBytes("C:\userpics\username.jpg"))

适用于我的用户名,对于我得到的任何其他用户名:

Error on proxy command 'Set-UserPhoto -Identity:'username' -PictureData: Tons of numbers here that scrolls for quite a while -Confirm:$False' to server BN3PR0201MB1027.namprd02.prod.outlook.com: Server version 15.01.0534.0000, Proxy method RPS: The WinRM client cannot process the request. The connection string should be of the form [://][:][/] where transport is one of "http" or "https". Transport, port and suffix are optional. The host may be a hostname or an IP address. For IPv6 addresses, enclose the address in brackets - e.g. "http://[1::2]:80/wsman". Change the connection string and try the request again. . + CategoryInfo : NotSpecified: (:) [Set-UserPhoto], CmdletProxyException + FullyQualifiedErrorId : Microsoft.Exchange.Configuration.CmdletProxyException,Microsoft.Exchange.Management.Reci pientTasks.SetUserPhoto + PSComputerName : outlook.office365.com

最佳答案

刚刚遇到了完全相同的问题。

解决方案是“以管理员身份”运行 Windows PowerShell 的 Microsoft Azure Active Directory 模块(提升)

如此处所示https://www.blackforce.co.uk/2016/09/23/set-userphoto-error-proxy-command

关于powershell - 对于我以外的任何人,Office 365 Powershell 的 Set-UserPhoto 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38359252/

相关文章:

azure - Azurerm 中导入 Az WebApp KeyVault 证书的替代方案

PowerShell脚本: AD query based on computer-name pattern not returning results

powershell - PowerShell:控制台应用程序的远程执行失败

git - PowerShell ISE 在 git checkout 上抛出错误

file - 将字符串中的特定位置输出到变量

powershell - 缺少PowerShell命令?

azure - 如果您有 Office 365,可以取消对 Azure Active Directory 的访问吗?

升级到 Office 365 专业增强版后,Excel VBA 运行速度极慢

office365 - 如果应用程序错过通知 - SequenceNumber 跳过一个或多个该怎么办?

windows - 在 Windows Power shell 脚本中编写 tsv 文件的优化方法是什么?