Renaming a User
This topic explains how to use the Active Directory module for Windows PowerShell to rename a user.
Example
The following example demonstrates how to change the relative distinguished name (also known as RDN) of the user Sara Davis to Sara Hettich:
Rename-ADObject 'CN=Sara Davis,OU=Finance,DC=Fabrikam,DC=com' -NewName 'Sara Hettich'
Rename-ADObject 'CN=Sara Davis,OU=Finance,DC=Fabrikam,DC=com' -NewName 'Sara Hettich'
Additional information
For a full explanation of the parameters that you can pass to Rename-ADObject, at the Active Directory module command prompt, type Get-Help Rename-ADObject –detailed, and then press ENTER.
Copy a User's Properties
This topic explains how to use the Active Directory module for Windows PowerShell to copy the properties of one user to another user.
Example
The following example is a sample script that you can use to copy the properties of the user Sara Davis to the user Miles Reid:
$u=Get-ADUser -Identity Sara Davis -Properties *
New-ADUser -Instance $u -SamAccountName Miles Reid
A script is a series of Active Directory module cmdlets. For more information about running Active Directory module scripts see, Running Windows PowerShell Scripts (http://go.microsoft.com/fwlink/?LinkID=119588)
$u=Get-ADUser -Identity Sara Davis -Properties *
New-ADUser -Instance $u -SamAccountName Miles Reid
A script is a series of Active Directory module cmdlets. For more information about running Active Directory module scripts see, Running Windows PowerShell Scripts (http://go.microsoft.com/fwlink/?LinkID=119588)
Additional information
You can use the following parameters when you set many of the common values that are associated with creating a new user in Active Directory Domain Services (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
- City
- Country
- EmailAddress
- Fax
- LogonWorkstations
- MobilePhone
- Office
- OfficePhone
- Organization
- OtherName
- POBox
- SmartcardLogonRequired
- State
- Surname
No comments:
Post a Comment