Partager via


Modifying an Attribute for Several Users at Once

Applies To: Windows Server 2008 R2

This topic explains how to use the Active Directory module for Windows PowerShell to modify an attribute in Active Directory Domain Services (AD DS) for several users at once.

Example

The following example demonstrates how to retrieve the user objects in the organizational unit (OU) Finance and set their description attribute:

Get-ADUser -Filter 'Name -like "*"' -SearchBase "OU=Finance,OU=UserAccounts,DC=FABRIKAM,DC=COM" | Set-ADUser -Description "Member of the Finance Department"

Additional information

You can use the following parameters when you set many of the common values that are associated with a user object in AD DS:

  • -AccountExpirationDate

  • -AccountNotDelegated

  • -AccountPassword

  • -AllowReversiblePasswordEncryption

  • -CannotChangePassword

  • -ChangePasswordAtLogon

  • -Enabled

  • -PasswordNeverExpires

  • -PasswordNotRequired

  • -SmartcardLogonRequired

  • -TrustedForDelegation

  • -DisplayName

  • -GivenName

  • -Initials

  • -OtherName

  • -Surname

  • -Description

  • -City

  • -Country

  • -POBox

  • -PostalCode

  • -State

  • -StreetAddress

  • -Company

  • -Department

  • -Division

  • -EmployeeID

  • -EmployeeNumber

  • -Manager

  • -Office

  • -Organization

  • -Title

  • -Fax

  • -HomePhone

  • -MobilePhone

  • -OfficePhone

  • -EmailAddress

  • -HomeDirectory

  • -HomeDrive

  • -HomePage

  • -ProfilePath

  • -ScriptPath

  • -Certificates

  • -LogonWorkstations

  • -PermittedLogonTimes

  • -UserPrincipalName

  • -ServicePrincipalNames

In addition to the standard Lightweight Directory Access Protocol (LDAP) attributes, you can retrieve the following extended properties of the Get-ADUser cmdlet by using the -Properties parameter:

  • City

  • Country

  • EmailAddress

  • Fax

  • LogonWorkstations

  • MobilePhone

  • Office

  • OfficePhone

  • Organization

  • OtherName

  • POBox

  • SmartcardLogonRequired

  • State

  • Surname

For a full explanation of the parameters that you can pass to Set-ADUser or Get-ADUser, at the Active Directory module command prompt, type Get-Help Set-ADUser –detailed or Get-Help Get-ADUser –detailed, and then press ENTER.