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)"
}
}
0 comments
Hide comments