You can use PowerShell to update a user's photo in Active Directory (AD). Here are the steps to do this:
1.Connect to your AD: To connect to your AD, open PowerShell and run the following command:
Import-Module ActiveDirectory
2.Get the user: To get the user that you want to update, run the following command, replacing "UserName" with the name of the user:
$user = Get-ADUser -Filter "Name -eq 'UserName'" -Properties thumbnailPhoto
3.Update the photo: To update the user's photo, you need to convert the photo to a byte array and set the "thumbnailPhoto" property of the user object. Here's an example that updates the user's photo with a file named "photo.jpg":
$photo = [Byte[]](Get-Content -Path "C:\path\to\photo.jpg" -Encoding Byte)
$user.thumbnailPhoto = $photo
Set-ADUser -Instance $user
4.Verify the update: To verify that the photo was successfully updated, you can retrieve the user object again and inspect the "thumbnailPhoto" property:
$user = Get-ADUser -Identity $user.DistinguishedName -Properties thumbnailPhoto
$user.thumbnailPhoto
If the photo was successfully updated, you should see the byte array representing the photo.
These are the steps to update a user's photo in AD using PowerShell. By using PowerShell, you can automate the process of updating photos and perform other tasks related to AD management.
'Windows Server' 카테고리의 다른 글
How to migrate SID values from A to B domain (0) | 2023.02.09 |
---|---|
On-premises Active Directory (AD) (0) | 2023.02.09 |
How to Check Active Directory (AD) replication (0) | 2023.02.09 |
Active Directory 그룹 관리 (0) | 2023.01.30 |
Active Directory 메일 속성 업데이트(Powershell) (0) | 2022.09.10 |