Import thumbnailphoto in AD from jpg

The script below will import JPG file as a thumbnailphoto in ActiveDirectory

$username = "p01001"
$jpgfile = "C:\PICTURE.jpg"
 

$dom = [System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain()
$root = $dom.GetDirectoryEntry()
$search = [System.DirectoryServices.DirectorySearcher]$root
$search.Filter = "(&(objectclass=user)(objectcategory=person)(samAccountName=$username))"
$result = $search.FindOne()
 
if ($result -ne $null)
{
 $user = $result.GetDirectoryEntry()
 [byte[]]$jpg = Get-Content $jpgfile -encoding byte
 $user.put("thumbnailPhoto",  $jpg )
 $user.setinfo()
 Write-Host $user.displayname "updated"
}
else {Write-Host $user "Does not exist"}

~Pouyan

Active Directory FSMO Roles

Flexible Single Master Operation Roles (FSMO)

Active Directory has five special roles which are vital for the smooth running of AD as a multimaster system. Some functions of AD require there is an authoritative master to which all Domain Controllers can refer to. These roles are installed automatically and there is normally very little reason to move them, however if you de-commission a DC and DCPROMO fails to run correctly or have a catastrophic failure of a DC you will need to know about these roles to recover or transfer them to another DC.
The forest wide roles must appear once per forest, the domain wide roles must appear once per domain. Continue reading Active Directory FSMO Roles

Transferring an Operations Master Role (04)

Transfer the Domain-Level Operations Master Roles

You can use this procedure to transfer the following three domain-level operations master (also known as flexible single master operations or FSMO) roles:

  • Primary domain controller (PDC) emulator operations master
  • Relative ID (RID) operations master
  • Infrastructure operations master

You might want to transfer a domain-level operations master role if the domain controller that currently hosts the role is inadequate, has failed, or is being decommissioned. You can transfer all domain roles by using the Active Directory Users and Computers snap-in. Continue reading Transferring an Operations Master Role (04)

Transferring an Operations Master Role (03)

Transfer the Domain Naming Master

You can use this procedure to transfer the domain naming operations master role if the domain controller that currently hosts the role is inadequate, has failed, or is being decommissioned. The domain naming master is a forest-wide operations master (also known as flexible single master operations or FSMO) role. Continue reading Transferring an Operations Master Role (03)

Transferring an Operations Master Role (02)

Transfer the Schema Master

You can use this procedure to transfer the schema operations master role if the domain controller that currently hosts the role is inadequate, has failed, or is being decommissioned. The schema master is a forest-wide operations master (also known as flexible single master operations or FSMO) role. Continue reading Transferring an Operations Master Role (02)

Transferring an Operations Master Role (01)

When you create a new domain, the Active Directory Domain Services Installation Wizard automatically assigns all the domain-level operations master roles to the first domain controller that is created in that domain. When you create a new forest, the wizard also assigns the two forest-level operations master roles to the first domain controller. After the domain is created and functioning, you might transfer various operations master roles to different domain controllers to optimize performance and simplify administration. Continue reading Transferring an Operations Master Role (01)

Install the Schema Snap-In

Before you can install the Active Directory Schema snap-in, must either install the Active Directory Domain Services (AD DS) server role or the Windows Server 2008 Remote Server Administration Tools (RSAT) for Windows Vista Service Pack 1 (SP1). For download and installation information about RSAT, see article 941314 in the Microsoft Knowledge Base (http://go.microsoft.com/fwlink/?LinkID=116179).
Continue reading Install the Schema Snap-In