How to update every single Active Directory User Attributes with Powershell – Part 3

From time to time, I always struggle a little, on how to update specific AD Attributes or I am not sure what is the correct property Name. So this should be a good list, of “all” Active Directory User Attributes, and how you can Update, Change, Set or Clear with PowerShell. So I have created a script of how to set, modify, or clear custom attributes in Active Directory with PowerShell

Starting with the Blog Idea is thought I will go through each Attribute on the “Attribute Editor” Tab. Very quickly I came to the conclusion to limit the List a little, as there are several attributes where it makes no sense to update them through PowerShell. So this list is huge, but not a complete Attribute List.

All 4 Parts are here

How to update every single Active Directory User Attributes with Powershell – Part 1 – TechGuy
How to update every single Active Directory User Attributes with Powershell – Part 2 – TechGuy
How to update every single Active Directory User Attributes with Powershell – Part 3 – TechGuy
How to update every single Active Directory User Attributes with Powershell – Part 4 – TechGuy

A Full documented List from Microsoft is here: All Attributes – Win32 apps | Microsoft Docs


So I have created a Test User in my Active Directory with the Name “Michael Techguy” and the UPN and SamAccountName TecMi

Please see other Parts here

How to update every single Active Directory User Attributes with Powershell – Part 1 – TechGuy

The List


name

GUI

Name in AD USer Liste in Active Directory Console

PowerShell

#SET Values
Get-ADUser -Identity TecMi | Rename-ADObject -NewName "New Name" 

#CLEAR Value

#READ Value
Get-ADUser -Identity TecMi -Properties name | Select-Object -Property name

o

GUI

NO

PowerShell

#SET Values
Set-ADUser -Identity TecMi  -Replace @{o="au2mator"}

#CLEAR Value
Set-ADUser -Identity TecMi -Clear o

#READ Value
Get-ADUser -Identity TecMi -Properties o | Select-Object -Property o

otherFacsimileTelephoneNumber

GUI

TAB: Telephones / Fax / Other…

PowerShell

#SET Values
Set-ADUser -Identity TecMi -Replace @{otherFacsimileTelephoneNumber=@("+123", "456", "+789")}
Set-ADUser -Identity TecMi -Add @{otherFacsimileTelephoneNumber=@("656566")}
Set-ADUser -Identity TecMi -Remove @{otherFacsimileTelephoneNumber=@("656566")}

#CLEAR Value
Set-ADUser -Identity TecMi -Clear otherFacsimileTelephoneNumber

#READ Value
Get-ADUser -Identity TecMi -Properties otherFacsimileTelephoneNumber | Select-Object -Property otherFacsimileTelephoneNumber

otherHomePhone

GUI

TAB: Telephones / Home / Other…

PowerShell

#SET Values
Set-ADUser -Identity TecMi -Replace @{otherHomePhone=@("+123", "456", "+789")}
Set-ADUser -Identity TecMi -Add @{otherHomePhone=@("656566")}
Set-ADUser -Identity TecMi -Remove @{otherHomePhone=@("656566")}

#CLEAR Value
Set-ADUser -Identity TecMi -Clear otherHomePhone

#READ Value
Get-ADUser -Identity TecMi -Properties otherHomePhone | Select-Object -Property otherHomePhone

otherIpPhone

GUI

TAB: Telephones / Home / Other…

PowerShell

#SET Values
Set-ADUser -Identity TecMi -Replace @{otherIpPhone=@("+123", "456", "+789")}
Set-ADUser -Identity TecMi -Add @{otherIpPhone=@("656566")}
Set-ADUser -Identity TecMi -Remove @{otherIpPhone=@("656566")}

#CLEAR Value
Set-ADUser -Identity TecMi -Clear otherIpPhone

#READ Value
Get-ADUser -Identity TecMi -Properties otherIpPhone | Select-Object -Property otherIpPhone

otherMobile

GUI

TAB: Telephones / Mobile / Other…

PowerShell

#SET Values
Set-ADUser -Identity TecMi -Replace @{otherMobile=@("+123", "456", "+789")}
Set-ADUser -Identity TecMi -Add @{otherMobile=@("656566")}
Set-ADUser -Identity TecMi -Remove @{otherMobile=@("656566")}

#CLEAR Value
Set-ADUser -Identity TecMi -Clear otherMobile

#READ Value
Get-ADUser -Identity TecMi -Properties otherMobile | Select-Object -Property otherMobile

otherPager

GUI

TAB: Telephones / Pager / Other…

PowerShell

#SET Values
Set-ADUser -Identity TecMi -Replace @{otherPager=@("+123", "456", "+789")}
Set-ADUser -Identity TecMi -Add @{otherPager=@("656566")}
Set-ADUser -Identity TecMi -Remove @{otherPager=@("656566")}

#CLEAR Value
Set-ADUser -Identity TecMi -Clear otherPager

#READ Value
Get-ADUser -Identity TecMi -Properties otherPager | Select-Object -Property otherPager

otherTelephone

GUI

TAB: General / Telephone number / Other…

PowerShell

#SET Values
Set-ADUser -Identity TecMi -Replace @{otherTelephone=@("+123", "456", "+789")}
Set-ADUser -Identity TecMi -Add @{otherTelephone=@("656566")}
Set-ADUser -Identity TecMi -Remove @{otherTelephone=@("656566")}

#CLEAR Value
Set-ADUser -Identity TecMi -Clear otherTelephone

#READ Value
Get-ADUser -Identity TecMi -Properties otherTelephone | Select-Object -Property otherTelephone

pager

GUI

TAB: Telephones / Pager:

PowerShell

#SET Values
Set-ADUser -Identity TecMi  -Replace @{pager="12334534"}

#CLEAR Value
Set-ADUser -Identity TecMi -Clear pager

#READ Value
Get-ADUser -Identity TecMi -Properties pager | Select-Object -Property pager

personalTitle

GUI

NO

PowerShell

#SET Values
Set-ADUser -Identity TecMi  -Replace @{personalTitle="Dr"}

#CLEAR Value
Set-ADUser -Identity TecMi -Clear personalTitle

#READ Value
Get-ADUser -Identity TecMi -Properties personalTitle | Select-Object -Property personalTitle

photo

GUI

NO

PowerShell

#SET Values
$photo = [byte[]](Get-Content -Path D:\HEad.png -AsByteStream)
Set-ADUser -Identity TecMi -Replace @{photo=$photo} 

#CLEAR Value
Set-ADUser -Identity TecMi -Clear photo

#READ Value
Get-ADUser -Identity TecMi -Properties photo | Select-Object -Property photo


physicalDeliveryOfficeName

GUI

NO

PowerShell

#SET Values
Set-ADUser -Identity TecMi  -Replace @{physicalDeliveryOfficeName="Floor 2"}

#CLEAR Value
Set-ADUser -Identity TecMi -Clear physicalDeliveryOfficeName

#READ Value
Get-ADUser -Identity TecMi -Properties physicalDeliveryOfficeName | Select-Object -Property physicalDeliveryOfficeName

postalAddress

GUI

NO

PowerShell

#SET Values
Set-ADUser -Identity TecMi -Replace @{postalAddress=@("Street 2, 4044 Place")}
Set-ADUser -Identity TecMi -Add @{postalAddress=@("Street 1, 4044 Place")}
Set-ADUser -Identity TecMi -Remove @{postalAddress=@("Street 1, 4044 Place")}

#CLEAR Value
Set-ADUser -Identity TecMi -Clear postalAddress

#READ Value
Get-ADUser -Identity TecMi -Properties postalAddress | Select-Object -Property postalAddress

postalCode

GUI

TAB: Address / Zip/Postal Code:

PowerShell

#SET Values
Set-ADUser -Identity TecMi  -PostalCode "4540"

#CLEAR Value
Set-ADUser -Identity TecMi -Clear postalCode

#READ Value
Get-ADUser -Identity TecMi -Properties postalCode | Select-Object -Property postalCode

postOfficeBox

GUI

TAB: Address / P.O. Box:

PowerShell

#SET Values
Set-ADUser -Identity TecMi -Replace @{postOfficeBox=@("Street 2, 4044 Place")}
Set-ADUser -Identity TecMi -Add @{postOfficeBox=@("Street 1, 4044 Place")}
Set-ADUser -Identity TecMi -Remove @{postOfficeBox=@("Street 1, 4044 Place")}

#CLEAR Value
Set-ADUser -Identity TecMi -Clear postOfficeBox

#READ Value
Get-ADUser -Identity TecMi -Properties postOfficeBox | Select-Object -Property postOfficeBox

GitHub

Here is the GitHub Repo: Seidlm/Active-Directory (github.com)

Michael Seidl, aka Techguy
au2mate, everything

Leave a Comment

Your email address will not be published. Required fields are marked *

*