Change the title of AD users from PowerShell

Change the title of AD users from PowerShell

Q. How can I view and change the title of AD users via PowerShell?

A. By default many attributes are not returned when fetching an AD user however it is easy to set the exact properties required and then modify. The code below shows an example by specifying the properties to fetch which includes title.

$accounts=Get-ADUser -Filter * -properties sAMAccountName, UserPrincipalName, title
foreach($account in $accounts)
{
  if($account.title.StartsWith("Quality Control Inspector"))
  {
    $account | Set-ADUser -Title "Developer (MSDN)"
  }
}

 

Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish