我正在尝试将一些东西放在一起,以使用 AD 缩略图照片在 Windows 8 上设置用户的帐户图片。看来我应该能够使用 WinRT 的 API 来执行此操作。我从各种来源拼凑了一些有关从 powershell 调用 API 的信息,但我无法让它工作。这是我尝试做的一个例子:
\n$photo = ([ADSISEARCHER]\xe2\x80\x9csamaccountname=$($username)\xe2\x80\x9d).findone().properties.thumbnailphoto\n$path = "C:\\temp\\Photo.jpg"\n$photo | set-content $path -encoding byte\n\n\n[Windows.System.UserProfile.UserInformation,Windows.System.UserProfile,ContentType=WindowsRuntime] > $null\n[Windows.System.UserProfile.UserInformation]::SetAccountPictureAsync($photo)\nRun Code Online (Sandbox Code Playgroud)\n我尝试了其他一些变体,但无论我做什么,我最终都会遇到这样的错误:
\nCannot convert argument "image", with value: "System.Object[]", for "setAccountPictureAsync" to type "Windows.Storage.IStorageFile" . . . \nRun Code Online (Sandbox Code Playgroud)\n我是否缺少一些简单的东西来完成这项工作?
\n我发现Keith Hill 的这篇博文似乎可能有帮助,但我不确定它是否直接转化为我遇到的问题。
\n谢谢!
\n奥罗克
\n