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

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


givenName

GUI

TAB: General/ First Name:

PowerShell

#SET Values
#SET Values
Set-ADUser -Identity TecMi -GivenName "Michael"

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

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

homeDirectory

GUI

TAB: Profile / Home folder / Connect:

PowerShell

#SET Values
Set-ADUser -Identity TecMi -HomeDirectory "\\server\share"

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

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

homeDrive

GUI

TAB: Profile / Home folder / Connect :

PowerShell

#SET Values
Set-ADUser -Identity TecMi -HomeDrive "z:"

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

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

homePhone

GUI

TAB: Telephones / Home:

PowerShell

#SET Values
Set-ADUser -Identity TecMi -HomePhone "+43 665 3728193"

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

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

homePostalAddress

GUI

NO

PowerShell

#SET Values
Set-ADUser -Identity TecMi -Replace @{homePostalAddress="Street, Place"}

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

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

houseIdentifier

GUI

NO

PowerShell

#SET Values
Set-ADUser -Identity TecMi -Replace @{houseIdentifier="17"}

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

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

info

GUI

TAB: Telephones / Notes:

PowerShell

#SET Values
Set-ADUser -Identity TecMi -Replace @{info="INFO"}

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

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

initials

GUI

TAB: General / Initials:

PowerShell

#SET Values
Set-ADUser -Identity TecMi -Initials "SeiMi"

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

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

internationalISDNNumber

GUI

NO

PowerShell

#SET Values
Set-ADUser -Identity TecMi -Replace @{internationalISDNNumber="0123456"}

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

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

ipPhone

GUI

TAB: Telephones / IP phone:

PowerShell

#SET Values
Set-ADUser -Identity TecMi -Replace @{ipPhone="0123456"}

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

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

jpegPhoto

GUI

NO

PowerShell

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

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

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

l

GUI

TAB: Address / City

PowerShell

#SET Values
Set-ADUser -Identity TecMi -City "Pfarrkirchen"

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

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

manager

GUI

TAB: Organization / Manager / Name:

PowerShell

#SET Values
Set-ADUser -Identity TecMi -Manager (Get-ADUser -Identity m.seidl)

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

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

middleName

GUI

NO

PowerShell

#SET Values
Set-ADUser -Identity TecMi -Replace @{middleName="Markus"}

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

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

mobile

GUI

TAB: Telephones / Mobile:

PowerShell

#SET Values
Set-ADUser -Identity TecMi -MobilePhone "+4 364 6 6 465"

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

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

GitHub

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

Michael Seidl, aka Techguy
au2mate, everything

2 thoughts on “How to update every single Active Directory User Attributes with Powershell – Part 2”

  1. Pingback: How to update every single Active Directory User Attributes with Powershell - Part 4 - TechGuy

  2. Pingback: Microsoft Cloud ve Datacenter Management Şubat 2022 Bülten – Sertaç Topal

Leave a Comment

Your email address will not be published.

*

%d bloggers like this: