Forum Discussion

TDJNL2006's avatar
TDJNL2006
Copper Contributor
May 31, 2021

Bulk change preferredLanguage on-premise Active Directory

Hi all,

 

I need to change preferredLanguage (Attribute Editor) on our on-premise AD for all users to nl-NL.

 

I'm searching Google for over one hour, but only find a lot of information related to O365 (Azure AD).

 

 

I should start with the GET-command below to 'find' all users.

Get-ADOrganizationalUnit -Filter { name -like '*users*' }

 

 

What script should i use to change attribute preferredLanguage to nl-NL?

 

Already big thanks for your support!

  • AndySvints's avatar
    AndySvints
    Steel Contributor

    Hello TDJNL2006,

    To change attribute for Active Directory objects you should use Set-ADObject cmdlet.

    Once you get users then loop trough the collection and set required attribute:

    $AllUsers=Get-ADUser -Filter *
    
    foreach ($u in $AllUsers){
        Set-ADObject -Identity $u.DistinguishedName -replace @{preferredLanguage="nl-NL"}
    }

    Hope that helps.

Resources