Completely rename a Windows server 2000 account (all three names)

Top  Previous  Next


[Settings_Begin]
BatchSettings.Delimiter=TAB
BatchSettings.MarkerCol=4
SET ADDomainPath=dc=com/dc=acme/dc=D09
SET ADOUName=MyOU
SET ADOUPath=%ADDomainPath%/ou=%ADOUName%
[Settings_End]

[Machines_Begin]
\\MAIN01      NT PDC    
[Machines_End]

[Batch_Begin]
Data.Loop   
AD.Account.SetProperty %ADOUPath%/cn=%col2%,samAccountName,%col3%
AD.Account.SetProperty %ADOUPath%/cn=%col2%,UserPrincipalName,%col3%@acme.com   
AD.Account.SetProperty %ADOUPath%/cn=%col2%,CommonName,%col3%   
Data.EndLoop   
[Batch_End]

[Data_Begin]
   OldAccountName   NewAccountName   
[Data_End]

About the script

First read this: About Windows 2000 server account Names

·This script first changes the SamAccountName and then UPN and Common name.  
·Domain name = "D09.acme.com" -> "SET ADDomainPath=dc=com/dc=acme/dc=D09"  
·Server name = "\\MAIN01" -> listed in [Machines] section