You can see from the two Powershell Get commands what I return for each query. When we mark a user for deletion we right click the name in AD and select rename, prepend Del_Date, then you get the popup box asking if you want to change the other relevant name fields to be the same.
If you look at a User’s AD attributes, in the AD console, the Name object can only be viewed, it can’t be edited.
So in the example below I added 1 to the end of my test account name, in the GUI but left the other entries the same. So I can see that the object that got updated was “Name” and "DistingushedName".
Now Set-ADobject nor Set-ADuser have a ”–name” option. There doesn’t look to be a “-distinguisedname” either.
So I can do it through the GUI but don’t seem to be able to do it with Powershell. Any suggestions?
PS U:\> Get-ADObject -Identity "CN=jhmailtestcs1,OU=Test,OU=Here,DC=There,DC=Everywhere,DC=uk"
DistinguishedName Name ObjectClass ObjectGUID
----------------- ---- ----------- ----------
CN=jhmailtestcs1,OU=Test Etc jhmailtestcs1 user 365e58b4
PS U:\> get-aduser jhmailtestcs
DistinguishedName : CN=jhmailtestcs1,OU=Test Etc
Enabled: True
GivenName: JHMailTestCS
Name: jhmailtestcs1
DisplayName: jhmailtestcs
ObjectGUID: 365e58b4
SamAccountName: JHMailTestCS
Surname: Test
UserPrincipalName : JHMailTestCS@Here.There.uk