|
1).regsvr32 schmmgmt.dll, 用MMC 打开"Active Directory架构"
2).在"Active Directory架构"中展开"属性",定位到"thumbnaiIPhoto",勾选"将此属性复制到全局编录(R)".
3).打开EMS,使用命令进行图片导入
Import-RecipientDataProperty -Identity "jaimy" -Picture -FileData ([Byte[] $(Get-Content -Path "C:\jpg\jaimy.jpg" -Encoding Byte -ReadCount 0))
注:"jaimy":AD中的账号,"C:\jpj\jaimy.jgp":图片的路径.
4).删除用户图片
Set-Mailbox "jaimy" -RemovePicture
5). 批量导入图片
$PhotoPath = "C:\Photos\*.*"
ForEach ($PhotoFile in gci $PhotoPath)
{
$User = '' + $PhotoFile.Name.substring(0, $PhotoFile.Name.Length - 4)+''
Import-RecipientDataProperty -Identity $User -Picture -FileData ([Byte[]]$(Get-Content -Path $PhotoFile.Fullname -Encoding Byte -ReadCount 0))
}
6).在AD中导出图片
Export-RecipientDataProperty -Identity "Rachel Peach" -Picture | ForEach {$_.FileData | Add-Content C:\exported\RachelPeach.jpg -Encoding Byte} |
|
|